Instant replication

I guessing that almost ALL important replicable objects / actors in game replicating while client is loading to server. But my own objects are not replicates while loading, only after and not too fast (also I need to move character / camera for faster replication). I using these params for replication, but this is doesn't help:
bReplicates = true;
bAlwaysRelevant = true;
NetCullDistanceSquared = 10000000.0f;
NetPriority = 3.0f;
bNetLoadOnClient = true;
bReplicates = true;
bAlwaysRelevant = true;
NetCullDistanceSquared = 10000000.0f;
NetPriority = 3.0f;
bNetLoadOnClient = true;
10 Replies
Robb
Robb2mo ago
what is the thing/data you are trying to replicate and why do you need it replicated quickly? I have not personally had to mess with those settings to get any of my stuff replicated soon enough to use
Marshall
MarshallOP2mo ago
In my case this is resource nodes (standard nodes are deleted). They must be fully replicated before client "spawns on the world", especially if there's some extractors or miners on them. Without resource nodes miners may cause a crash
Robb
Robb2mo ago
I feel like some other system is at play for nodes, because I don't think all vanilla nodes are replicated to clients all the time, but, this is out of my realm of knowledge. you could test that with a get all actors of class call from the client, probably. hopefully someone else chimes in
Archengius
Archengius2mo ago
you should be touching bAlwaysRelevant, NetCullDistanceSquared, NetPriority or bNetLoadOnClient what affects replication is Replication Graph and Class Policy assigned to your actor. You should change that and not these settings resource nodes are spatialized, which means they will replicate only and only if you are next to them
Marshall
MarshallOP2mo ago
Am I doing something wrong with Replication Graph? Can't find any guide of this. I just add this but it doesn't seem to have any effect:
UCLASS()
class RESOURCENODERANDOMIZER_API UCustomReplicationGraph : public UReplicationGraph
{
GENERATED_BODY()

protected:
virtual void InitGlobalActorClassSettings() override;
};
UCLASS()
class RESOURCENODERANDOMIZER_API UCustomReplicationGraph : public UReplicationGraph
{
GENERATED_BODY()

protected:
virtual void InitGlobalActorClassSettings() override;
};
void UCustomReplicationGraph::InitGlobalActorClassSettings()
{
Super::InitGlobalActorClassSettings();

FClassReplicationInfo ReplicationInfo;

ReplicationInfo.SetCullDistanceSquared(10000000.0f);
// ReplicationInfo.AccumulatedNetPriorityBias = 5.0f;
// ReplicationInfo.DistancePriorityScale = 0.0f;
// ReplicationInfo.ReplicationPeriodFrame = 1;
// ReplicationInfo.ActorChannelFrameTimeout = 100;
// ReplicationInfo.CullDistanceSquared = 100000000.0f;

GlobalActorReplicationInfoMap.SetClassInfo(ACustomResourceNode::StaticClass(), ReplicationInfo);
}
void UCustomReplicationGraph::InitGlobalActorClassSettings()
{
Super::InitGlobalActorClassSettings();

FClassReplicationInfo ReplicationInfo;

ReplicationInfo.SetCullDistanceSquared(10000000.0f);
// ReplicationInfo.AccumulatedNetPriorityBias = 5.0f;
// ReplicationInfo.DistancePriorityScale = 0.0f;
// ReplicationInfo.ReplicationPeriodFrame = 1;
// ReplicationInfo.ActorChannelFrameTimeout = 100;
// ReplicationInfo.CullDistanceSquared = 100000000.0f;

GlobalActorReplicationInfoMap.SetClassInfo(ACustomResourceNode::StaticClass(), ReplicationInfo);
}
Actor Creation:
ACustomResourceNode* Proxy = World->SpawnActor<ACustomResourceNode>(ACustomResourceNode::StaticClass());
if (Proxy)
{
Proxy->Initialize(CustomNode, OreType);
Proxy->SetReplicates(true);
}
ACustomResourceNode* Proxy = World->SpawnActor<ACustomResourceNode>(ACustomResourceNode::StaticClass());
if (Proxy)
{
Proxy->Initialize(CustomNode, OreType);
Proxy->SetReplicates(true);
}
As I understand it, is this a "global action", or do I need to somehow assign a policy for each actor?
Archengius
Archengius2mo ago
you cannot make a custom replication graph. You need to use the replication graph that vanilla is using
Archengius
Archengius2mo ago
Archengius
Archengius2mo ago
I still do not understand what you are trying to do though increase replication range? UFGReplicationGraph::RegisterCustomClassRepPolicy(ACustomResourceNode::StaticClass(), EClassRepPolicy::CRP_RelevantAllConnections); in your StartupModule will make your actors replicated at all times regardless of the distance from the player
Marshall
MarshallOP2mo ago
Nope, I need somehow to replicate actors before player spawns (while loading to server). UFGReplicationGraph::RegisterCustomClassRepPolicy(ACustomResourceNode::StaticClass(), EClassRepPolicy::CRP_RelevantAllConnections); helps to get all the actors, now I don't need to look in specific direction or move the character for "dynamic streaming" or anything like that, but anyway, I can't get the actors BEFORE the player spawns
Archengius
Archengius2mo ago
player spawns very early, what you think is player spawn is just an overlay that is shown until core game subsystems are replicated you could theoretically hook into that screen and make it stay for longer but you would need to somehow track that all of your nodes are replicated or you could just accept that the actors will take time to replicate and that's how unreal replication works vanilla buildings "spawn in" the exact same way the only objects vanilla considers "important" and waits for are game subsystems and nothing else
Want results from more Discord servers?
Add your server