Skip to content
Brass Orrery

Orrery Terrain · module

OrreryTerrainCore

A runtime module: in the editor and in packaged games. 24 public headers.

Build.cs
PublicDependencyModuleNames.Add("OrreryTerrainCore");
Type
Runtime

Native/AtomicSharedPtr.h

A shared pointer that any thread may load while one thread swaps it (TAtomicSharedPtr): the portable stand-in for std::atomic<std::shared_ptr<T>>, which libc++ (UE's Linux toolchain) does not provide.

#include "Native/AtomicSharedPtr.h"

  • TAtomicSharedPtr class

    A std::shared_ptr<T> behind a std::mutex, with the member names and call shapes of std::atomic<std::shared_ptr<T>>.

Native/BrushMask.h

Experimental

Brush masks (Tier 1): the baked grid that scales a brush per post, its canonical bytes and content hash, its mips, the integer CORDIC that rotates it and the sampler every machine runs bit for bit.

#include "Native/BrushMask.h"

  • kBrushMaskMinSide constant

    The smallest side of a brush mask, in samples.

  • kBrushMaskMaxSide constant

    The largest side of a brush mask, in samples (a 16-bit mask of this side holds 8 MiB of samples).

  • kBrushMaskFormatVersion constant

    The canonical bytes' format version, written after the magic.

  • kBrushMaskHeaderBytes constant

    Bytes of the canonical header: the magic 'TSBM', the format version (1 byte), the bits (1 byte) and the side (2 bytes, little-endian).

  • kBrushMaskOne constant

    A mask value of 1 (a white sample) in Q16: every sample becomes M in [0, kBrushMaskOne].

  • kBrushMaskMaxRadius_mm constant

    The largest FBrush::Radius_mm a mask is sampled at, 2^30 mm (about 1,074 km), so the sampler's products fit 64 bits; a larger masked brush writes nothing.

  • EBrushMaskRefusal enum

    Why bytes or samples were refused as a brush mask.

  • FBrushMask class

    One brush mask: a square grid of 8- or 16-bit samples, one channel, row-major, that scales a brush's falloff weight per post.

  • FBrushMaskRotation struct

    A dab's rotation: cos and sin of FBrush::MaskAngle in Q30 (2^30 is 1).

  • BrushMaskRotation function in OrreryTerrain::Native

    Cos and sin of an angle in 1/65536 of a turn (FBrush::MaskAngle), by an integer CORDIC (Volder 1959).

  • kBrushMaskScaleShift constant

    The fixed-point shift of FBrushMaskDab::ScaleX and ScaleY (samples per Q16 millimetre).

  • kBrushMaskInvShift constant

    The fixed-point shift of FBrushMaskDab::InvHalfX and InvHalfY (1 over a half-side in mm).

  • FBrushMaskDab struct

    One dab's sampler state, prepared once per dab by PrepareBrushMaskDab and read per post.

  • PrepareBrushMaskDab function in OrreryTerrain::Native

    Prepare one dab of Brush over Mask: its rotation (BrushMaskRotation), mirror, half-sides (BrushMaskHalfSides), level (FBrushMask::LevelFor with the longer half-side) and scales.

  • SampleBrushMask function in OrreryTerrain::Native

    M at a local position (FBrushMaskDab::Local), in Q16 from 0 to kBrushMaskOne: the one sampler entry point, which dispatches on the dab's flags.

  • kBrushMaskOutside constant

    What SampleBrushMaskRow writes for a post off the mask's rectangle (where FBrushMaskDab::Local answers false).

  • SampleBrushMaskRow function in OrreryTerrain::Native

    Sample one row of posts: post i lies at offset (Dx_mm + i × Step_mm, Dy_mm) from the brush centre.

Native/BrushMaskRegistry.h

Experimental

The brush mask registry (Tier 1): the masks one terrain holds, by content hash, with a byte budget and the pins that keep a mask an open stroke uses.

#include "Native/BrushMaskRegistry.h"

Native/EarthworksResult.h

Earthworks results: structure advice and wall kinds, station sections, wall runs and the per-feature result struct.

#include "Native/EarthworksResult.h"

  • EStructureAdvice enum

    What the ground under a station suggests building, before the owner's own thresholds.

  • EWallKind enum

    Why a formation edge holds a vertical step: a retaining wall the terrain reports.

  • FStationSection struct

    Cross-section at one corridor station: per-station areas for a mass-haul diagram and pricing.

  • FWallRun struct

    A run of retaining wall along consecutive stations of one side of one feature.

  • FEarthworksResult struct

    What a feature does to the ground, from FTerrainWorld::Evaluate (preview) or Commit.

Native/GroundFollow.h

The follow rule for placed foliage and actors: which instance stands over which change, whether it snaps to the new ground or is hidden, and the canonical order everything is visited in.

#include "Native/GroundFollow.h"

  • EFollowMode enum

    What a followed type does when the ground under it changes.

  • FFollowRules struct

    The rules of one followed type (a foliage type, a tagged component, an actor).

  • EFollowStatus enum

    How an instance's registration or evaluation ended.

  • FFollowRegistration struct

    The result of registering one instance.

  • FFollowEvaluation struct

    The result of evaluating one tracked instance on a snapshot.

  • FFollowItem struct

    One followed instance: 12 bytes.

  • FollowTileKey function in OrreryTerrain::Native

    The edit tile key (Y high, X low) of a world position, metres; tiles beyond +-16384 saturate.

  • FollowTileCoord function in OrreryTerrain::Native

    The tile coordinate a key stands for (the inverse of FollowTileKey, for keys that did not saturate).

  • FFollowSet class

    The followed items of one component, kept as a few sorted runs so an edit finds the items under it without a scan and adding a million items never re-sorts them all at once.

  • FFollowChanges class

    The changes of a journal pull, folded into a few edit-tile rectangles in canonical order.

  • FFollowSeg struct

    One segment of a corridor's or channel's formation band, with its half widths and bounds, for a batch.

  • FFollowPoly struct

    One plate polygon for a batch.

  • FFollowScratch struct

    Scratch a caller keeps between batches, so the steady state allocates nothing.

  • PointInFeatureFootprint function in OrreryTerrain::Native

    Whether a point stands in a feature's footprint (plus a margin): a plate's polygon, or a corridor's or channel's formation band (the wider half width at each station, interpolated along the segment).

  • RegisterFollow function in OrreryTerrain::Native

    Register Count instances: their reference offsets and whether each stands cleared already.

  • EvaluateFollow function in OrreryTerrain::Native

    Evaluate Count tracked instances against a snapshot.

  • NormalTurn function in OrreryTerrain::Native

    The rotation that takes the unit normal From to the unit normal To, its angle clamped.

Native/GroundHandle.h

The any-thread handle on a terrain's published ground (FGroundHandle): long-running work keeps it and acquires a fresh FGroundQuery whenever it likes, without a hop to the game thread, and gets an empty query once the terrain is gone.

#include "Native/GroundHandle.h"

  • FGroundHandle class

    A thread-safe handle a terrain world publishes into: every snapshot the world publishes, it also hands to its handle, and when the world is destroyed it closes the handle.

Native/GroundJournal.h

The ground change journal's entry (FGroundChange): what one publish may have changed, where and why.

#include "Native/GroundJournal.h"

  • EGroundChangeWhat enum

    What a journal entry may have changed (FGroundChange::What), as bits: a may-have-changed set, so a reader that caches one kind of data skips the entries without its bit.

  • operator| function in OrreryTerrain::Native

    The union of two sets of bits.

  • operator& function in OrreryTerrain::Native

    The bits two sets share.

  • HasAny function in OrreryTerrain::Native

    Whether Bits holds any of Test's bits.

  • FarLevelBit function in OrreryTerrain::Native

    The bit of far level Level in FGroundChange::Levels; levels 15 and deeper share bit 15.

  • kFarAllLevels constant

    Every far level: FGroundChange::Levels of a change to the truth.

  • kGroundJournalCapacity constant

    Entries the ground journal keeps: a reader more entries behind than this resets (FGroundQuery::ChangesSince).

  • kFarJournalCapacity constant

    Far entries (Levels != 0) FTerrainWorld::FarChanges keeps: a far reader more far entries behind than this resets.

  • kFarJournalMaxPerPublish constant

    Far rectangles one publish adds at most; more changed tiles coalesce into bounding rectangles.

  • FGroundChange struct

    One entry of the ground change journal: a rectangle of edit tiles whose ground, or the answers about it, may have changed in one publish.

  • FFarChange type alias

    The far journal's entry: the ground journal's entries with Levels != 0.

    = FGroundChange

Native/GroundSampling.h

The batch ground sampler: height, face and smoothed normals, slope, paint weights, ground class and the answer's precision for many positions in one call, on any thread, with no allocation once its scratch is warm.

#include "Native/GroundSampling.h"

  • EGroundAccuracy enum

    How exact a sampler request must be.

  • FPaintWeights struct

    The (layer, weight) pairs of one post's paint, heaviest first (ties by ascending layer id), weights summing to 255.

  • DecodePaint function in OrreryTerrain::Native

    The weights of one canonical post (FPaintSlots): its used pairs, zero weights dropped.

  • FGroundSampleRequest struct

    What to sample: positions in, in metres, and which ground at what accuracy.

  • FGroundSampleColumns struct

    Where the answers go: one array per column, each Count long (Normal and SmoothNormal 3·Count, SurfaceState 4·Count).

  • SampleGround function in OrreryTerrain::Native

    Sample many positions on one snapshot.

  • GradeAlong function in OrreryTerrain::Native

    Rise over run of the ground along a horizontal direction, a central difference one edit cell either side of the point.

Native/Net/HashTree.h

Experimental

The SyncHash and its hash tree: an incremental identity of the truth, with per-chunk leaves for repair.

#include "Native/Net/HashTree.h"

  • kSyncFieldSculpt constant

    The field of a SyncHash leaf: a paint channel is its own FChannelId (below 0x10000); the sculpt layer is kSyncFieldSculpt.

  • FSyncHashLeaf struct

    One leaf of the SyncHash tree: a field's tiles in one 32 × 32-tile chunk of the edit extent.

  • FTerrainHashTree class

    The incremental SyncHash of one world.

Native/Net/NetBatch.h

Experimental

The batch codec of the terrain's net records: a run of records in one payload, brush steps delta-coded.

#include "Native/Net/NetBatch.h"

  • kNetBatchContexts constant

    Stroke contexts a batch stream keeps: a switch back to one of these costs one byte.

  • FNetBatchContext struct

    One stroke context of a batch stream: the stroke, its author and the reference its next brush step is coded against.

  • FNetBatchStream struct

    The state a batch stream carries from one batch to the next, the same on the writer and the reader.

  • FNetBatchWriter class

    Packs a run of records into one batch payload (ClientRecords, and upstream requests), for one link.

  • FNetBatchReader class

    Reads the batches of one stream that FNetBatchWriter wrote, in order.

Native/Net/NetJoin.h

Experimental

The late-join stream: a version-5 save pinned at a log position S, framed and reordered for one joiner, with the strokes open at S and the brush masks the joiner needs.

#include "Native/Net/NetJoin.h"

  • kJoinStreamVersion constant

    Version of the join stream's framing and head.

  • kJoinMaxMaskBytes constant

    The most canonical brush mask bytes one join carries (FJoinHead::Masks), 32 MiB: three 16-bit 2048² masks (8 MiB and 8 bytes each), or 512 8-bit 256² ones.

  • kJoinFrameBytes constant

    The most save bytes one frame carries; the transport cuts the stream wherever it likes (ClientJoinChunk, at most 32 KB).

  • kJoinMaxHeadBytes constant

    The largest head a reader accepts, bytes.

  • kJoinMaxStartBytes constant

    The largest start chunk a reader accepts, bytes: its stroke and tile index, then the tile's kTilePosts² posts as zigzag varints of their residual from a plane through their neighbours.

  • FJoinStrokeTile struct

    One tile an open stroke touched, as the world's stroke keeps it (the rounding's pace).

  • FJoinOpenStroke struct

    One of the authority's open strokes at the join position: what a joiner needs to go on applying its steps and get the same posts.

  • FJoinMaskRef struct

    One brush mask a join stream carries in a mask frame.

  • EJoinCacheUse enum

    How a join stream uses the save a joiner kept from an earlier join (FJoinStreamConfig::JoinerSaveHash).

  • FJoinHead struct

    What the join stream's first frame says: the position S, the checkpoint there, and where the save's parts lie.

  • IJoinSaveStore class

    Where a join writer keeps the save it streams from: Prepare writes the save into it once, then the writer reads its frames back through the file Finish returns, so the host holds a read-ahead per joiner rather than the save.

  • FJoinStreamConfig struct

    What the server knows of a joiner when its join starts (its hello).

  • EJoinWrite enum

    How a join writer stands.

  • FJoinStreamWriter class

    The server's half of one late join: a save pinned at S (PlanSave), cut into frames and reordered for the joiner.

  • EJoinStreamError enum

    Why a join reader stopped.

  • EJoinCacheOpen enum

    Why FJoinCache::Open refused a save.

  • FJoinCache class

    A save a client kept from an earlier join, opened for a later join to take bytes from: its index by code hash.

  • EJoinCacheFill enum

    How FJoinStreamReader::FillFromCache ended.

  • IJoinReceiveStore class

    Where a joiner keeps the save it receives: a file the reader appends each arrived run of save bytes to, off the game thread (FJoinStreamReader::Drain), so the joiner holds the bytes on their way rather than the save, and the world loaded from the stream pages its codes from it.

  • FJoinReaderConfig struct

    Where a joiner keeps its stream's save.

  • FJoinStreamReader class

    The joiner's half: takes the stream in pieces of any size and keeps the save as a sparse file.

  • EJoinLoad enum

    How LoadJoin ended.

  • LoadJoin function in OrreryTerrain::Native

    Load the joiner's world from the stream's save at S (FTerrainSerialization::LoadFromFile: paged when the world has a page store, so codes still on their way stay cold), check StateHash and SyncHash against the head, hold the save's next feature id to the head's, then set the record position to S.

  • StartJoinReplica function in OrreryTerrain::Native

    LoadJoin, then a replica that expects S + 1 with the head's digest, which continues the head's open strokes (FTerrainReplica::ResumeStrokes).

  • JoinReceiveResidentBytes function in OrreryTerrain::Native

    The heap every joiner's save file holds in this process, bytes: the runs in memory and their index, as FJoinStreamReader::ResidentBytes counts them, for as long as the file lives (the world loaded from it keeps it).

