Download

How to handle AI for group?

Hello!
Now I just have one AI controller for each of instances, but I believe there is should be some way to use one controller for all of them, because their behavior is extremely simple.
Is there any guidelines for group AIs?

First you need to consider if the controller is using ANY kind of local state, any data that needs to be persisted localy, or is it completly stateless. If the answer is “it is not stateless” then you will need one controller for each AI regardless, even if it’s simple.
Otherwise, I guess in theory you could create an actor that holds a shared controller, refer to this actor in all instances of the ai, and on tick, run Posses on the current ai updating before running any of the logic. I have no idea how that would behave, there could be threading issues if any of the code is running in parallel, this is all just a BIG theory.

There are ofcourse otherways to do this as well. But nothing that quickly comes to mind.