Hello,
We’ve been battle testing out the Mass system and have successfully created simulations running on a single client. However, I can’t seem to get it to replicate. I naively first thought, I’ll add the Replication Trait to the Entity Config but that doesn’t seem to work.
I can see updates to replication on the ue5-main branch so wondering if this is not yet ready. If any engineers at Epic have this running with their own branches, we’d be eager to see how it’s done so far.
I’ve managed to abstract the MassSpawner to dynamically feed counts/locations via c++ but don’t see mentions of replication in the spawner code.
Appreciate this feature is very much in development but if anyone can help me understand a) if it works now and b) if so, what traits/fragments/subsystems etc I need to use to make it work.
Huge thanks!
1 Like
I’m also very curious about this. I’m using Mass system in my project (GitHub - LeroyTechnologies/ProjectM: UE5 MilSim FPS / RTS Game) but so far it’s just single player and I was planning on exploring multiplayer soon. I did notice all the MassReplication C++ code but I couldn’t find anything in the documentation or anyone else explaining how to get it working. I plan to read through the C++ code soon and if I figure anything out I’ll post an update here.
So I started by looking at the Replication trait and noticed a couple things that might explain why it didn’t just work:
- Looks like when you add the trait, under Params you need to set the ReplicatorClass, which has to be a subclass of UMassReplicatorBase. The only subclass of UMassReplicatorBase I see in the codebase is UMassCrowdReplicator. So if you’re replicating crowds, give that a try. If not, you’ll have to make your own UMassReplicatorBase subclass.
- Also under the Params of that trait, you have to set BubbleInfoClass to a subclass of AMassClientBubbleInfoBase. Again the only subclass of AMassClientBubbleInfoBase in the codebase is for crowds called AMassCrowdClientBubbleInfo. Either use that if it does what you want, or make your own.
I’ll give this a try myself, but might be a few weeks.
In case others might find this useful, I created a UML diagram with a subset of the classes used for Mass Replication:
I highlighted in yellow the classes that are crowd specific. In theory if you need to use Mass Replication for something other than crowds, you just need to create new versions of all the yellow classes.
If you want the source it’s here: Mass Replication UML.vpd - Google Drive
You can open it in https://online.visual-paradigm.com with a free account.
5 Likes
Thanks for this - yeah I’ve investigated and found the same. The Crowd Manager I can only assume was used for some Demo but there’s no docs or working examples on it. I also found that adding the Replication Trait, the fragments don’t get picked up. I’ve got 5.1 checked out to see if there’s movement in this area, I do see a lot of updates but we’re really missing some guidance on whether this is worth exploring because it might simply not work yet despite being named and visible in the code base.
It seems the 5.1 updates add a fragment for a Hash grid to maintain LOD distances - probably to increase efficiency of lookups for networking updates. I’m really interested to see how this evolves!
In the City Sample project the MassCrowdAgentConfig data asset uses the Replication trait and configures the Bubble Info Class and Replicator Class, so in theory you could test one of the City Sample levels in multiplayer and see what happens.
That’s a good shout! Thanks! I didn’t realise that had this configured.
I haven’t tried it myself, but I recently came across GitHub - arkena00/sample.mass which is a sample project using Mass replication. Figured it’s worth sharing here.
3 Likes