Hi!
I'm fairly new to game programming. Before beginning to program I decided to design a framework for 2D action games with UML.
This is the "small" version:
Here is a (really!)
big version for the details.
I'm really doubtful if this design is the right one. It looks far to complicated for simple games like a Pong-Clone. In the future I want to adapt it for much more complicated games like a North-and-South-Clone (
http://hol.abime.net/995).
Maybe I should explain some things:
*) TheGame is a (singleton) class. It contains the eventloop, which calls methods of the GameController which decides what to do when a specific event (like the "A"-Key has been pressed) arises and methods of the TimeSubject which tries to keep the framerate constant (in pattern language it's implemented as an observer which calls the "tick()" method of objects that are dependend on time).
*) I tried to use EventDriven Programming for game logics. Each part of the game communicates through messages to the gamelogics.
*) An interesting part could be the Rendering of Sprites since Animations are bound to the different states of a game character (like the ball in the example). The rendering itself happens through the RenderManager which gets the surfaces to blit through a character which gets the current surface through it's state subsequently.
*) I'm a bit unsure about the collission detection. At the moment it's bound to the states of characters since it's depending on the current animation.
What do you think about this design? I'm currently still looking for literature on designing 2D sprite based games with OOP. Up to now I only found literature that was (IMHO) written for academic purposes only ("Patterns in Game Design" specificly).
Thanks for reading and looking
Rainer