Why does my AI not move?

Hello,

I’m sorry if this is a common question that gets posted here, but I’ve tried following a lot of tutorials and suggestions made by others and they have not worked for me. In my project I have a trigger set up to spawn enemies which I already have implemented, but they don’t want to immediately move to my player on spawn which is what I’m attempting to do.

My Nav mesh is already set up, I’ve created a controller for the AI, and set up a behavior tree for them which I have posted images of my blueprints below. I replicated these blueprints from a colleague and have seen them work in his project. What I also don’t understand is that before I replicated these blueprints and put them into my project, just doing a simple move to actor to get the enemy to follow my character would not work. Hitting “P” also does not work unless I select the floor.

What’s causing my enemies to not follow my player?

alt text

Have you tried any of AI debugging tools we have, namely Gameplay Debugger (look at AI and press '-key), BT debugger (have BT asset opened then PIE), Visual Log (summon UI by calling vislog console command, and press “record”)? Also, simplifying your setup would also help nailing down the cause of the bug (although I have a feeling there’s couple of things going wrong here), like removing the “is visible” condition from your BT.

Cheers,

–mieszko

I am still learning about AI too but this is what I noticed looking at your blueprints.

In your spider controller’s set enemy it looks like you’re unsetting the enemy “value as object” when there is a new enemy, it seems like you want to set it to be the new enemy unless the “Update My Black Board Key” function does that.

Also, I don’t see anywhere that sets ‘IsEnemyVisible’ in order to run the MoveTo task. I suppose this could also be in the “Update My Black Board Key” function.

Another issue could be setting the enemy after running the behavior tree. I’ve run into issue where setting certain values after starting the tree will cause it not to work, especially if the enemy can see you right when the game starts.

I did not know how to access these tools, thanks for showing me these. I just picked up UE4 a few weeks ago for a project so I’m still trying to get the hang of it.
I got a few interesting results out of looking at these tools. It doesn’t look like my controller is running as the visual log shows the pawn to be none in AI controller. Even the task comes back as none in the gameplay debugger.

Thanks for the reply.

I actually don’t have a need for “IsEnemyVisible”, so I deleted it. The perception is within the function. I’m not even sure if I really need a perception component as well.

All I’m trying to do is get them to move and follow my character, but even when I tried just a simple move to, they didn’t want to move either.

Pawn is always “None” in the first frame of AIController’s log, that’s normal :slight_smile:

If you sent me a saved vislog file I could have a look and see what it says about failing to move.

Also, a quick glance at the gameplay debugger shot tells me spiders don’t see the player. I suggest going to spider perception’s sight config and flicking on seeing all “affiliations”, meaning not only enemies but friendlies and neutral as well. It’s a known bug in perception system that it doesn’t handle that properly currently.

Oh, and having a fallback behavior in your tree, that will get hit when nothing else is valid, like a “Wait” task at the end of the tree, is always a good idea, especially for debugging purposes. Currently by looking at gameplay debugger shot it’s hard to tell whether the BT has been stopped or just haven’t found any valid tasks.

Ah I see. I’ve put the vislog file in my google drive since I can’t attach it here, the link for it is below. I appreciate you taking a look at it for me.

https://drive.google.com/file/d/0B3Hk6cMY-osbZmp6N0c2aE04bDg/view?usp=sharing

That’s what I thought the problem was originally, and I checked to make sure that I was using the right nodes so that they can see the player, but it looked fine based off of the tutorials. I followed both of your suggestions and they still remain idle.

I’ve looked at the log and all it says is that it doesn’t run the move task because it’s restricted by the blackboard-based condition. I suggest getting rid of it, at least for debugging purposes. Also, note that “Player” key in blackboard is not set, and you need to make sure it is before trying to sent AI to “player’s location”.

Yeah, but that’s just blackboard setup. You need to feed it with data. For example implement a simple BT service in BP that would just get first player (there’s a BP function for it) and set the Player key in BB.

I’m not sure if it’s correct, but this is how I have my blackboard set up for “Player”.