x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Add AI Perception Component Node

I have an AI character and initially I had added the AI Perception component on the character. But that didn't work in the built version of the game. So I have the "Add AI Perception Component" node on Event Begin Play. And that actually works when I build the game. Although I have run into another problem. I noticed that the "detection by affiliation" option in the BP node is empty. And my AI character cannot sense the player character.

How do I go about adding the detection by affiliation options in the Blueprint Node?

Product Version: UE 4.18
Tags:
more ▼

asked Jan 25 '18 at 03:23 PM in Blueprint Scripting

avatar image

Abeysaurus
139 12 21 27

avatar image Jin_VE Jan 25 '18 at 06:39 PM

I don't have a problem with the perception component. When you say "built", do you mean packaged in "shipping" mode? How does it not work?

avatar image Abeysaurus Jan 25 '18 at 06:55 PM

Sorry, yeah I mean packaging the game. I tried both shipping and development. I noticed in shipping the AI character never responded to the Player. So I packaged in development mode, turned on the AI debug and I can see that the sight and sound configs reset to it's default settings. It works fine in PIE

alt text alt text

pie.jpg (71.5 kB)
devbuild.png (1.5 MB)
(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hmm... It actually gets larger in the packaged version. I've seen Mieszko say that the affiliation feature was not working properly but that was a while ago. I avoid that feature at the moment. I turn on all affiliations and filter out friendlies when the perception event fires (using my own affiliation enum).

One other thought: is the perception component in the AI controller? I've heard that putting it in the character can be problematic.

more ▼

answered Jan 25 '18 at 07:26 PM

avatar image

Jin_VE
4.3k 31 77 40

avatar image Abeysaurus Jan 25 '18 at 07:36 PM

It's actually not getting larger in the package version.. it's just resetting to default. So this is what I figured out so far:

When packaged, the AI Perception Comp resets all it's sense configs to default. Which in turn resets the affiliation to just "Detect Enemies" hence making the player undetectable. I have no idea why it's resetting though. So I tried adding the AI Perception Comp in runtime using the "Add AI Perception Component" blueprint node... set the sense configs as I want. Now when I package that version, It actually retains the correct sense configs. But the issue I have with the 2nd method is, I cannot set the affiliations in the blueprint node. Looks like those options are just not available.

And yes, it's in the AIController. I even tried it on my AICharacter and everything works fine while testing in the editor. It's just all broken when packaged

alt text

capture.jpg (27.0 kB)
avatar image Jin_VE Jan 25 '18 at 08:12 PM

I can confirm that the affiliation settings are missing. This should be submitted as a bug. Don't count on it getting fixed though.

VENT

In many ways, the AI system is far from acceptable IMO. And it's been languishing for years. Lots of issues and unfinished features, complicated customization, and an almost complete lack of support make for a difficult development effort. And if it was actually functioning perfectly, the entire system would be antiquated at best. I mean, they're serializing variables just to pass them between modules.

I have an open question but it seems like only the most basic questions get support from Epic staff -- who are pretty much the only ones who know more than me about it.

END-VENT

As far as the component resetting, I don't know. I have no issues with that so perhaps it's something you're doing somewhere else?

avatar image Abeysaurus Jan 25 '18 at 08:45 PM

Yeah I think it is a bug on the BP node. I'm still blank on why the normal method just keeps resetting. Maybe there is someway I have to "initialise" it or something.

I've seen MieszkoZ respond on here and from what I saw, it was more like "don't count on it, deal with it". I'm new to AI in general, and previously used the PawnSensing component. Maybe I should just try building an AI using that system.

Btw, are you doing all the AI Perception in C++? I've set up my whole system in blueprints only. Maybe that might be a catch?

avatar image Jin_VE Jan 25 '18 at 09:21 PM

All my perception stuff is in blueprints. EQS is where I need C++.

avatar image Abeysaurus Jan 26 '18 at 08:42 AM

Ah right... EQS is still experimental isn't it?

avatar image Jin_VE Jan 25 '18 at 08:40 PM

Did you try what I was saying? Turn on all affiliations and filter out friendlies in the blueprint?

And I'm confused by you saying that the packaged game doesn't have a larger detection radius. It looks obviously larger to me.

avatar image Abeysaurus Jan 25 '18 at 08:55 PM

Ah it looks bigger because it's defaulting to it's radius of 3000 and view angle of 90 (and default affiliations). The settings I have set in the editor are like around 1200 and angle of 60. I have all affiliations set to true... and It works perfectly fine playing in editor.

btw i did submit the BP node bug too

avatar image Jin_VE Jan 25 '18 at 09:18 PM

Found this (4.16.2) https://answers.unrealengine.com/questions/703327/aiperception-add-problem.html?sort=oldest

I guess they have him working on everything except the functionality we get. He's a cool guy and obviously capable. Why this system is such a mess, I don't know. I suspect it's Epic deciding what is more profitable. And based on current trends, I suspect developers like us will become even less significant in their decisions.

It would be nice, though if Mieszko could answer more advanced questions seeing as he's the only one who knows what the heck it's doing in there. I was trying to expand the EQS system so I could get an actor and a vector for each test point. I got pretty far in the customization but I got stuck because there's this serialization weirdness going on. Seems pointless and cumbersome to me but it's definitely not clear how to customize it. That's normally where docs and support would come in.

Can you run the packaged game in the debugger and figure out where it's going wrong? If you build for DebugGame, you can attach VS to the process and see.

avatar image Abeysaurus Jan 26 '18 at 01:21 PM

Yeah EQS seems kind of new and still WIP. I haven't touched EQS yet, I just have a predefined waypoint system for each AI character. Works for the kind of game i'm working on for now

avatar image Jin_VE Jan 25 '18 at 10:25 PM

Hey, I tested my project for your issue. I don't see it. In my packaged build, my ranges are right and the enemies react to me.

If you can't figure it out, I'd be happy to take a look at your project if you're comfortable sharing it. If so, go to the forum and DM me with a link. I have the same username on the forum. Or maybe you can reproduce it in a sample project and share it here.

avatar image Abeysaurus Jan 26 '18 at 08:00 AM

Yeah cool I’ll send you a zip of the project later tonight. I did try and simply add an AI Perception comp on the UE4 mannequin in the 4.19 preview and it pretty much did the same thing. I’ll let you have a look at my project and see if you can make any sense out of it. Thanks!

avatar image Abeysaurus Jan 26 '18 at 10:52 AM

I sent a DM over the forums with a link to the zipped project.

avatar image Jin_VE Jan 26 '18 at 10:51 PM

Turns out it was nativization causing the issue. Turning that off allowed the AIPerception component to work properly. This could possibly be a bug.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question