Native/Net/NetLog.h

Experimental

The authority's ordered log of net records: sequence numbers, link cursors and trimming.

#include "Native/Net/NetLog.h"

Native/Net/NetRecord.h

Experimental

The terrain's net records: kinds, sequence numbers, the record envelope, the payload codecs and the version check.

#include "Native/Net/NetRecord.h"

  • FNetSeq type alias

    A record's position in the authority's log (FTerrainNetLog): 1 for the first record, 0 for none.

    = uint64_t
  • FTerrainAuthor type alias

    Who authored a record: kTerrainServerAuthor for the server or host, then one id per connection, stable for the session.

    = uint32_t
  • kTerrainServerAuthor constant

    The author of the server's or the listen host's own edits.

  • kTerrainNetVersion constant

    Version of the net record format: the envelope, the payloads below and the batch codec (NetBatch.h).

  • ETerrainNetRecordKind enum

    What a net record carries.

  • IsKnownNetRecordKind function in OrreryTerrain::Native

    Whether this version knows a kind as a record of the authority's stream.

  • IsRequestNetRecordKind function in OrreryTerrain::Native

    Whether a client's request batch may carry a kind: every known record kind, and MaskUpload.

  • IsSequencedNetRecord function in OrreryTerrain::Native

    Whether a kind takes a sequence number.

  • ENetDecode enum

    Why bytes were refused as a net record, a payload or a batch.

  • kNetMaxPayloadBytes constant

    The largest payload a record may carry, 64 MiB.

  • kNetRecordHeaderBytes constant

    Bytes of a record's envelope before its payload: version 2, kind 1, seq 8, author 4, payload size 4.

  • FNetRecordView struct

    One record, borrowed: the payload bytes belong to whoever produced the view.

  • EFeatureWireOpKind enum

    What one feature-stack op does, as FTerrainWorld's commit funnel applied it.

  • FFeatureWireOp struct

    One stack op of a FeatureOps record: the result of a commit, not the call.

  • FFeatureOpsRecord struct

    The stack ops one commit, undo, revert or reapply applied, in order, and the stack's NextFeatureId after it.

  • FTerrainCheckpoint struct

    The hashes a replica compares when it reaches this position, so both sides compare at the same logical point.

  • kNetCheckpointBytes constant

    Bytes of a Checkpoint payload.

  • ENetResetReason enum

    Why the authority reset its replicas.

  • FTerrainNetReset struct

    Every replica rejoins (control).

  • kNetResetBytes constant

    Bytes of a Reset payload.

  • FTerrainNetRepair struct

    The repair of one client after a checkpoint mismatch, placed at that client's position so ordering stays exact.

  • kNetBrushMaskHashOnlyBytes constant

    Bytes of a BrushMask payload that names its mask by hash only: U64 hash, U32 canonical size.

  • ENetBrushMaskCodec enum

    How a BrushMask payload codes its mask's canonical bytes.

  • FNetBrushMask struct

    One BrushMask record's content: the mask, or only its name.

  • IsBrushMaskCanonicalSize function in OrreryTerrain::Native

    Whether Bytes is the canonical size of some brush mask: kBrushMaskHeaderBytes + Side² × Bits / 8 for a legal side and bits.

  • EncodeBrushMaskRecord function in OrreryTerrain::Native

    Append the full BrushMask payload of Mask: its hash, its canonical size, then the smaller of the two codecs.

  • EncodeBrushMaskHashOnly function in OrreryTerrain::Native

    Append the hash-only BrushMask payload (kNetBrushMaskHashOnlyBytes) of the mask named Hash, CanonicalBytes long.

  • DecodeBrushMaskRecord function in OrreryTerrain::Native

    Read a BrushMask payload, all of Size.

  • PeekBrushMaskRecord function in OrreryTerrain::Native

    The hash and canonical size a BrushMask payload starts with, unchecked.

  • kNetMaskUploadHeaderBytes constant

    Bytes of a MaskUpload payload before its chunk: U64 hash, U32 canonical size, U32 total, U32 offset.

  • kNetMaskUploadChunkBytes constant

    The most upload bytes one MaskUpload part carries, 16 KiB: half of the largest transport part (kTerrainNetMaxPartBytes, 32 KiB), so a request batch part holds a chunk and the brush steps beside it.

  • FNetMaskUpload struct

    One part of a client's brush mask upload (a MaskUpload request): the offer, or a chunk of the upload's bytes.

  • EncodeMaskUpload function in OrreryTerrain::Native

    Append a MaskUpload payload: the header and Part's chunk.

  • DecodeMaskUpload function in OrreryTerrain::Native

    Read a MaskUpload payload, all of Size.

  • FNetMaskUploadAssembly class

    Puts one brush mask upload back together on the server, in order.

  • CheckNetPayload function in OrreryTerrain::Native

    Check a payload against its kind, touching nothing.

  • CheckNetRequestPayload function in OrreryTerrain::Native

    Check a request's payload against its kind: as CheckNetPayload, and a MaskUpload as DecodeMaskUpload checks it.

  • EncodeNetRecord function in OrreryTerrain::Native

    Append one record in its canonical, unbatched form: U16 kTerrainNetVersion, U8 kind, U64 seq, U32 author, U32 payload size, then the payload.

  • DecodeNetRecord function in OrreryTerrain::Native

    Read one record written by EncodeNetRecord, all of Size and nothing more.

  • EncodeFeatureOps function in OrreryTerrain::Native

    Append a FeatureOps payload.

  • DecodeFeatureOps function in OrreryTerrain::Native

    Read a FeatureOps payload, all of Size.

  • EncodeCheckpoint function in OrreryTerrain::Native

    Append a Checkpoint payload, kNetCheckpointBytes; Checkpoint.Seq travels in the envelope.

  • DecodeCheckpoint function in OrreryTerrain::Native

    Read a Checkpoint payload of the record at Seq.

  • EncodeReset function in OrreryTerrain::Native

    Append a Reset payload, kNetResetBytes.

  • DecodeReset function in OrreryTerrain::Native

    Read a Reset payload.

  • EncodeRepair function in OrreryTerrain::Native

    Append a Repair payload.

  • DecodeRepair function in OrreryTerrain::Native

    Read a Repair payload, all of Size.

  • FTerrainNetVersions struct

    The format versions two peers must share, compared at the Hello before anything else travels.

  • LocalNetVersions function in OrreryTerrain::Native

    This build's versions.

  • ENetVersionMismatch enum

    Which version two peers disagree on, checked in this order.

  • CheckNetVersions function in OrreryTerrain::Native

    Compare a peer's versions with this build's, as the Hello does; any mismatch is refused (VersionMismatch).

