Motion Matching (GASP) - PSD Indexing Cancellation Issues

Hello all,

I’m having an issue implementing the Game Animation Sample project’s Motion Matching system into my own project and was curious if anyone else had come across the same issue.

Context

I have duplicated the animation Motion Matching system from the Game Animation Sample project (GASP) as an exercise in learning Unreal, and have succeeded almost entirely, except for one issue.

But, for some reason, the Pose Search plugin decides to cancel the caching/indexing of the following databases upon project load:

LogPoseSearch: PSD_Sparse_Stand_Walk_Stops Cancelled
LogPoseSearch: PSD_Dense_Stand_Walk_SpinTransition Cancelled
LogPoseSearch: PSD_Dense_Stand_Walk_Lands_Heavy Cancelled
LogPoseSearch: PSD_Dense_Stand_Walk_FromTraversal Cancelled
LogPoseSearch: PSD_Dense_Stand_Run_SpinTransition Cancelled
LogPoseSearch: PSD_Dense_Stand_Run_Lands_Heavy Cancelled
LogPoseSearch: PSD_Dense_Stand_Idle_Lands_Heavy Cancelled
LogPoseSearch: PSD_Dense_Jumps_FromTraversal Cancelled
LogPoseSearch: PSD_Dense_Jumps_Far Cancelled
LogPoseSearch: PSD_Dense_Stand_Walk_Stops Cancelled

This may seem wrong, but the GASP itself actually does this as well. So maybe it is working as intended, as the GASP seems to take this into account and actually caches/indexes those PSDs as soon as you simulate/PIE the game, as we can see from this log:

LogWorld: Bringing World /Game/Levels/UEDPIE_0_DefaultLevel.DefaultLevel up for play (max tick rate 0) at 2024.10.20-12.21.05
LogWorld: Bringing up level for play took: 0.004554
LogOnline: OSS: Created online subsystem instance for: :Context_11
LogPoseSearch: PSD_Dense_Jumps_Far BeginCache
LogPoseSearch: PSD_Dense_Jumps_Far BuildIndex From Cache
LogPoseSearch: PSD_Dense_Jumps_FromTraversal BeginCache
LogPoseSearch: PSD_Dense_Jumps_FromTraversal BuildIndex From Cache
LogPoseSearch: PSD_Dense_Stand_Idle_Lands_Heavy BeginCache
LogPoseSearch: PSD_Dense_Stand_Idle_Lands_Heavy BuildIndex From Cache
LogPoseSearch: PSD_Dense_Stand_Run_Lands_Heavy BeginCache
LogPoseSearch: PSD_Dense_Stand_Run_Lands_Heavy BuildIndex From Cache
LogPoseSearch: PSD_Dense_Stand_Run_SpinTransition BeginCache
LogPoseSearch: PSD_Dense_Stand_Run_SpinTransition BuildIndex From Cache
LogPoseSearch: PSD_Dense_Stand_Walk_FromTraversal BeginCache
LogPoseSearch: PSD_Dense_Stand_Walk_FromTraversal BuildIndex From Cache
LogPoseSearch: PSD_Dense_Stand_Walk_Lands_Heavy BeginCache
LogPoseSearch: PSD_Dense_Stand_Walk_Lands_Heavy BuildIndex From Cache
LogPoseSearch: PSD_Dense_Stand_Walk_SpinTransition BeginCache
LogPoseSearch: PSD_Dense_Stand_Walk_SpinTransition BuildIndex From Cache
LogPoseSearch: PSD_Dense_Stand_Walk_Stops BeginCache
LogPoseSearch: PSD_Dense_Stand_Walk_Stops BuildIndex From Cache
LogPoseSearch: PSD_Sparse_Stand_Walk_Stops BeginCache
LogPoseSearch: PSD_Sparse_Stand_Walk_Stops BuildIndex From Cache
PIE: Server logged in

My Issue

Unlike in the GASP, issues arise in my project when I simulate/PIE the game.

My project doesn’t index those PSDs like the GASP does when I begin simulating the game. This causes the game to freeze and hang for a second when the Motion Matching node needs to pick from those databases (particularly when accessing the PSD_Dense_Jumps_Far and PSD_Dense_Stand_Run_Lands_Heavy when jumping from a height).

