Skip to main content

Module run

Module run 

Source
Expand description

The runtime player path. Loads compiled blob data and drives the system loop. Fully synchronous – no Tokio runtime here. Systems that need async (HttpServerSystem, LlmSystem, etc.) spin up their own runtimes internally.

On macOS the world loop is driven by CFRunLoopRunInMode so that AppKit (GLFW window creation, Metal pipeline compilation, event dispatch) can process its callbacks on the main thread each tick. On all other platforms a tight Rust loop is used, which is what VulkanRenderer expects.

This is the cn run path only: no debug server, no WebSocket command channel, no in-memory rebuild. A shipped run is neither remotely inspectable nor remotely driven. The interpreted (cn debug) path with hot-reload and the command channel lives in the editor crate.

Structs§

RunOptions
Runtime launch options beyond the world itself.

Enums§

BlobSource
Where a shipped app’s compiled world sits. Both forms make the same file blob 0; they differ in whether the world is allowed to spill into overflow payload blobs, which are always siblings named by index.
PipelineMode
Whether the runtime overlaps simulation and rendering on separate threads (the default) or steps both serially on the main thread (the editor’s mode, and cn run --serial for A/B comparison and as an escape hatch).

Functions§

init_logging
Install the global tracing subscriber. The single place the log level is configured: the CLI entry points call it directly, and the FFI entry point (cn_init) calls it for the macOS app. Safe to call once per process. The crash ring layer rides along so crash reports carry the recent log lines.
run
Production entry point (cn run). Reads the compiled binary blobs from tree’s data/, written by a prior cn build. No debug server, no WebSocket command channel: a shipped run is neither remotely inspectable nor remotely driven.
run_from
Production entry point for a shipped app: like run, but with the world read from blob rather than from tree’s own data/. The tree (beside the executable or inside an app bundle) still holds saves/ and settings, so pointing the player at a blob elsewhere never relocates what it writes. A missing blob is a hard error rather than a silent no-op – a packaged app without its data cannot do anything useful. The concinnity-run binary calls this.