Native/Net/NetRepair.h

Experimental

Repair after a checkpoint mismatch: the server's chunk sums, the client's request with its tile hashes, and the Repair record built from them.

#include "Native/Net/NetRepair.h"

  • kRepairMessageVersion constant

    Version of the repair messages (leaves and request).

  • FTerrainRepairLeaves struct

    The server's SyncHash tree at one checkpoint: ServerRepairHashes.

  • FRepairTileHash struct

    One tile's content as the SyncHash reads it: a sculpt state's delta hash, a painted tile's content hash.

  • FRepairChunk struct

    A chunk whose leaf differs, with every set tile the client holds in it, row then column.

  • FTerrainRepairRequest struct

    The client's answer to the leaves: the chunks that differ, each with the client's tile hashes, so the server sends the tiles that differ at once.

  • EncodeRepairLeaves function in OrreryTerrain::Native

    Append the leaves message.

  • DecodeRepairLeaves function in OrreryTerrain::Native

    Read a leaves message, all of Size: leaves strictly in tree order, each with a tile.

  • EncodeRepairRequest function in OrreryTerrain::Native

    Append the request message.

  • DecodeRepairRequest function in OrreryTerrain::Native

    Read a request, all of Size: chunks strictly in tree order, tiles strictly row then column, at most 1,024 a chunk.

  • BuildRepairRequest function in OrreryTerrain::Native

    Compare the server's leaves with World's SyncHash tree and list the client's tiles in every chunk that differs (by count or sum, or present on one side only), and whether the stack differs.

  • ERepairBuild enum

    How FTerrainRepairSource::Build ended.

  • FTerrainRepairSource class

    The authority's truth at one checkpoint, kept to repair clients that disagreed there.

