I’m trying to incorporate a MassAI crowd in a server’s level and have other clients connect to the level. However, when I try to connect to the level as a client, the engine crashes after some time and the following message appears:
MASSAGENT_CHECK(State == EAgentComponentState::None ||
State == EAgentComponentState::PuppetPaused ||
State == EAgentComponentState::PuppetReplicatedOrphan,
TEXT("%s is expecting to be in state[None|PuppetPaused|PuppetReplicatedOrphan] state but is in %s"), ANSI_TO_TCHAR(__FUNCTION__), *UEnum::GetValueAsString(State));
and adding State == EAgentComponentState::PuppetPendingReplication to the state check, but I don’t know if there would be any adverse consequences for doing so and I would prefer to fix the problem without editing any of the native C++ files.
I also added Replication to the Data Asset I’m using for my Mass Spawner with MassCrowdClientBubbleInfo and MassCrowdReplicator for the Bubble Info Class and Replicator Class respectively, but the engine crashes again I get the following error instead shortly after connecting:
Somewhere you have a mass agent component (in my case it was in the player character, used for avoidance).
You need to add the trait Replication to it.
Once you’ve added it, expand it and in its parameters set the bubble info class to MassCrowdClientBubbleInfo and the replicator class to MassCrowdReplicator
That fixed the issue for me, that probably has to be done to any MassAgent component that is in a replicated actor
One thing I found was that there is some code in the MassReplicationProcessor and MassReplicationProcessorPathHandler that tries to get a Mutable Fragment View from a Read Only Fragment.
To fix this, I made two changes:
In the MassReplicationProcessor, I changed the access for the FMassReplicationViewerInforFragment on the CollectorViewerInfoQuery to ReadWrite (line 46 of MassReplicationProcessor.cpp). This is because the processor uses a function in this query context that requires a non const viewer fragment.
In MassReplicationPathHandlers, I made PathRequestList and LaneLocationList TConstArrayViews (lines 222 and 224 in MassReplicationPathHandlers.h), changed the GetMutableFragmentViews for PathRequesList and LaneLocationList to GetFragmentViews (lines 24 and 26 in MassReplicationPathHandlers.cpp), and changed the access for FMassMoveTargetFragment to ReadWrite (line 16 in MassReplicationHandlers.cpp). The MassMoveTargetFragment needs to be mtuable as it’s properties get changed in ModifyEntity.
Does this mean I have to use my own editor compiled from git?
Is there an easy way to deploy directly to the release version of the editor?
I had this problem with both 5.4 and 5.5.