Nitram wrote:
I was not active quite some time here and I can't tell you "the best way".
But here is mine:
After all we always have to consider that a game is a single instance thing. You'll never have more then 1 game instance running in your application at the same time. So statics or singletons are the way to go.
What I did in my game (its not a platformer), is that I created a tree like structure. I got a single center class. This class maintains a instance of the class for the game logic and the update/render lists. From this centered class you can for example access the class that contains the game logic, such as the map, the weather, the active player, the other players (its a multiplayer game) and so on. Classes that require is are able to access the centered class to register to the update or the render loop in order to the the respective thing.
So after all its a "kind of" singleton concept with the advantage that I can remove and recreate the centeral class in case I want to reset the application and start the game from the beginning.
Nitram
I use this concept in my games as well. Its a very organized way of handling everything and keeps things simple.
I highly recommend this for any game
