AI Perception

I think i finally cracked it!

Ok by default ALL pawns are registered as sense stimuli , this coupled with the apparent (undocumented) limit on the number of pawns that can be sensed at any given time.

So the fix?

Close your project
Navigate to you project folder
Inside the “Config” folder open up and edit “DefaultGame.ini”
Add the following line of code (presuming it doesnt exist, if it does modify it to match)

[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=false

Save and close and reload your project.

Now on the player(s) pawns you wish to detect (probably on the base class if you create child classes!)

Add in an AIPerceptionStimuliSource and click on it to select it once added

Untitled

Then in the details panel on the right find the AI Perception section and:

  1. Auto Register as Source is ticked (wont work without it!)
  2. Add in your Senses using the + next to “Register as Source for Senses” (I Chose only sight for now)

Untitled1

Now when i run no matter how many actors are in the cone angle, only players with this component attached are sensed. Tho other actors can block the view which i guess is realistic, I have a last known position setting so they still wander towards there. You can also set a radius from the last known position also that it can see around.

Mine is working nicely and last checked with 300 Zombies running… erm creeping around!

On a side note maybe this option should be in the project settings, even if it does require a reboot, a simple tick box with a message saying restart the editor would be much more helpful!

And it appears from early 4.xx days the enemy/neutral/friendly assignment in blueprints has never been available, only in c++. Surely this by now could have/ should have been implemented?

tested with nearly 500 Zombies and still works!

1 Like