How to prioritize related game entity components?
- by Paul Manta
I want to make a game where you have to run over a bunch of zombies with your car. When moving around, the zombies have a few things to take into consideration:
When there's no player around they might just roam about randomly. And even when some other component dictates a specific direction, they should wobble to the left and right randomly (like drunk people). This implies a small, random, deviation in their movement.
They should avoid static obstacles. When they see they are headed towards a wall, they should reorient themselves.
They should avoid the car. They should try to predict where the car will be based on its velocity and try to move out of the way.
When they can, they should try to get near the player.
All these types of decisions they have to do seem like they should be implemented in different components. But how should I manage them? How can I give different components different weights that reflect the importance of each decision (in a given situation)?
I would need some other component that acts as a manager, but do you have any tips on how I should implement it? Or maybe there's a better solution?...