Orrery Terrain · OrreryTerrainCore module · class
Native::
FTerrainReplica
ExperimentalApplies the authority's records to one world in the log's one total order: sculpt commands and patches through an FSculptReplayer, FeatureOps through FTerrainWorld::ApplyFeatureOps, and checks each Checkpoint against the world's SyncHash, the replayer's digest and the next feature id.
Declaration
class FTerrainReplica- Header
#include "Native/Net/NetReplica.h"- Module
PublicDependencyModuleNames.Add("OrreryTerrainCore");in your module’s Build.cs.- Stability
- Experimental: supported, may change in a minor version, with a changelog line.
- Thread
- Game thread only, like every FTerrainWorld write.
Description
Sculpt and feature records share the one order because the keep-out guard reads the stack (FSculptReplayer, "Same hash"). A BrushMask record adds its mask to the world's FBrushMaskRegistry in its place in the order, or for the hash-only form finds it held; a step naming a mask the registry lacks faults (UnknownMask).
Before each record it sets FTerrainWorld::SetRecordSeq, so the ground journal's entries carry the authority's position. Consecutive brush steps go to the world as one run and publish once; the run's publish carries the position of its last applied step, also when a step that answers Pending cut it short. A step that answers Pending holds the queue until the ground has loaded (pump the world and call Pump again).
The first fault stops it: Pump applies nothing more. A checkpoint fault is repaired at its position (Repair) or, when only the digest disagreed, resynced; a dropped step or a refused FeatureOps record is not repairable and the shell rejoins, as it does after two repairs in a row (RepairsInARow). A late joiner continues the authority's open strokes (ResumeStrokes). Reset is not handled here.
Tier 1. Game thread only, like every FTerrainWorld write. The world must outlive the replica.
Functions
- FTerrainReplica (2 overloads)
- operator=
- Enqueue
Queue the next record of the log, decoded and copied: its Seq must be NextSeq.
- Pump
Apply queued records in order until the queue is empty, a sculpt step answers Pending, a fault, or MaxRecords were consumed.
- ResumeStrokes
Continue the authority's open strokes at the join position (
FJoinHead::Strokes, several authors' at once): the world opens a stroke for each, with its author, steps, reach and tiles, and the replayer expects each one's next step. - Repair
Apply the authority's Repair record for the checkpoint that faulted: set its tiles exactly, replace the stack with its own, then hold the world to the checkpoint's SyncHash, adopt its next feature id and take its digest.
- Resync
Clear a checkpoint fault whose SyncHash matches (BuildRepairRequest found nothing to repair): only the digest disagreed, so the replica takes the checkpoint's digest and next feature id.
- NextSeq
The Seq the next Enqueue must carry.
- AppliedSeq
The newest record applied or checked; NextSeq - 1 once the queue has drained.
- Queued
Records waiting, the held one included.
- Waiting
A sculpt step answered Pending, or the resumed stroke waits for its codes: pump the world's loads and pages, then Pump again.
- SculptDigest
The replayer's
FSculptReplayer::Digest. - Fault
None while it follows.
- FaultSeq
The record that faulted (for a dropped sculpt step, the last of its run); 0 with no fault.
- LastFeatureOps
The last ApplyFeatureOps answer.
- LastCheck
- Checks
Checkpoints compared.
- FaultCheckpoint
The checkpoint that faulted (with Fault Checkpoint): what Repair holds the world to.
- RepairsInARow
Repairs since the last checkpoint that matched: two mean the replica cannot keep up, so the shell rejoins.