A module is the adapter that reads your engine’s file format. Headless mode still needs a graphics driver.
dotnet tool install -g RecursiveAI.OneScope.ToolRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
unzip load-custom-replay-module-from-dll.zip -d replay-example cd replay-example dotnet build Module -o obj/module onescope open counter.sim --headless --module obj/module/CounterModule.dll
Unzip the example, then dotnet run.
On Windows, you can extract the zip in File Explorer, then run the build and open commands from the extracted folder in PowerShell or cmd.
The onescope open command prints this JSON (formatted here with the absolute path abbreviated):
{ "source": 0, "name": "counter.sim", "path": "<absolute path to counter.sim>", "module": "counter", "dimensions": 2, "unit": { "name": "m", "metres": 1 }, "startStep": 0, "steps": 3, "axes": [ { "id": "time", "name": "Time", "length": 3, "position": 0 } ], "overlays": [ { "id": 0, "name": "Counter", "defaultOn": true } ], "tracks": [], "pokes": [], "label": "counter.sim", "step": 0, "hash": "00000000000003e8", "keyframeInterval": 64, "scannedThrough": 3, "views": 2 }
With your own module, pass the path to its DLL in its build output folder.
On Linux, headless rendering can use a Vulkan device or a software renderer such as lavapipe.
The full program
The launcher installs OneScope locally, builds the DLL with RecursiveAI.OneScope.Sdk 1.0.0, and opens this counter.sim from the zip:
{"entities":1,"bias":0}This is the sample module’s format, not a generic OneScope replay format. The file sets up one counter with an initial value of zero. The module supplies three recorded steps and advances the counter by one on each step. Its entry point is in Module/CounterModule.cs: CounterModule implements IScopeModule and returns a source with the recording when Open accepts those bytes. To add the contract to your own module project:
dotnet add package RecursiveAI.OneScope.Sdkusing System.Diagnostics; using System.Text.Json; const string module = "obj/module/CounterModule.dll"; string tools = Path.GetFullPath("obj/tools"); string tool = Path.Combine(tools, OperatingSystem.IsWindows() ? "onescope.exe" : "onescope"); if (!File.Exists(tool)) Run("dotnet", "tool", "install", "RecursiveAI.OneScope.Tool", "--tool-path", tools, "--version", "1.0.0"); Run("dotnet", "build", "Module", "-o", "obj/module"); string output = Run(tool, "open", "counter.sim", "--module", module, "--headless", "--run", "sources"); using var json = JsonDocument.Parse(output.Split('\n')[0]); var replay = json.RootElement; Console.WriteLine($"Module: {replay.GetProperty("module")}"); Console.WriteLine($"Recorded steps: {replay.GetProperty("steps")}"); static string Run(string command, params string[] args) { var start = new ProcessStartInfo(command) { RedirectStandardOutput = true }; foreach (string arg in args) start.ArgumentList.Add(arg); using var process = Process.Start(start)!; string output = process.StandardOutput.ReadToEnd(); process.WaitForExit(); if (process.ExitCode != 0) throw new InvalidOperationException($"{command} failed: {output}"); return output.TrimEnd(); }
Module: counter Recorded steps: 3
If the DLL path is wrong, the tool returns not_found; if no loaded module accepts the replay bytes, it returns bad_format with the modules’ complaints.
Variations
Open the recording with the same DLL and seek to step 2:
onescope open counter.sim --headless \ --module obj/module/CounterModule.dll \ --run 'seek {"step":2}'
The last result contains "step":2. To play or scrub interactively, omit --headless and the --run operation.
Related recipes
The short answer
Build an assembly against RecursiveAI.OneScope.Sdk and pass its path to onescope open with --module. OneScope loads the assembly in its own load context and offers the recording to the loaded modules. The successful JSON result names the module that accepted the recording. It reports the module id (counter here), not the DLL filename.
How do I load a DLL into OneScope?
Start with a module that implements IScopeModule, not the simulation engine’s DLL on its own. The module is the adapter: its Open method reads the engine’s format and returns an IScopeSource. That source supplies the recording and creates a world. The world implements operations such as advancing one step, taking a snapshot, and exposing entity properties to the inspector. The shell doesn’t interpret the simulation’s per-step inputs itself.
Use the build output folder when loading a module with extra dependencies. The module authoring guide says the framework, OneGame and the SDK assembly are shared with the host; the module’s other dependencies load from its own folder. Separate load contexts let you load two builds of a module without putting their different dependency versions in one directory.
Why won’t my custom replay DLL load?
Separate a DLL-loading failure from a replay-opening failure. For not_found, check that the path points to the built .dll rather than the project file or its folder. For bad_module, inspect the message and check that the assembly implements the SDK contract and that its dependencies are next to it. If you get bad_format, the file reached a module but none of the loaded modules accepted its bytes. Check the recording’s format and the version the module expects rather than renaming the replay file.
If the command succeeds but reports another module id, that other module accepted the file. --module adds a module; the shell’s initial open uses the first loaded module that accepts the recording. To explicitly choose a module for a subsequent open operation, pass moduleAssembly in that operation’s JSON, as in the library version comparison recipe.