Game structure

BlitzMax Forums/BlitzMax Beginners Area/Game structure

Gavin Beard(Posted 2008) [#1]
Hi all,

I'm in the middle of writing a little game, and just wanted to ask how people structure thier games?

The way i've done it so far is wrap the major parts in types, so i have a Count down timer type, a game board type, splash screen type, player types etc, which are responsible for loading their own images and data etc, dending on whats passed to them when i create a new instance of that type.

Then the main loop of my code creates an instance of the relevent type when it is needed, depending on the state of the game, i.e Gamestate could be MainMenu, Settings, InGame etc...

is this an efficient way of doing stuff or is there a better way? how do other people handle this?

Thanks


itsdanreed(Posted 2008) [#2]
I structure mine as a base class called GameObject, which contains an abstract functions called Update( ) and then every object in my game is it's own class extending GameObject. Then the game engine contains a list of these objects which it updates each one every pass.
Also, I create a class called GameState, and then extend it with a class for each gamestate, which is just like gameobject.


Volker(Posted 2008) [#3]
In a german forum for BMax someone posted
a gamemanager module.
The comments will not help you, but perhaps
the structure is interesting for your.
The mod is using gamestates which can be started, terminated,
paused etc while activating other.
The gamestates are passed as objects to the gamemanager.





ImaginaryHuman(Posted 2008) [#4]
For the most part I make a custom type with a bunch of methods/functions and various fields, for each major section of the engine. Then I have one other type which is to do with giving structure to the whole system like a scenegraph or whatever, from which all other types/objects are referenced.
Generally speaking it makes things easier usually when you divide up the problem into many smaller parts and make things modular.


Gavin Beard(Posted 2008) [#5]
Thanks for the info guys big help