Hi guys,
I’m looking for some advice or resources on game programming patterns / architectures that are most appropriate to handle interactions between entities in games. To give some background, I am currently designing a game mechanic where projectiles are launched in space and affected by the orbital gravity of planets (similar to Angry Birds in Space). In this case, the projectile entities need to be aware of the positions of the planet entities in order to calculate their velocities due to gravity. They also need to be aware of other projectile entities for collision detection.
After doing some research I have come up with the following potential solution:
- Create an entity management class to store reference to all entities.
- Pass entity manager to entities during construction.
- During game loop update, the projectile objects can access the planet objects via the entity manager class to calculate velocity and collision detection.
However, it seems like the point of having an entity manager is so that the entity manager can perform the collision detection so that the entity classes do not need to know of one another. However, the entity manager would then also need to calculate the velocities for each projectile, per update, and this is where i get confused.
I get that I can simply pass a planet entity list to the projectile class update function, but what about in big games where many entities require information on each other to function correctly?
I would really appreciate if anyone can share any resources that could help me build a pretty architecture for this, or how they handle these types of interactions themselves.
Getting my head around programming architectures is the reason I enjoy game programming.