PawnSensingComponent vs. AIPerceptionComponent

Hello,

I’ve started making an attempt to clean-up some of our AI code and get it more base-class friendly (e.g. works with AIController). However, we’ve been working on this project a while and all of our derived AIController code uses a PawnSensingComponent. It appears this Component was old UE4 and has been deprecated, but no deprecation markup has been added. It seems it’s superseded by AIPerceptionComponent, even to the point of having the same variable names but the one does not derive from the other.

It looks like AIPerceptionComponent is more flexible, but it looks like it may also be more efficient, and while I don’t understand all of it, it appears there’s some asynchronous/interval ticking going on. Can you elaborate on the difference between the two, and any benefits we could achieve by porting over our code? The documentation on these components are pretty sparse.

I’m hoping you can give us some guidance; are you planning on deprecating PawnSensingComponent? If so, can we request an equal implementation of AIPerceptionComponent? Ideally PawnSensingComponent would be an AIPerceptionComponent with AISense_Hearing and AISense_Sight, correct?

Hey Jodon,

PawnSensingComponent is indeed a legacy AI perception solution that we’re no longer developing, but we left it hanging around due to its simplicity and the fact that some people use it in their projects that don’t really need a proper AI perception solution offered via AIPerceptionComponent.

The “new” perception system has indeed been build for both flexibility and performance (as much as those two can be combined) and the best example of it is the Sight sense implementation and how it handles a big set of queries with a limited number of line-of-sight traces allowed per frame.

I’d say that’s the biggest difference between new AI perception and Pawn Sensing - the latter makes every AI do it’s sensing independently of one another, and that can end up being very costly, while the new Perception is in the business of batching stuff.

The way you use new perception, in short, is by adding AIPerceptionComponent to your AIControllers, and fill out its SensesConfig. Let me know if you run into issues with that.

Cheers,

–mieszko

Hi,

We think this post contains useful information which we would like to share with our public UE4 community. With your approval, we would like to make a copy of this post on the public AnswerHub which includes the discussion but strips out your username and company name. Please let us know if you are okay with this.

Thanks!

Yes, that’s fine by me. Cheers.