Recording state trees running in mass

Hi, I am currently experimenting with execution of state trees in mass. I am using MassAIBehaviors plugin’s solution as a starting point, as unfortunately we can’t use it (there is a hardcoded requirement of one statically defined StateTree per entity, which doesn’t suit our solution). It would be nice if some of the utility functions would be written in a more reusable way (for example the dependency extraction in UMassStateTreeSchema::Link and UMassStateTreeSubsystem::CreateProcessorForStateTree, it’s hardcoded to create a specific processor).

One thing I don’t understand is how UMassStateTreeActivationProcessor gets away with calling Start() on the tree, without ever declaring the dependencies. Did I miss something there? In my custom solution, I just move Start into the bespoke execution processor.

However, the main issue is debug. I haven’t found a way to use rewind debugger with mass entities (not surprising, since it is built around actors). I tried using the legacy debugger, but that seems to work unreliably - sometimes it doesn’t start recording and it can’t be viewed when the game is paused. Is there a non-obsolete way to view the recordings now?

[Attachment Removed]

I have some good news. You can use the Rewind Debugger to see the output for MassStateTree, but it requires an extra couple steps. You need to:

  1. Open Project Settings->Plugins->Rewind Debugger
  2. Expand the section for Selector Allowed Struct Types
  3. Add an entry for MassEntityHandle

Now you should see the entities as selectable in the Rewind Debugger which includes their StateTree tracks. Alternatively, you can use VisLog which captures ALL of them in one track but the logs should include which entity the line belongs to.

As for changing the StateTree asset for MassStateTree, I do not know of a solution we have done internally. We have added a method for SwapConstSharedFragment that might be able to assist with setting new StateTree assets. You would likely need to stop the current tree for the entity, swap the fragments to one with a new asset, and then remove the FMassStateTreeActivatedTag so the activation processor runs to start the tree. I have not tried it out myself, but I think something along this line would be what is needed. You could get by without the swap fragments, but it prevents two archetype migrations instead of only one.

-James

[Attachment Removed]