Native/Net/NetReplica.h

Experimental

A replica's half of the terrain record log: the authority's records applied in its one order, its checkpoints checked, a joiner's open stroke resumed and a mismatch repaired.

#include "Native/Net/NetReplica.h"

  • FeatureOpsOf function in OrreryTerrain::Native

    The FeatureOps record of one stack change, as the authority's commit listener hands it out (FTerrainWorld::SetCommitListener): each op with its id, anchor and feature bytes (EncodeFeature), and the next feature id.

  • EReplicaEnqueue enum

    How FTerrainReplica::Enqueue ended.

  • EReplicaFault enum

    Why a replica stopped applying records.

  • EReplicaRepair enum

    How FTerrainReplica::Repair or Resync ended.

  • FReplicaCheck struct

    What one checkpoint compared on the replica.

  • FTerrainReplica class

    Applies 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.

Native/SculptCommand.h

Experimental

The sculpt wire records (Tier 1): FSculptCommand, the brush stroke as a replicable command, and FSculptPatch, the heights and channels it changed, with their encode and decode and the record version.

#include "Native/SculptCommand.h"

  • kSculptRecordVersion constant

    Version of the sculpt record format (commands and patches), written first on the wire.

  • kSculptRecordOldestVersion constant

    The oldest record version a decoder still reads; it upgrades it to kSculptRecordVersion.

  • ESculptRecordKind enum

    What a sculpt record carries.

  • FSculptCommand struct

    One sculpt command, the unit that replicates a stroke.

  • kSculptCommandBytes constant

    Bytes of one encoded FSculptCommand: version 2, kind 1, brush kind 1, falloff 1, channel value 1, channel 2, stroke 8, step 4, centre 8 + 8, radius 4, strength 4, flatten-to 4, then (version 3 on) falloff start 2, flatten direction 1, paint layer 1, paint opacity 1, then (version 5) mask hash 8, mask angle 2, mask flags 1, stamp blend 1, mask aspect 2 and 5 zero bytes.

  • kSculptCommandBytesV4 constant

    Bytes of a version 3 or 4 command: the first 53 of the version 5 layout, then 3 zero bytes.

  • kSculptCommandBytesV2 constant

    Bytes of a version 2 command: the first 48 of the version 3 layout.

  • FSculptPatch struct

    The sculpt layer's state after an undo or redo, replicated as tiles, never re-derived.

  • ESculptRefusal enum

    Why a sculpt record is refused before it touches the ground.

  • kSculptMaxCentre_mm constant

    Largest |Brush.CentreX_mm| and |Brush.CentreY_mm| a record may carry: about 10^15 m, far beyond any terrain.

  • FSculptLimits struct

    What the authority accepts from a player's brush.

  • ESculptApply enum

    What applying one sculpt record, or one brush step, did.

  • IsPaintOnlyChannel function in OrreryTerrain::Native

    Whether a PaintChannel brush may never write Channel: the paint slot planes and the reserved id after them (16-31), and the retired v4 paint (Channels::PaintLayer, PaintWeight).

  • CheckSculptCommand function in OrreryTerrain::Native

    Check a command against the record format and the limits, touching nothing.

  • EncodeSculptCommand function in OrreryTerrain::Native

    Write one command as kSculptCommandBytes little-endian bytes.

  • DecodeSculptCommand function in OrreryTerrain::Native

    Read one command written by EncodeSculptCommand, of this version or an older one it still reads.

  • EncodeSculptPatch function in OrreryTerrain::Native

    Append a patch's bytes (version, kind, stroke, tile bytes) to Out.

  • DecodeSculptPatch function in OrreryTerrain::Native

    Read a patch written by EncodeSculptPatch.

  • PeekSculptRecordKind function in OrreryTerrain::Native

    The kind of an encoded record, from its first three bytes, so a receiver can dispatch.

  • SculptCommandDigest function in OrreryTerrain::Native

    Fold one command into a running digest: authority and replica compare it to find the first command they disagree on, before StateHash differs.

  • FSculptVolumes struct

    What one stroke moved, for pricing.

