Mass Representation - filter on Actor resolution type

Hello,

I am currently trying to use Mass to handle all NPCs in our project. We are aiming for >1000 NPCs, and we want to run at least some level of simulation on all of them when the player is far.

I used the Mass Representation system to spawn low resolution actors, which are run completely by mass processors; and high-resolution actors, which are just normal Actors, that run scripts, behaviors trees, etc… and just synchronize their data to/from mass fragments.

The issue I am facing right now is that I can’t easily filter on the current actor resolution. I have tried adding a tag, which gets added in a UMassRepresentationActorManagement subclass (which can be switched in Actor representation trait), however I didn’t find a good place to remove the tag without modifying the original plugin.

I know it is possible to add FMassRepresentationFragment to all processors and compare the CurrentRepresentation, however the processors that need to run on high-resolution actors will most likely need to run on game thread, so I am trying to minimize the work they need to do.

  1. Is it even a good idea to add the tag? Or is there some hidden cost related to
    1. adding/removing tags
    2. having a lot of different tags (thus increasing the number of entity archetypes)
    3. filtering on the tags
  2. Is there some callback/override that I missed where I could easily remove the tag?

There are some costs to adding/removing tags since the entities will need to migrate between archetypes. If new archetypes are being made, Mass will need to run its processor dependency solver again. Changing tags is supported and happens already for some representations such as using ISM and off LOD. Tags exist for the other LOD levels, but I do not believe they are referenced in other Mass plugins. Having more tags is not necessarily bad, but I would advise checking the Mass perf every so often to check if there are large archetype migrations or how often the dependency solver is being run. Filtering on tags is good. It is a pattern we use in Mass and one we want to always support.

I do not believe there is a callback to hook into for this. I would suggest adding the tag to the Mass entity config used on your High-Res actor. You can set additional tags, fragments, and traits to be run while that actor is used. It runs through the Mass Agent Subsystem, and I imagine you already have this on your spawned Actor class to enable things such as translators.

-James