Download

Enemy AI Not Moving to Player or Around Map

I am writing a game for my 2 friends as a wedding gift. This is a simple ARPG, 1 level with enemies. I am constructing the enemy AI and cannot seem to get my enemies to move despite using a random navigatable point and pawn sensing, the enemies just idle when I start the game. I have a navmesh setup. Any help with this is appreciated!

Make sure your Enemy being controlled by an AI Controller.
Also, if that’s already the case, can you print out what value is being returned from “AI Move To” by connecting its unlabeled output exec node to a new “Print String” Node and connecting the “Movement Result” output to that?

1 Like

The attached images show my AI Enemies details as well as how I setup the print string node and what came through the test when I ran the game. Only when the pawn saw me did I get the Sensing Player and Aborted Logs. If you want I can do the random navigation print string test, to see if that is being aborted as well. Thanks so much for the help on this by the way!

Thanks for replying

After looking in the source code, it looks like there is always a log printed in the Output Log after an AI movement was aborted. Can you see if anything interesting is there (in the Output Log) after the move is aborted?

Heres a copy of the output log:

PIE: Server logged in
PIE: Play in editor total start time 0.841 seconds.
LogBlueprintUserMessages: [Enemy_Spider_3] Sensing Player
LogBlueprintUserMessages: [Enemy_Spider_3] Success
LogBlueprintUserMessages: [Enemy_Spider_3] Sensing Player
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Sensing Player
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Sensing Player
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Sensing Player
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Sensing Player
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Sensing Player
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Sensing Player
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Sensing Player
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogBlueprintUserMessages: [Enemy_Spider_3] Aborted
LogSlate: Updating window title bar state: overlay mode, drag disabled, window buttons hidden, title bar hidden
LogWorld: BeginTearingDown for /Game/UEDPIE_0_Level1
LogWorld: UWorld::CleanupWorld for Level1, bSessionEnded=true, bCleanupResources=true
LogSlate: InvalidateAllWidgets triggered. All widgets were invalidated
LogPlayLevel: Display: Shutting down PIE online subsystems
LogSlate: InvalidateAllWidgets triggered. All widgets were invalidated
LogSlate: Updating window title bar state: overlay mode, drag disabled, window buttons hidden, title bar hidden
LogAISub: UAISubsystem::~UAISubsystem AIPerceptionSystem (00000185BFFD2E80), frame # 38719
LogAISub: UAISubsystem::~UAISubsystem EnvQueryManager (000001860719FE00), frame # 38719
LogUObjectHash: Compacting FUObjectHashTables data took 2.16ms
LogPlayLevel: Display: Destroying online subsystem :Context_12

It seems to be an issue with the AI move to node…

This is a shot of the spiders flow before he senses me.

Nothing interesting in the logs :face_with_monocle:

If you press the " ’ " apostrophe key while in the game, the “AI Debugger” gets brought up. (You can read about it here AI Debugging | Unreal Engine Documentation). It looks like if you press 0 it will show the navigable areas for your AI. Maybe this will reveal something?

Here’s some more suggestions:

PlayerCollision

Going to follow up with this but check out the enemy naviagatable area! it looks to be below the floor of the map…

Yeah, you still should make sure your collision isn’t messed up, but can you first confirm that the Navmesh Bounds Volume is tall enough?

Yep, here is the nav mesh bounds in the level if I just hit “P”

Looks like your spider is just barely out of the navigable reason! :laughing:

Driving me nuts! Another issue could be that there is another layer of navigatable area below whats in the last image (lower in the level) so could that be throwing off my get random navigatiable point node?

So, if you just move the spider a little, it will work, right?

Moving the enemy spider does not change the difference in its naviagtable area and the navmesh. I am gonna review your links to see if there is something there.

you can try first on a simple plane to more easily rule out the problem


using the template map floor

second, don’t be offended but that code looks horrible :sweat_smile:
Try to simply move it in the begin play

@DomusLudus no offense, I have no formal training, this is all youtube! Also could you be more descriptive with your suggestion? Do you mean start a new level with the template floor and a navmesh and drop the AI Enemy in to QA the issue? Im pretty new to UE4 and need all the direction I can get! (Thanks)

yes just that. start with the roam part.

Other think
image
I am prety sure that the output results are immediate and do not refer to having reached the destination, but to checking that there is a path in the navh mesh to get there.
I may have the problem there, So you may be stopping the movement every time it starts

@DomusLudus @NachoMonkey2 Tested the Enemy Spider in a temp level with a simple navmesh and its moving to the random reachable locations! What would you suggest I test next? I dropped the AI back into the current level, deleted the old navmesh and put a new smaller navmesh around the enemy. It didnt move. Not sure where to go from here. Be happy to jump on a video call to work this issue out if anyones game?