As a learning exercise I’m trying to create an AI; what I would like some help with is how to structure the interactions between the different entities in the game
Here are the questions I have a few questions:
- Say I have one AI (a monster for example) and it perceives another actor (this could be another monster, or a human, etc.), how should it determine if this other actor is an enemy or a friend?
- If it has determined that the other actor is an enemy and then attacks it, how will this work - the other actor needs to lose health and possibly know that it was attacked so that it can respond.
- And then, if the other actors dies for some reason while the monster is attacking, how will it receive this information again?
I realize it might depend on the situation, but what’s a good way to handle this?
What I’ve thought of is to perhaps create a component (calling it something like Entity or Unit) which will hold data such as Team, Health, etc. and have functions such as ApplyDamage(), IsAlive(), etc.