I am currently developping a 3D game using C# / XNA 4.0 and i am currently thinking about how i should structure my game. The actual game is in fact not really important as the framework i am working on right know is pretty generic.
1st layer :
- BaseFrameWork : This BaseFrameWork is managing all the different game modules
2nd layer :
- ContentProvider : This module is a layer loading all the needed content (texture/sound/models) and providing it when needed
- SoundManager : This module is handling all the audio request (music activation, music change, sound activation, ect)
- InputEventHandler : This module is handling all the inputs of the player. Some flags are provided to each module to operate (for example there is a flag "toggleMusic" which is turned on when the player is pressing "M" while in game.
- ObjectFactory : This module is creating all the different objects when it is needed (for example creating a floor, boxes and other stuff)
- Player : This module is exclusively dedicated to the player.
- HeadUpDisplay : This module is dedicated to write the HUD (2D) of the game
Currently the 3rd layer is not developped (i have a few different objects for the ObjectFactory but that's all).
My first question is : "Knowing how is structured my game, do you think i should do it differently, and why ? For example, should player be part of the ObjectFactory "
My second question is about the way these different modules should be linked together.
- The easiest option, but (i think) the nastiest one, is to provide to each module a reference of the other ones with everything public. Really easy to implement, really easy to use ingame, but really REALLY nasty.
- One other option could be to let the BaseFrameWork get the useful informations of a module to give it to an other module.
- Other options ?
These questions may seem basic and common sense, but last time i have been part of a game development, it looked nice (http://yapt.free.fr/) but i think we/I could have done better by spending more time into the game architecture beforehand instead of just diving the head in water.
Thanks for your comments/advice