Orrery Terrain · OrreryTerrainCore module · class
Native::
FSculptReplayer
ExperimentalApplies sculpt records to one terrain in the authority's order, never skipping one.
Declaration
class FSculptReplayer- Header
#include "Native/SculptReplay.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
One entry point. The authority applies its own commands through Apply, and a replica applies the authority's through Enqueue and Pump: both run the same code, so they write the same posts. The authority drops a step that answers Pending before recording it (the player sees no change, nothing is sent); a replica holds a Pending record, and every record after it, until the ground has loaded, because skipping it would desynchronise.
Same hash. The sculpt layer depends on Pristine, the sculpt records in order, and the feature stack each brush step met. Brushes read Natural, never Modified, but the keep-out guard reads the keep-out spans of the corridors in the stack (KeepOutMargin_mm around them), so a step near a corridor writes other posts with the corridor than without it. Sculpt and feature records therefore share one total order, the record log's (FNetSeq), and a replica applies both in it (FTerrainReplica, NetReplica.h). The bake is a pure function of Natural and the stack. A replica that starts from the authority's save bytes and applies the same records in that order reaches the same FTerrainSerialization::StateHash and FTerrainWorld::SyncHash.
Stroke ids. A record carries the authority's stroke id; the replayer opens a stroke of its own world for each BeginStroke and maps the id, so the two numberings may differ.
Several authors. Strokes of several authors are open at once, and their steps interleave: each Brush names its stroke and counts Step within it. A Begin never ends another stroke (the authority records an author's End before that author's next Begin, and before its undo patch); alone, it starts as FTerrainWorld::BeginStroke does, else beside the others (FTerrainWorld::BeginStrokeFor with kStrokeBeside). A patch applies beside the open strokes.
Limits. The replayer refuses what CheckSculptCommand refuses under its limits, and hands them to the world, whose keep-out guard reads KeepOutMargin_mm. The margin shapes the posts a brush writes, so an authority and its replicas must run the same limits.
Brush masks. A record naming a mask resolves it in the world's registry (FTerrainWorld::BrushMasks), by the hash the record carries: the same hash names the same samples on every machine, so a replica that holds the authority's masks replays masked steps to the same posts. A record whose mask the registry lacks is refused (UnknownMask), never applied without it.
Tier 1 (2.5 state through FTerrainWorld). Game thread only, like every FTerrainWorld write. The world must outlive the replayer.
Functions
- FSculptReplayer (2 overloads)
- operator=
- Apply
Apply one command now: the authority's path, and Pump's.
- ApplyFor
Apply one command as Author's: the authority's path with several players.
- ApplyPatch
Set the tiles of an undo or redo patch exactly (FTerrainWorld::ApplySculptPatch, or ApplySculptPatchBeside while strokes are open: the authority ended the patch's own stroke before it, so those are other authors').
- Enqueue
Queue a record received in the authority's order (a replica's path).
- EnqueuePatch
Queue a patch in order with the commands.
- Pump
Apply queued records in order until the queue is empty, one answers Pending, or MaxRecords were consumed.
- SeedDigest
Continue the digest from Seed instead of 0: a replica that starts from save bytes at a checkpoint seeds it with the checkpoint's SculptDigest, so its digest goes on matching the authority's.
- CopyOpenStrokes
Every open stroke, ascending records id: what a join stream sends of them.
- ResumeStroke
Go on with a stroke the world opened outside the records: a joiner's, which continues one of the authority's open strokes at the join position (
FTerrainReplica::ResumeStrokes). - Queued
Records waiting, the Pending one included.
- OpenStrokes
Strokes a Begin opened that no End closed yet.
- Digest
SculptCommandDigest over every command applied, from 0 or the SeedDigest value.
- AppliedCount
- DroppedCount
Refused plus out of order: non-zero on a replica means a desync.
- LastResult