Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
> calculated path can take into account the paths computed for other units. Sorry, can you please explain? As for game, it is Tower Defence PvP game where you can't give orders to your units; you only can spawn them.
Then in case when AI system found colliding path for two units. And when one moved to cell and second can't (because cell already occupied) what should I do? Recalculate path? Or just stay and continue moving along current path at next tick?
Also I don't well understand what AI system should be doing? Only decides which action to take? Or against who that action should be too? Then what attack system should do? It already have target, so I just need to take hp? And what if hp already <= 0?
> Add a component/system for AI. But what if we should be able to change decision midway? For example, 4 units decided to attack same target. AI system finished work. Then Attack system perform attack for each unit sequentially. Third unit killed target. Forth unit should choose new, but new target is far away, that means he really should move instead of attack. How to handle that?
First question is gone. Thanks. I edited second question, could you look one more time please? I described way to move units in current OOP approach and I don't know how to do same thing in ES.