AI Controller :: How to have independent behaviors instead of "hivemind"

Hello chaps,

I followed the AI Controller tutorial and it works great. However, if I add more AI controller characters, they all come after me, even the ones that are far far away; in other words, I “aggro the whole room”.

I’m looking to have “independent” AI behavior, as in; I get close to one, they chase me, but the other ones remain in their place until I get close to them.

Right now my NPC blueprint has the Pawn → AI Controller Class set to the AI_CON

I’m still a noob here, so not really sure how to achieve that desired behavior… any ideas or guidelines?

Regards,

This is a huge topic, but basically you could start with making a sphere that, if you enter it, they will come after you (you can do this by using sphere collision component and the on begin overlap event). That is the analogue to a “hearing radius.”

If you want more complex behavior than that, you could create sight range (a trace node set on visibility). There’s a tutorial for a viewcone under the right answer here: https://answers.unrealengine.com/questions/127128/cone-checkcone-trace.html

The tutorial might point you in the right direction, but I would start basic and keep improving on it in order to stay on top of the logic that is happening. AI can become very complex very fast, and it’s not easy to debug if you don’t know what’s going on in the first place.

Hey Sentura,

The “radius” part actually works fine. I get within 30 meters and they attack me. My problem is that if I spawn an AI character relatively close, and another one 100m away, both of them will come after me, and I would like to have “independent” behaviors, like each one of them chasing me or attacking once Im within 30m. Not sure if that makes sense…

Thanks,

Can you show me your AI controller? Either copy paste it into a txt and attach it here or show me the tutorial.

This kind of behavior should be a given unless there’s something weird going on, such as all of them sharing one instance of an AI controller instead of each having their own instance of the AI controller.

Hello again Sentura,

Thank you very much for following this. For my life I was unable to get the source code of the AI controller, tried right clicking everything I saw but nothing =(

The controller I use comes from this example/tutorial: https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/index.html

Thanks!

For the record, you can drag select and copy all your nodes into a txt document, then attach the txt doc here. Pasting it into blueprints again will yield your exact nodes.

Can you check if you can ever make them stop following you if they go to their own respective home locations or all of them go to one location?

I am having this same “hivemind” problem. If I place multiple instances of the same AI in a level, if one of them finds me and starts following me, all the other AI’s suddenly turn around and follow me. Also after they lose sight of me, rather than going back to their individual home locations, they all gather to one home location.

Hey Sylanar,

Could it be that your Blackboard data is global to all AI’s?
To disable it go to your blackboard details and set the “Instance Synced” bool on false for every variable.

Hope this helps :slight_smile:
Elias