Class CommandLog
- Namespace
- TDMaker.Core
- Assembly
- TDMaker.Core.dll
Fixed-capacity input recording with seed and versioned binary persistence. Record only external Enqueue calls between ticks.
public sealed class CommandLog
- Inheritance
-
CommandLog
- Inherited Members
Examples
var log = new CommandLog(sim.Seed); sim.StartRecording(log); /* enqueue and step */ sim.StopRecording(); log.WriteTo(stream);
Remarks
Recreate identical templates, initial spawns and extensions before replay. Commands generated inside Step are regenerated by their systems. Saving and loading allocate outside Step; custom commands require an ICommandCodec.
Constructors
CommandLog(uint, int)
Preallocates a command recording.
public CommandLog(uint seed, int capacity = 4096)
Parameters
Properties
Capacity
Maximum inputs without growing storage.
public int Capacity { get; }
Property Value
Entries
Records in submission order; ticks are nondecreasing.
public IReadOnlyList<CommandRecord> Entries { get; }
Property Value
IsSealed
Whether recording has ended and the log can be replayed or saved.
public bool IsSealed { get; }
Property Value
Seed
Original simulation seed.
public uint Seed { get; }
Property Value
UpgradeFingerprint
Permanent-upgrade setup fingerprint captured at recording start; zero identifies an unmodified legacy setup.
public ulong UpgradeFingerprint { get; }
Property Value
Methods
ReadFrom(Stream, ICommandCodec, int)
Loads a sealed log without closing the caller's stream. The limit bounds input count; custom codecs validate their own payloads.
public static CommandLog ReadFrom(Stream stream, ICommandCodec customCodec = null, int maximumEntries = 1000000)
Parameters
streamStreamcustomCodecICommandCodecmaximumEntriesint
Returns
WriteTo(Stream, ICommandCodec)
Writes the complete sealed log without closing the caller's stream.
public void WriteTo(Stream stream, ICommandCodec customCodec = null)
Parameters
streamStreamcustomCodecICommandCodec