Hello !
I’m currently working on a project that uses Mass Entity. While investigating how we could use this new system, some questions popped-up.
Here’s the list of questions:
- Is their any plan to change the “virtuality” of the function that Handle the Entity creation for AgentComponents (UMassAgentSubsystem::HandlePendingInitialization) ?
- Is there a way to set the Payload/AuxData of the ExecutionContext of a Signal processor ?
- Would you recommend creating multiple spawners, one for each base archetype, to spawn our entities ?
- Is there a way to Add a template actor to the RepresentationSubsystem without synchronously loading it and not directly in an EntityConfig ?
- It seems that in some circumstances (Camera moving rapidly ?) an entity will pass into the OnMassAgentComponentEntityAssociated delegate even though the current actor hasn’t been deleted/unloaded. Is there a reason for that ? Is there a way to prevent this and to trigger it only when the Mass Agent is loaded after the previous one has been destroyed ?
[Attachment Removed]
Hello !
We have investigated a bit more Mass Entity and we wanted to have your opinion on our solution for our previous question on the RepresentationSubsystem and the template actor.
Our current idea is to have a preloading system that asynchronously load the Mesh/BP of our actor. Once it finishes, this system would update first the RepresentationSubsystem to add the loaded mesh/BP to the list of template actor. This would give us the index of the template in the list that we could give to the Visualization fragment of the entity through its entity handle and the entity manager.
We envision to either use a subsystem to start the async preloading, checking the distance from the player to the entities or to maybe use a Mass Processor to launch the preloading and the assignement of the mesh to the entity.
Is the preloading and the addition to the RepresentationSubsystem at a later time a solution to our initial question ? Which of the subsystem and Mass processor would you prioritize ?
[Attachment Removed]
I think your idea for async loading could work. It has been some time since we made MassRepresentation, and it was made specifically for what was needed in The Matrix Awakens demo. That said, there is not something I see in the code for why it should not work, but some systems may need some massaging to either take soft refs or other systems to load sync on demand if the system needs the BP or mesh before it has been loaded async.
As for the questions in your first post:
- Is their any plan to change the “virtuality” of the function that Handle the Entity creation for AgentComponents (UMassAgentSubsystem::HandlePendingInitialization) ?
- There are no plans for this currently. We try to avoid virtual as much as possible in Mass (I think the only virtual functions on Mass subsystems are the USubsystem virtual functions).
- Is there a way to set the Payload/AuxData of the ExecutionContext of a Signal processor ?
- No. There isn’t a way to send payloads with MassSignals. We have talked about adding some support for sending an InstancedStruct as a payload, but that has not resulted in any planned work. One main argument against adding payloads is that it quickly turns into a messaging system. Our normal workaround is using fragments as payloads where the needed data is stored in a fragment. Since you know what is subscribed to a signal, you can then know where the relevant data should be kept to process.
- Would you recommend creating multiple spawners, one for each base archetype, to spawn our entities ?
- It depends. Using one spawner per archetype is a fine pattern. If you want to re-use the locations for spawning entity counts/proportions, streaming behavior, etc., you would want to use the same spawner for the entity configs. Using separate spawners can also prevent some CDOs for the actor BPs from being loaded if the spawner was not in the active level/world yet.
- Is there a way to Add a template actor to the RepresentationSubsystem without synchronously loading it and not directly in an EntityConfig ?
- Not in the default implementation. It should be possible with some code massaging. You will need to create the other systems for when to begin loading it async as well.
- It seems that in some circumstances (Camera moving rapidly ?) an entity will pass into the OnMassAgentComponentEntityAssociated delegate even though the current actor hasn’t been deleted/unloaded. Is there a reason for that ? Is there a way to prevent this and to trigger it only when the Mass Agent is loaded after the previous one has been destroyed ?
- It is possible to happen as there is no guard on the delegate to prevent firing if a component already has an entity. The component should think that Mass has already assigned it a new entity and its old one is gone when it happens. Is there a specific issue/crash/bug that you are seeing from this behavior?
-James
[Attachment Removed]