Native/SculptReplay.h

Experimental

Applies sculpt records to one terrain in authority order: Apply on the authority, Enqueue and Pump on replicas.

#include "Native/SculptReplay.h"

  • FSculptReplayer class

    Applies sculpt records to one terrain in the authority's order, never skipping one.

Native/TerrainChannels.h

Named terrain channel ids (ground class, legacy paint layer and weight, the paint slot planes) and the ground-class and hole-class constants.

#include "Native/TerrainChannels.h"

  • kGroundClasses constant

    Ground classes a cell can carry: the rows of FBatterTable and of the shell's physical material table.

  • kHoleClass constant

    Ground-class value that marks a hole: a cell under a mesh feature (portal, cut-and-cover), skipped by collision and navigation.

  • FChannelName struct

    A per-cell channel the terrain knows by name.

  • GroundClass constant

    FGroundClass per cell: batter row, physical material, cost; kHoleClass = hole.

  • PaintLayer constant

    Legacy paint (save versions 1-4): material layers per cell, two 4-bit indices, layer A in the low nibble, layer B in the high nibble (16 layers).

  • PaintWeight constant

    Legacy paint: weight of PaintLayer's layer B over layer A per cell, 0..255; 0 shows A alone.

  • PaintSlotLayerFirst constant

    Paint as slot planes (save version 5): a post holds up to kMaxPaintSlots (layer, weight) pairs, one u8 plane per field.

  • PaintSlotWeightFirst constant

    Weight plane of slot 1; slot s is PaintSlotWeightFirst + s - 1.

  • PaintPlaneLast constant

    Last id of the paint planes (weight of slot 7).

  • Known constant
  • kMaxPaintSlots constant

    Paint slots a post can hold in the format: the layer planes are ids 16-23 and the weight planes 24-30.

  • PaintSlotLayerChannel function in OrreryTerrain::Native

    The channel id of slot Slot's layer plane.

  • PaintSlotWeightChannel function in OrreryTerrain::Native

    The channel id of slot Slot's weight plane.

  • IsPaintPlaneChannel function in OrreryTerrain::Native

    Whether Id is one of the paint slot planes (16-30).

  • ChannelDefault function in OrreryTerrain::Native

    The value an unpainted cell of a channel reads as.

  • FindChannel function in OrreryTerrain::Native

    The id of a named channel.

