The game engine architecture will be focused around an entity component system. This system was chosen for its flexibility in creating many unique entities, while alowing for flexible development in the future.
Good resources for learning more about entity component systems follow (in order of helpfulness):
- Introduction to Component Based Design for C++ Games
- Game Programming Primer
- Component Based Engine Design
- Entity Systems Wiki
An entity is just a uid: uint64_t
Transform data is shared between the graphics and physics systems.
- Position: x,y,z
- Rotation: Euler Angle (a, b, y)
- Scale: scalar
- Width
- Height
The MessagingComponent is used to message other objects in the world. An entity's messaging component tells it what to do when it receives a message. Messages are sent to all nearby entities with a messaging component (broadcast).
Triggers are meant to be used
- Action: fn(world)
- Once: bool
- Velocity: vx, vy, vz
- Mass: scalar
- Gravity: bool // if affected by gravity
Sprite - file (png?)
Function OnInput decides what to do with a given user-input. This can be things like changing velocity
The HealthComponent is responsible for keeping track of an entities health. Health is represented as a uin64_t
The physics system is responsible for:
- Detecting collisions
- Updating positions based off of velocity
The engine is a singleton responsible for running the game (it is the game engine). It has a MainLoop function that holds the "main" function. Rather than using a main function directly this allows other programs to use our engine.