I am trying to make a simple real-time strategy game (only the battle system of units fighting each other; no building, no economy, only battles and victory). I am using flow fields to make the units move.
I don't know how to make the AI take the right actions when I completing a move.
For example, I have a ranged unit, its behavior should move to its firing distance from the enemy and stop (or orbit/strafe in a circle around the enemy) and attack the enemy. But in my current code, the ranged unit just follows the flow field to move close to the enemy.
I don't know how to make it flee from the enemy until it gets to its attack range.
There is a way is recreate the flow fields to direct the unit to its flee positions from an enemy, but there are many ranged units, and their enemy is same. I don't know if it's right to create many flow fields for the units which have the same target.
I can't find a solution for this condition, I want my AI to behave more freely and not only follow the flow fields.