Native/TerrainCost.h

Time counters behind the stat terrain panel: a scope at each place the terrain does work adds its time to one process-wide counter while the panel is up.

#include "Native/TerrainCost.h"

  • ETerrainCost enum

    The parts of the terrain's CPU time, one counter each.

  • kTerrainCostCount constant

    Number of counters, for arrays passed to DrainTerrainCosts.

  • GTerrainCostCollecting constant

    Nonzero while the counters collect.

  • SetTerrainCostCollecting function in OrreryTerrain::Native

    Start or stop collecting.

  • AddTerrainCost function in OrreryTerrain::Native

    Add time to a counter.

  • DrainTerrainCosts function in OrreryTerrain::Native

    Read every counter and reset it to zero.

  • FTerrainCostScope class

    Adds the time from construction to destruction to one counter, while collecting.

Native/TerrainEdit.h

Staged edit transactions, exact undo tokens (opaque), brush kinds, falloff and the brush struct.

#include "Native/TerrainEdit.h"

  • EStageResult enum

    Outcome of staging one edit into a transaction.

  • FTerrainTransaction class

    Edits staged against the feature stack, not yet applied.

  • FGroundUndo class

    The exact inverse of one committed transaction: stack operations recorded at commit time, never a re-derivation from the owner's geometry.

  • EBrushKind enum

    What a sculpt brush does.

  • EStampBlend enum

    How a Stamp's target meets the ground (EBrushKind::Stamp).

  • kBrushMaskMirror constant

    FBrush::MaskFlags: the mask is mirrored left to right (its columns reversed) in the brush's own frame, before the rotation.

  • kBrushMaskSquare constant

    FBrush::MaskFlags: the footprint is the mask's own rectangle, rotated with it, corners included, instead of the disc that clips it.

  • kBrushMaskBicubic constant

    FBrush::MaskFlags: the mask is sampled bicubically (fixed point, integer only) instead of bilinearly.

  • kBrushMaskKnownFlags constant

    Every FBrush::MaskFlags bit record version 5 defines; a record with any other bit set is refused.

  • kBrushAspectSquare constant

    FBrush::MaskAspect_q8 of a square mask: width over height 1:1, in 1/256.

  • kBrushAngleTurn constant

    FBrush::MaskAngle of a whole turn: the angle counts 1/65536 of a turn (about 0.0055°).

  • EFalloff enum

    Brush falloff.

  • EFlattenDirection enum

    Which way a Flatten brush may move the ground.

  • kFalloffStartOne constant

    FBrush::FalloffStart_q16 of the whole radius: the start is a fraction of the radius in 1/65536.

  • kMaxFalloffStart_q16 constant

    The largest falloff start a brush carries, 65535/65536 of the radius.

  • FalloffStartToQ16 function in OrreryTerrain::Native

    A falloff start as a brush carries it: Start (a fraction of the radius) rounded to 1/65536.

  • FalloffWeight function in OrreryTerrain::Native

    The brush strength factor at a normalised distance, in floating point.

  • FBrush struct

    One brush application, in fixed point because strokes replicate as commands and must produce the same tiles on every machine.

