For my project I have been building ontop of ShooterGame since 4.1 and currently have updated all of my code to work with 4.6.1
Recently I have implemented bots by way of a blueprint behavior tree, nav mesh and target point nodes spread out across the level that serve as waypoints for the bots to make their way around the map.
Everything works fine in the course of a round until the round ends and the level restarts. I find that when the map reloads after server travel all of the bots no longer have their TeamNum set and are considered by my code to be ‘spectators’ (TeamNum == -1). As a quick hack to try to fix this I iterated through all AIControllers in GameMode’s InitGame() and simply set ShooterPlayerState’s TeamNum manually to a teamNum. Doing this immediately causes the game to crash, the notable section here:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000
UE4Editor-Navmesh.dll!UnknownFunction (0x000007feee296992) + 0 bytes [UnknownFile:0]
UE4Editor-Navmesh.dll!UnknownFunction (0x000007feee28a353) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea6aa7b5) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea6aa07e) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8afdc20) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8ab8ec4) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8ab3313) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8ab1de0) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8aee61b) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8af802d) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8aabea8) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8aad1b8) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8afcd4c) + 0 bytes [UnknownFile:0]
UE4Editor-AIModule.dll!UnknownFunction (0x000007fee8b269a1) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007fee9dcd423) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007fee9df13bc) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea500e86) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea508410) + 0 bytes [UnknownFile:0]
UE4Editor-Core.dll!UnknownFunction (0x000007feec7ce483) + 0 bytes [UnknownFile:0]
UE4Editor-Core.dll!UnknownFunction (0x000007feec7ce67d) + 0 bytes [UnknownFile:0]
UE4Editor-Core.dll!UnknownFunction (0x000007feec7edc75) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea53c7c5) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea527ad0) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea52a337) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea1e57e6) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea1eca43) + 0 bytes [UnknownFile:0]
UE4Editor-Engine.dll!UnknownFunction (0x000007feea033ce3) + 0 bytes [UnknownFile:0]
UE4Editor.exe!FEngineLoop::Tick() (0x000000013fb4cd94) + 0 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\launchengineloop.cpp:2214]
UE4Editor.exe!GuardedMain() (0x000000013fb4089f) + 0 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\launch.cpp:131]
UE4Editor.exe!GuardedMainWrapper() (0x000000013fb4090a) + 5 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor.exe!WinMain() (0x000000013fb4e3d9) + 17 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor.exe!__tmainCRTStartup() (0x000000013fb4f319) + 21 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]
kernel32.dll!UnknownFunction (0x00000000778859ed) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x0000000077abc541) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x0000000077abc541) + 0 bytes [UnknownFile:0]
I’ve attached the crash log and dump to this post.
I have found that this crash does not occur if I clear the BehaviorTree from the ‘Bot Behavior’ of my BotPawn. This leads me to believe that the issue is somehow related to the NavMesh/AI code.
My solution for now is to just delete any bots/AIControllers from the game in GameMode’s InitGame() and re-add them manually until this crash can be fixed. But note, even removing and then re-adding the bots within InitGame() triggers this crash too. So I believe this has nothing to do with TeamNum and more about triggering bot behavior at a fragile point.
Please let me know if there is anything else I can provide