After the first milestone, i extracted the following first design für a Game Engine:
First, the game is quantized into "game ticks", to which the whole game is synchronized.
-- GameObjects --
A GameObject is a thing in the game that represents an entity which encapsulates either a visible object or some other encapsulated property.
visible GameObjects are associated with a sprite or a movieclip (animation)
each GameObject has an update() method that is called each tick which may or may not update any internal state changes
each gameobject is part of a specific family of things (e.g. "enemies"), the GameObjectType
GameObjects can be active or inactive (no update, no iteration)
-- GameObjectStorage --
All GameObjects are stored in a global storage from which they can be accessed
iterate over all GameObjects
iterate over all GameObjects of a specific GameObjectType
-- GameEvent --
A GameEvent is basically a piece of code that can be scheduled for execution, with an optional delay. All GameEvents are synchronized in one global queue. A GameEvent is automatically removed from the queue after execution.
any game logic (e.g. when a enemy is hit, remove enemy object and create explosion which will be removed after a specific delay), so GameEvents can create new GaneEvents
After the first milestone, i extracted the following first design für a Game Engine:
First, the game is quantized into "game ticks", to which the whole game is synchronized.
-- GameObjects -- A GameObject is a thing in the game that represents an entity which encapsulates either a visible object or some other encapsulated property.
-- GameObjectStorage -- All GameObjects are stored in a global storage from which they can be accessed
-- GameEvent -- A GameEvent is basically a piece of code that can be scheduled for execution, with an optional delay. All GameEvents are synchronized in one global queue. A GameEvent is automatically removed from the queue after execution.
Examples of GameEvents: