Quick AI Perception Jumpstart

So I know that there are a couple of people who will be doing more in depth tutorials in the next few weeks but until then I thought I would share how to do a simple setup to get the new AI Perception system up and running in Blueprint. Also if you want c++ follow this link: https://forums.unrealengine.com/showthread.php?66814-Quick-AI-Perception-Jumpstart-(C-)

(Note this is done in 4.7.5)

  1. So to start in the controller you want click Add Component and add an AIPerception Component
  2. Now setup your Sense (this will be what detects stuff) a)Add a new config with type AI Sight config (or whatever you want to use) b) Set the stuff for sight radius and angle (or hearing if your using that)
  3. Now under Events in the AIPerception Component hit add event. From there you can do stuff when your character detects stuff. The UpdatedActors array is an array of all Actors that it finds.
  4. So how does it find something? All you have to do is go into the actor or pawn or whatever and in the Begin Play add a Register Perception Stimuli Source node with the class being the type of sense you want to register (just do multiple nodes if you want to use multiple senses) and then set the target to self.

And that’s it, your done! If you AI can see anything registered it should fire the event and you can do stuff accordingly. Let me know if this was helpful or if you have any questions!

Edit: So idk if this will affect everyone but if your having a lot of crashes check this post out: https://answers.unrealengine.com/questions/213839/ai-perception-register-source-issue.html

Thanks,

-Chris

Hi Chris, I’ve just started working on the A.I. perception system and I have a doubt here. The ‘Register Perception Stimuli Source’ should be placed in the blueprint of the actor that needs to be detected by the A.I. right?

Yes thats correct. So in my case since I put it inside of my ai unit.

Thanks, I’ve got it working. But I think there are still some bugs with the perception component. I’m getting a lot of crashes when using it.

Awesome, yeah especially in the blueprint side of things. The c++ version is a bit more stable but even still it has bugs. I’m actually having quite a bit of trouble using my own setup haha. Just sort of comes with it being so new and unused I guess. If you find any kinds of bugs that are easily reproducible be sure to post it to answerhub so that MieszkoZ can find them easier.

I have done as described here: Added an AI perception component to the controller of the actor that should perceive others. Then I added a perecption stimuli component to the other actors that I want to perceive by the first actor. Then in the OnPerceptionUpdated event (in the perceiving actor controller, where the AI perception component is) I simply print out a string.

However, when I run the game and a perceivable actor (with stimuli component) enters the sight radius of the perceiver, then nothing happens, nothing is printed.

Any ideas what I might be missing?

I have tried to implement Ai Perception as above but everything in 2a in the above image is disabled. I have tried with a Pawn and Character blueprint class and in their respective controllers all to no avail.

Any advice would be most welcome.

Thank you.

Hi guys.

I am doing FPS AI at the moment which requires a possibility of 40-50 bots in one world.

I am extremely interested in this system. Currently I am doing my own visibility manager since the old AISensing isn’t giving me the performance I need.
I’d like to ask some things about this new system if you’re familiar enough with it.

  1. is it possible to customise the perception manager to it only sense from an array of units.
  2. Is it possible for AI to share certain awarenes ( such as visible enemies )? This is so that AI will ignore the process of these already detected stimuli.

I don’t know why but my “AI” section is grayed out for some reason i’m not able to set the hearing range or the sight radius. Why is this? I’m able to set the senses config stuff though

I found out the grey section automaticly updates if you update anything in teh sense section, there is a drop down beside the specific sense config

This is how I did (it works but I had to tick the check boxes in red), the upper and grayed out section never got available but it stills works!

This is exactly what my settings look like now and the AI section is grayed out. Checking those boxes makes no difference. Anyone know how to get it working?

you dont need the upper and grayed out section when you have the lower and specifics ones

I got sight and hearing to work, did you get touch to work, for some reason I can’t?

We wrote a tutorial about this : UE4 - AI Perception: Senses and stimuli source - Isara Tech.