Hi,
I have a battle system, every unit has a Playmaker brain, they Search&Attack enemies. But having numerous units slow down the game.
I am considering, forming the units in formations (under a Parent object) and instead of putting Search&Attack FSM to each unit, putting the Search&Attack FSM to Parent objects only may reduce the performance issues. It will be like, instead of 100 walking units with FSM brains in the battlefield, there will be 100 units with 5 FSM brains in total. I am sure it will have some good change.
At this point, I need some guidance with fresh ideas. How should I keep the units in formation (like soldiers in Roman legions or Aircrafts attacking a city in formation), units position themselves, or How I can send Animator commands to all units under Troop parent altogether (When staying, they all get "Idle" command; when walking, they all get "Walk" command; near enemy, only the front row of soldiers get "Fight" animaton command, etc.)
For example, if front row of soldiers leave the formation to attack enemies, I think I need to save position of units under Troop object first, then when they finish their attack duty, they need to use "Move Towards" action to return their original position in the formation.
Also how I can change the formation (like square formation, triangle, or rectangle like we do in Totalwar games), I really wonder. Or at least, when a soldier is missing, rest of the soldiers need to re-form the group and formation should be resized.
This is lots of job, I know. But if you have ideas in any one of them, please throw them to me, thanks.