Native/TerrainFeature.h

Feature model: batter tables, berms, corridor stations, keep-out spans, openings, plate and channel features and the feature union.

#include "Native/TerrainFeature.h"

  • FBatter struct

    Side slope as horizontal run per unit of rise, in thousandths (1500 = 1.5:1).

  • FBatterTable struct

    Batter per ground class.

  • FBerms struct

    Intermediate berms on deep cuttings and high embankments.

  • FCorridorStation struct

    One sampled station of a corridor centreline.

  • FKeepOutSpan struct

    A run of stations where the ground is left untouched: viaduct, bridge, tunnel bore.

  • kMaxOpeningsPerCorridor constant

    Most openings one corridor may state (FTerrainWorld refuses more as InvalidFeature).

  • kMaxOutlinePoints constant

    Most points one opening's outline may hold.

  • FOpening struct

    One tunnel mouth of a corridor: where the approach cutting folds to the portal, and where the face opens into a hole behind the portal's opening (Rail Earthworks Shoulders Skeleton, decisions 5 to 7).

  • FCorridorFeature struct

    A linear earthwork: railway, road, embankment, cutting, tunnel approach.

  • FPlateVertex struct

    A vertex of a plate polygon, millimetres relative to the terrain origin.

  • FPlateFeature struct

    An area earthwork: junction zone, platform, building pad, runway, apron.

  • FChannelFeature struct

    A channel: canal, lock chamber, drainage cut.

  • EFeatureKind enum

    Which payload a feature carries.

  • FFeature struct

    One entry of the feature stack: the semantic truth of the modified ground.

Native/TerrainScatter.h

Experimental

The grass scatter kernel: every candidate instance is a pure function of its key (world seed, variety, tile, sub-cell, index), so an edit changes only the instances of the sub-cells whose posts changed.

