Download

Detour crowd crashes game after klling an bot

Hi!

I have a problem with the scif-game i’am working on. I’am using the detour crowd system for my ai pathfinding and it works fine until i kill on or more of the ai agents/bots. The edtior crashes with the following message:

Assertion failed: 0 && “Missing required implementation.” [File:F:\Games\Epic Games\UE_4.21\Engine\Source\Runtime\AIModule\Classes\Navigation/CrowdAgentInterface.h] [Line: 19]

UE4Editor_Core!FDebug::AssertFailed() [d:\build++ue4\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:417]
UE4Editor_UE4_MyGame!ICrowdAgentInterface::_getUObject() [f:\games\epic games\ue_4.21\engine\source\runtime\aimodule\classes
avigation\crowdagentinterface.h:19]
UE4Editor_AIModule!UCrowdManager::PostMovePointUpdate() [d:\build++ue4\sync\engine\source\runtime\aimodule\private
avigation\crowdmanager.cpp:1327]
UE4Editor_AIModule!UCrowdManager::Tick() [d:\build++ue4\sync\engine\source\runtime\aimodule\private
avigation\crowdmanager.cpp:267]
UE4Editor_NavigationSystem!UNavigationSystemV1::Tick() [d:\build++ue4\sync\engine\source\runtime
avigationsystem\private
avigationsystem.cpp:1017]
UE4Editor_Engine!UWorld::Tick() [d:\build++ue4\sync\engine\source\runtime\engine\private\leveltick.cpp:1412]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build++ue4\sync\engine\source\editor\unrealed\private\editorengine.cpp:1726]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build++ue4\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:403]
UE4Editor!FEngineLoop::Tick() [d:\build++ue4\sync\engine\source\runtime\launch\private\launchengineloop.cpp:3699]
UE4Editor!GuardedMain() [d:\build++ue4\sync\engine\source\runtime\launch\private\launch.cpp:174]
UE4Editor!GuardedMainWrapper() [d:\build++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:145]
UE4Editor!WinMain() [d:\build++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:276]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283]
kernel32
ntdll

The crash itself appears randomly. It could crash after the lifte time delay of a bot/agent is over or it’ crashs some seconds or minutes later. But it definitly crashes.

I have implemented the crowd system based on the original detour crowd implementation in ue4, so the constructor of my ai controller look like this:


AUE4_AIController::AUE4_AIController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))

I have also includes “Navigation/CrowdFollowingComponent.h” and “Navigation/CrowdManager.h”

Do i miss something? It looks like the crowd manager does not get informed that an agent was killed and crashes, when he tries to calculate a new path for a death agent. Or maybe he calculates a path for an living agent and does not take into account the death agent. Is such a case not implemented by default with the crowd interface? Do i have to inform the crowd manager manually in my destructor/on death function of my ai controller/pawn ?

Thank you,
Marc

Here are more infos:

I use ue4 v 4.2.1.2.

This is what i’am getting from the visual studio debugger:

In CrowdAgentInterface.h he throws an exception at Line 19: GENERATED_IINTERFACE_BODY()

Class CrowdAgentInterface.h:
class ICrowdAgentInterface
{
GENERATED_IINTERFACE_BODY() <-Line 19 Exception!

.
.
.
}

Class Casts.h:
template <typename From, typename To>
struct TCastImpl<From, To, ECastType::InterfaceToUObject>
{
.
.
.
UObject* Obj = Src->_getUObject(); <-Line 146
.
.
.
};

// Dynamically cast an object type-safely.
template <typename To, typename From>
FORCEINLINE To* Cast(From* Src)
{
return TCastImpl<From, To>::DoCast(Src); <-Line 193
}

Class CrowdManager.cpp
void UCrowdManager::PostMovePointUpdate()
{
.
.
.
UCrowdFollowingComponent* PathComp = Cast<UCrowdFollowingComponent>(It.Key); <-Line 1327
.
.
.
}

CrowdManager.cpp
void UCrowdManager::Tick(float DeltaTime)
{
.
.
.
PostMovePointUpdate(); <-Line 267
.
.
.
}

It’s solved. I have to unregister from the crowd manager manually.



UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(this);

        if (CrowdManager)
        {
            CrowdManager->UnregisterAgent(this);
        }