EpochSim.Serialization 0.2.0

dotnet add package EpochSim.Serialization --version 0.2.0
                    
NuGet\Install-Package EpochSim.Serialization -Version 0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EpochSim.Serialization" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EpochSim.Serialization" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="EpochSim.Serialization" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EpochSim.Serialization --version 0.2.0
                    
#r "nuget: EpochSim.Serialization, 0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EpochSim.Serialization@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EpochSim.Serialization&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=EpochSim.Serialization&version=0.2.0
                    
Install as a Cake Tool

EpochSim

Deterministic tick simulation engine for .NET 10.

Recommended package for embedding:

dotnet add package EpochSim

EpochSim.All is useful when you want one dependency that brings the full module graph (EpochSim, Execution, Serialization, Observability, Kernel):

dotnet add package EpochSim.All

Russian version: README.ru.md

State-Only Quickstart (No Events, No Codecs)

using EpochSim;

var state = new WorldState();
var engine = Epoch.CreateEngine<WorldState>();
engine.AddSystem("World", tick: ctx => ctx.State.Population++);

using var run = Epoch.QuickRun(state, rootDir: "artifacts");
engine.Attach(run);
engine.RunTicks(state, seed: 1, endTickInclusive: 100);

Console.WriteLine(state.Population);

public sealed class WorldState
{
    public int Population { get; set; }
}

This is the fastest path: useful artifacts, deterministic run, almost zero wiring.

QuickRun:

  • Best for first use and basic debugging.
  • Enables deterministic run metadata + snapshots + state fingerprints + trace.
  • No event codec required.
using var run = Epoch.QuickRun(state, rootDir: "artifacts");

RecommendedRun:

  • Best for real debugging in apps and services.
  • Enables fingerprints + snapshots + trace + profiling + failure artifacts.
  • No codec required for this baseline.
  • Add invariants when needed.
using var run = Epoch.RecommendedRun(state, rootDir: "artifacts", invariants: null);

Advanced overloads stay available when you want full control:

  • Epoch.RecommendedRun(state, codec, serializer, rootDir, invariants)
  • EpochSimRun.For(state)...Build()

Event Log / Replay (Use When You Need Replay/Bisect)

Event log is optional and intended for replay workflows (verify-run, bisect, fast-replay).

using EpochSim;
using EpochSim.Kernel.Messaging;

var codec = Epoch.JsonCodecFromAssembly<Program>(t => t == typeof(Changed));
var serializer = Epoch.JsonStateSerializer<WorldState>();

using var run = Epoch.RecommendedRun(state, codec, serializer, rootDir: "artifacts");
[MessageKind("Changed")]
public sealed record Changed(int Delta) : IEvent;

RunTicks vs Session

Use RunTicks for batch jobs:

engine.RunTicks(state, seed: 1, endTickInclusive: 1000);

Use SimulationSession<TState> for long-lived loops (games, servers, interactive stepping):

var inbox = new CommandInbox();
engine.AttachInbox(inbox);

using var session = engine.CreateSession(state, seed: 1, startTick: 0);
inbox.Enqueue(new AddPopulation(5));
session.TickOnce();
session.RunUntil(100);
using EpochSim.Kernel.Messaging;
[MessageKind("AddPopulation")]
public sealed record AddPopulation(int Delta) : ICommand;

External Input Pattern (HTTP/UI/Queue → Sim)

Use inboxes to feed external commands deterministically into the sim thread:

  • CommandInbox: commands for the next tick.
  • ScheduledCommandInbox: commands scheduled at a specific tick with stable ordering:
    • primary key: tick ascending
    • secondary key: insertion order
var scheduled = new ScheduledCommandInbox();
engine.AttachScheduledInbox(scheduled);

scheduled.Enqueue(10, new AddPopulation(3));
scheduled.Enqueue(10, new AddPopulation(7));
scheduled.Enqueue(12, new AddPopulation(1));

See full integration recipes: Embedding

CLI Onboarding

Create a starter app:

dotnet run --project src/EpochSim.Cli -- init .

Run and inspect artifacts:

dotnet run --project src/EpochSim.Cli -- run artifacts
dotnet run --project src/EpochSim.Cli -- list-runs artifacts
dotnet run --project src/EpochSim.Cli -- inspect-run artifacts <runId>

Determinism debugging:

dotnet run --project src/EpochSim.Cli -- verify-run artifacts <runId>
dotnet run --project src/EpochSim.Cli -- bisect artifacts <runId>

Samples

  • Recommended simple sample: src/EpochSim.Samples/Quickstart/QuickstartSample.cs
  • Advanced/legacy domain sample: src/EpochSim.Samples/Population/ (event-heavy diagnostic domain)

Build and Test

dotnet build EpochSim.slnx -m:1
dotnet test EpochSim.slnx -m:1

Docs

English:

Russian:

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on EpochSim.Serialization:

Package Downloads
EpochSim.All

Batteries-included meta-package for EpochSim that references the complete module set (facade, engine, serialization, observability, kernel).

EpochSim.Execution

Simulation engine and execution pipeline for EpochSim, including replay, snapshots, and run limits.

EpochSim

Facade-first package for EpochSim: ergonomic entrypoints, quick presets, and minimal wiring for deterministic runs.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 117 2/7/2026
0.1.0 110 2/4/2026