#include "Native/TerrainScatter.h"

  • kScatterSubCellsPerSide constant

    Sub-cells per chunk side: a 128-post chunk (127 quads) splits into 4 × 4 sub-cells of 32 quads (the last 31).

  • kScatterSubCellQuads constant

    Quads per sub-cell side (the last sub-cell of a row or column takes the remainder).

  • kScatterSubCells constant

    Sub-cells per chunk; a dirty set is a uint16_t with bit SubY * 4 + SubX.

  • kScatterLayers constant

    Paint layer ids a post can name (8-bit ids, PaintSlots.h).

  • kScatterMaxAutoRules constant

    Auto rules the material evaluates (the material's AutoRule0..4).

  • kScatterMaskSize constant

    Keep-clear mask cells per sub-cell side: 0.5 m at 1 m posts.

  • kScatterMaskDistStepCm constant

    Keep-clear distance unit, cm (FScatterKeepClear::MarginDistQ).

  • kScatterLayersFormulaHash constant

    The material formula EffectiveLayerWeights ports: 64-bit FNV-1a of the UTF-8 bytes of MF_TerrainLayers' Custom node code from the first "float W0 = 1.0;" to the end of the first "EW[0] = W0 * Rem;", carriage returns removed (the painted bilinear of slots 0-1, the two noise fields, the five auto rules and RockMask; chunks holding texture 2 redo the bilinear with slots 2-3 in one branch after the block, which this hash does not cover).

  • FScatterPosts struct

    A read-only view of one chunk's posts: FTerrainChunkPosts in plain C++.

  • FScatterAutoRule struct

    One auto rule of the layer set, as the material reads it (MF_TerrainLayers, AutoRule{i}_Slope, _Altitude, _Noise).

  • FScatterLayerRules struct

    The auto rules of a terrain's material: the one source of where layers show.

  • EScatterScaling enum

    How a variety's three scales relate (ULandscapeGrassType's EGrassScaling).

  • FScatterVariety struct

    One grass variety on one paint layer, in plain C++: the shell turns a ULandscapeGrassType variety plus a layer set entry (FOrreryTerrainLayerGrass) into this.

  • FScatterSettings struct

    Per-run settings that are not part of a variety.

  • EScatterFootprintKind enum

    What a keep-clear footprint is (from FGroundQuery::FeaturesIn, or a buyer's shape).

  • FScatterFootprint struct

    One keep-clear footprint in world cm.

  • FScatterKeepClear struct

    The keep-clear state of one sub-cell, rasterised once and tested per candidate (kScatterMaskSize² cells).

  • FScatterInstance struct

    One placed instance, relative to the chunk: the shell's component sits at (OriginX, OriginY, OriginZ).

  • ScatterVarietySeed function in OrreryTerrain::Native

    The seed of one variety: 64-bit FNV-1a over the grass type's package path (UTF-8 bytes, no terminator) followed by the four little-endian bytes of the variety index.

  • ScatterKey function in OrreryTerrain::Native

    The key of candidate Index.

  • ScatterSubCellQuads function in OrreryTerrain::Native

    The quads of sub-cell (SubX, SubY), half-open: [OutQ0X, OutQ1X) × [OutQ0Y, OutQ1Y).

  • ScatterCandidateCount function in OrreryTerrain::Native

    Candidates of one (sub-cell, variety): N = ceil(area m² × DensityPer100m2 / 100), at most 2^20.

  • ScatterThinnedCount function in OrreryTerrain::Native

    The candidates density scaling leaves to be evaluated: ceil(Candidates × ThinScale) for Halton (a prefix, clamped to [0, Candidates]); every candidate for the grid, which thins per candidate instead (FScatterSettings::ThinScale).

  • EffectiveLayerWeights function in OrreryTerrain::Native

    The layer weights the material shows at one point (the material's MF_TerrainLayers formula, ported).

  • AutoLayerWeights function in OrreryTerrain::Native

    The auto rules alone: how a unit of layer-0 weight splits over the layers at world position (WorldXCm, WorldYCm).

  • RasteriseKeepClear function in OrreryTerrain::Native

    Rasterise the footprints that touch sub-cell (SubX, SubY) into its keep-clear mask.

  • ScatterSubCell function in OrreryTerrain::Native

    Place one (sub-cell, variety): every candidate in ascending Index, kept by holes, keep-clear, class, the slope and altitude bands, and W > Min && W <= Max && W >= u_keep.

  • ScatterDiffSubCells function in OrreryTerrain::Native

    The sub-cells whose instances can differ between two revisions of one chunk: heights (with OriginZ), paint and class over each sub-cell's posts, one post wider for the post normals.

  • ScatterSubCellsInRect function in OrreryTerrain::Native

    The sub-cells of a chunk that a world rectangle (cm, inclusive) touches: what a footprint or keep-clear change dirties.

Native/TerrainTypes.h

Core terrain value types: owner id, world XY and XYZ, surfaces, precision, ground samples and hits, change causes.

#include "Native/TerrainTypes.h"

  • FHeightMm type alias

    A height in integer millimetres: the authoritative, serialised and hashed unit.

    = int32_t
  • FRevision type alias

    Monotonic counter, bumped once per published change by FTerrainWorld only.

    = uint64_t
  • FFeatureId type alias

    Identity of a feature in the stack.

    = uint64_t
  • FStrokeId type alias

    Identity of a sculpt stroke, for the bounded undo ring.

    = uint64_t
  • FGroundClass type alias

    Ground class of a cell (rock, soil, clay…).

    = uint8_t
  • FChannelId type alias

    Index of a typed per-cell channel registered on the terrain (paint weights, zoning, soil…).

    = uint16_t
  • FourCC function in OrreryTerrain::Native

    Packs four characters into an owner domain, first character in the high byte (so 'RAIL' reads RAIL in a hex dump).

  • kOwnerDomainRail constant

    The owner domains Orrery reserves (FOwnerId::Domain).

  • kOwnerDomainTerrainEditor constant

    Features authored in the terrain editor mode.

  • FOwnerId struct

    Who owns a feature: opaque to the terrain.

  • FWorldXY struct

    World position in metres, double precision (Large World Coordinates).

  • FWorldXYZ struct

    World point or direction in metres, double precision.

  • ESurface enum

    Which ground a query reads.

  • Canonical function in OrreryTerrain::Native

    The surface a query actually reads: Top is Modified until an extension registers cover.

  • EPrecision enum

    How exact a query answer is.

  • FGroundSample struct

    One ground answer.

  • FGroundHit struct

    Where a ray met the ground.

  • FTileCoord struct

    Integer address of a tile in one layer.

  • FTileRange struct

    Inclusive rectangle of tiles.

  • EChangeCause enum

    Why the ground changed, as reported to listeners and in the change journal (FGroundChange::Cause).

Native/TileSource.h

Experimental

Natural-ground tile source interface (ITileSource), streaming sources and tile load requests.

#include "Native/TileSource.h"

  • ITileSource class

    Supplies natural ground: the cooked tile store in a game; a procedural, heightmap or imported-Landscape source in tests and the editor.

  • FStreamingSource struct

    A place where the ground must be resident at full resolution: a camera, a player, or a simulation invoker (the construction cursor, a vehicle or agent that queries ground).

  • ViewResidencyRadius function in OrreryTerrain::Native

    The residency radius of a view at Height_m above the ground under it: the ground within Radius_m of the camera horizontally and within Reach_m of it in 3D, so a view keeps its near set until that ground is far enough away for the far field to stand in for it, and has none once it is higher than Reach_m.

  • FTileLoadRequest struct

    A tile FTerrainWorld wants loaded.