I think this freezing is due to the Pose Search plugin attempting to quickly load, cache, and/or index the PSD on the fly, when the Motion Matching node says it needs it. However, Pose Search can’t complete this process quickly enough and so Motion Matching goes on without the needed animation and database.

To support my speculation, PoseSearch and the PIE client throw warnings and errors out, as the Motion Matching node tries to access the database and animation within but is met with a None value from the variables.

PSD Access Error

PSD Access Error Log Text

Here’s the same log from the image above, but just in text format.

LogPoseSearch: c4bbc71892d798f87a5be81d143b484bd3777c21 - PSD_Dense_Jumps_Far BeginCache
LogPoseSearch: c4bbc71892d798f87a5be81d143b484bd3777c21 - PSD_Dense_Jumps_Far BuildIndex From Cache
LogPoseSearch: 34dd208d3ca2c8d8eb63ac74c98d26469ab2a519 - PSD_Dense_Stand_Run_Lands_Heavy BeginCache
LogPoseSearch: Warning: UPoseSearchLibrary::UpdateMotionMatchingState invalid search result : ForceInterrupt [true], CanAdvance [true], Indexing [truefalse], Databases [PSD_Dense_Stand_Run_Lands_Heavy] 
LogScript: Warning: Accessed None trying to read property CurrentSelectedDatabase
    ABP_MM_Base_C /Game/ThirdPerson/Maps/UEDPIE_0_ThirdPersonMap.ThirdPersonMap:PersistentLevel.CBP_MM_Base_C_0.CharacterMesh0.ABP_MM_Base_C_0
    Function /Game/Blueprints/ABP_MM_Base.ABP_MM_Base_C:ExecuteUbergraph_ABP_MM_Base:0AED
LogPoseSearch: 34dd208d3ca2c8d8eb63ac74c98d26469ab2a519 - PSD_Dense_Stand_Run_Lands_Heavy BuildIndex From Cache
PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property CurrentSelectedDatabase". Node:  Steering Graph:  AnimationBlendStackGraph_0 Function:  Execute Ubergraph ABP MM Base Blueprint:  ABP_MM_Base
LogScript: Warning: Accessed None
    ABP_MM_Base_C /Game/ThirdPerson/Maps/UEDPIE_0_ThirdPersonMap.ThirdPersonMap:PersistentLevel.CBP_MM_Base_C_0.CharacterMesh0.ABP_MM_Base_C_0
    Function /Game/Blueprints/ABP_MM_Base.ABP_MM_Base_C:ExecuteUbergraph_ABP_MM_Base:0ACE
PIE: Error: Blueprint Runtime Error: "Accessed None". Node:  Steering Graph:  AnimationBlendStackGraph_0 Function:  Execute Ubergraph ABP MM Base Blueprint:  ABP_MM_Base
LogScript: Warning: Accessed None trying to read property CurrentSelectedDatabase
    ABP_MM_Base_C /Game/ThirdPerson/Maps/UEDPIE_0_ThirdPersonMap.ThirdPersonMap:PersistentLevel.CBP_MM_Base_C_0.CharacterMesh0.ABP_MM_Base_C_0
    Function /Game/Blueprints/ABP_MM_Base.ABP_MM_Base_C:ExecuteUbergraph_ABP_MM_Base:00F7
PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property CurrentSelectedDatabase". Node:  Steering Graph:  AnimationBlendStackGraph_0 Function:  Execute Ubergraph ABP MM Base Blueprint:  ABP_MM_Base
LogScript: Warning: Accessed None
    ABP_MM_Base_C /Game/ThirdPerson/Maps/UEDPIE_0_ThirdPersonMap.ThirdPersonMap:PersistentLevel.CBP_MM_Base_C_0.CharacterMesh0.ABP_MM_Base_C_0
    Function /Game/Blueprints/ABP_MM_Base.ABP_MM_Base_C:ExecuteUbergraph_ABP_MM_Base:00D8
PIE: Error: Blueprint Runtime Error: "Accessed None". Node:  Steering Graph:  AnimationBlendStackGraph_0 Function:  Execute Ubergraph ABP MM Base Blueprint:  ABP_MM_Base
LogScript: Warning: Accessed None trying to read property CurrentSelectedDatabase
    ABP_MM_Base_C /Game/ThirdPerson/Maps/UEDPIE_0_ThirdPersonMap.ThirdPersonMap:PersistentLevel.CBP_MM_Base_C_0.CharacterMesh0.ABP_MM_Base_C_0
    Function /Game/Blueprints/ABP_MM_Base.ABP_MM_Base_C:ExecuteUbergraph_ABP_MM_Base:0818
PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property CurrentSelectedDatabase". Node:  Steering Graph:  AnimationBlendStackGraph_0 Function:  Execute Ubergraph ABP MM Base Blueprint:  ABP_MM_Base
LogScript: Warning: Accessed None
    ABP_MM_Base_C /Game/ThirdPerson/Maps/UEDPIE_0_ThirdPersonMap.ThirdPersonMap:PersistentLevel.CBP_MM_Base_C_0.CharacterMesh0.ABP_MM_Base_C_0
    Function /Game/Blueprints/ABP_MM_Base.ABP_MM_Base_C:ExecuteUbergraph_ABP_MM_Base:07F9
PIE: Error: Blueprint Runtime Error: "Accessed None". Node:  Steering Graph:  AnimationBlendStackGraph_0 Function:  Execute Ubergraph ABP MM Base Blueprint:  ABP_MM_Base

Invalid Search Result … Indexing [truefalse]

Another thing that I found weird was the following line:

Warning: UPoseSearchLibrary::UpdateMotionMatchingState invalid search result : ForceInterrupt [true], CanAdvance [true], Indexing [truefalse], Databases [PSD_Dense_Stand_Run_Lands_Heavy]

That Indexing [truefalse] throws up alarm bells in my head, as it’s indicating it should be a boolean based on the value, but is for some reason it is being populated with both.

Maybe it’s a bug? I wasn’t sure, so I went to the plugin’s source code just to figure out where it was. This was the path in my UE5.4.4 install: "C:\Program Files\Epic Games\UE_5.4\Engine\Plugins\Animation\PoseSearch\Source\Runtime\Private\PoseSearchLibrary.cpp"

#if !NO_LOGGING
		if (!SearchResult.IsValid())
		{
			TStringBuilder<1024> StringBuilder;
			StringBuilder << "UPoseSearchLibrary::UpdateMotionMatchingState invalid search result : ForceInterrupt [";
			StringBuilder << bForceInterrupt;
			StringBuilder << "], CanAdvance [";
			StringBuilder << bCanAdvance;
			StringBuilder << "], Indexing [";

#if WITH_EDITOR
			StringBuilder << SearchContext.IsAsyncBuildIndexInProgress();
//#else // WITH_EDITOR
			StringBuilder << false;
#endif // WITH_EDITOR

			StringBuilder << "], Databases [";

			for (int32 DatabaseIndex = 0; DatabaseIndex < Databases.Num(); ++DatabaseIndex)
			{
				StringBuilder << GetNameSafe(Databases[DatabaseIndex]);
				if (DatabaseIndex != Databases.Num() - 1)
				{
					StringBuilder << ", ";
				}
			}
			
			StringBuilder << "] ";

			FString String = StringBuilder.ToString();
			UE_LOG(LogPoseSearch, Warning, TEXT("%s"), *String);
		}
#endif // !NO_LOGGING

Anyways, this is all I have been able to find out about this issue. If anyone else has encountered the same thing, I hope this information helps, and if you’ve found a solution to it, than any and all tips would be greatly appreciated!

Hi all, I’ve found a somewhat hacky solution to my issue.

Pseudo-Solution

Inside of the Update_MotionMatching method, I’ve opted to add an if statement that appends the “issue PSDs” to the chosen PSDs derived from the Chooser Tables. This happens only on animation BP start and doesn’t run again.

Hey, where did you get (or fill) the “Pose Search Databases to Force Index” node from?

I am having the same issue as you.

I found some Blueprints in the Level Blueprint of the Example Level Blueprint. You might need to add it to your level. It clearly says that it is there to rebuild it in order to stop stuttering later on:

Hope that helps

1 Like

Hello!

The databases shown in the “Pose Search Databases to Force Index” variable were the ones that were causing me issues. Specifically, when the Unreal Editor would boot up after restarting, those 10 databases shown in that variable popped up as being “Cancelled” by the Pose Search component in the Output Log window.

I’ve actually recently adopted a different way of making sure the databases get ‘pre-indexed’, and that’s by adding the issue-databases to the Pose Search Normalization Set.

Yes, this did it!

I never would have thought to look there :sweat_smile: