Description

Context

GameplayDebugger (Press ` in-game) displays a green smiley (AICON-Green) for AIControlled pawns that are running a BehaviorTree and a red angry face (AICON-Red) otherwise. If the AIController is null, it defaults to the green smiley as that's the 'FailsafeIcon'. See FGameplayDebuggerCategory_AI::DrawPawnIcons:

 

const AAIController* ItAI = Cast<const AAIController>(ItPawn->GetController());FString DebugIconPath = IsValid(ItAI) ? ItAI->GetDebugIcon() : FailsafeIcon; 

Problem

In networked session on remote clients (NetMode == NM_Client), the AIController is never resolvable. Remote clients thus cannot check via the AIController whether a behavior tree is running or not. Defaulting to the green icon gives a false positive: it implies a behavior tree is running while that is not known on clients.

It would be nice to:

  • Accurately display AI BT state on remote clients. This would be useful for debugging when play testing on dedicated servers.*
  • Show a different icon when AI BT state is not known, rather then defaulting to green.

*This info can already be derived for the active DebugActor since we already replicate extra debug info for it, but not for all pawns.

 

Steps to Reproduce

In ThirdPersonTemplate:

  • Place 3 characters in the map
  • Start PIE with Net Mode > Play As Client
  • Press ' (backwards apos) to enable the GameplayDebugger
  • Observe: All characters show the green AI icon
  • Expected: They're not running BTs, so they shouldn't display green icons.
    (Compare to NetMode: Standalone and Listen Server)
Callstack

Not a crash, but callstack to the relevant code:

>    UnrealEditor-AIModule.dll!FGameplayDebuggerCategory_AI::DrawPawnIcons(UWorld * World, AActor * DebugActor, APawn * SkipPawn, FGameplayDebuggerCanvasContext & CanvasContext) Line 519    C++
     UnrealEditor-AIModule.dll!FGameplayDebuggerCategory_AI::DrawData(APlayerController * OwnerPC, FGameplayDebuggerCanvasContext & CanvasContext) Line 323    C++
     UnrealEditor-GameplayDebugger.dll!FGameplayDebuggerCategory::DrawCategory(APlayerController * OwnerPC, FGameplayDebuggerCanvasContext & CanvasContext) Line 115    C++
     UnrealEditor-GameplayDebugger.dll!UGameplayDebuggerLocalController::OnDebugDraw(UCanvas * Canvas, APlayerController * PC) Line 261    C++
     [Inline Frame] UnrealEditor-GameplayDebugger.dll!Invoke(void(UGameplayDebuggerLocalController::*)(UCanvas *, APlayerController *)) Line 66    C++
     [Inline Frame] UnrealEditor-GameplayDebugger.dll!UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int>>::ApplyAfter(void(UGameplayDebuggerLocalController::*)(UCanvas *, APlayerController *) &) Line 310    C++
     UnrealEditor-GameplayDebugger.dll!TBaseUObjectMethodDelegateInstance<0,UGameplayDebuggerLocalController,void __cdecl(UCanvas *,APlayerController *),FDefaultDelegateUserPolicy>::ExecuteIfSafe(UCanvas * <Params_0>, APlayerController * <Params_1>) Line 667    C++
     [Inline Frame] UnrealEditor-Engine.dll!TMulticastDelegateBase<FDefaultDelegateUserPolicy>::Broadcast(UCanvas *) Line 254    C++
     [Inline Frame] UnrealEditor-Engine.dll!TMulticastDelegate<void __cdecl(UCanvas *,APlayerController *),FDefaultDelegateUserPolicy>::Broadcast(UCanvas *) Line 956    C++
     UnrealEditor-Engine.dll!UDebugDrawService::Draw(const FEngineShowFlags Flags, UCanvas * Canvas) Line 93    C++
     UnrealEditor-Engine.dll!UDebugDrawService::Draw(const FEngineShowFlags Flags, FViewport * Viewport, FSceneView * View, FCanvas * Canvas, UCanvas * CanvasObject) Line 76    C++
     UnrealEditor-Engine.dll!UGameViewportClient::Draw(FViewport * InViewport, FCanvas * SceneCanvas) Line 1954    C++
     UnrealEditor-Engine.dll!FViewport::Draw(bool bShouldPresent) Line 1751    C++
     UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 2293    C++
     UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 550    C++
     UnrealEditor.exe!FEngineLoop::Tick() Line 5789    C++
     [Inline Frame] UnrealEditor.exe!EngineTick() Line 61    C++
     UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 180    C++
     UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 247    C++
     UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 298    C++
     [External Code]    

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-209550 in the post.

0
Login to Vote

Unresolved
ComponentUE - AI - Debugging
Affects Versions5.15.25.3
Target Fix5.5
CreatedMar 12, 2024
UpdatedMar 15, 2024