Engine
Core engine identity and utilities. All methods are static.
Engine
Section titled “Engine”Engine.Name()
Section titled “Engine.Name()”Returns: String — The engine name (e.g. "Plume3D").
var name = Engine.Name()Logger.info(name) // "Plume3D"Engine.Version()
Section titled “Engine.Version()”Returns: String — Full version string in YYYYMM.PPP format (e.g. "202601.001").
The parts are zero-padded and the year and month are concatenated, not dot-separated:
a 4-digit year, a 2-digit month, a ., then a 3-digit patch. Version 2026/1/1 is
therefore "202601.001" — not "2026.1.1". This is a single display string, not a
dotted semver, so do not split it on . to recover the components; read
Engine.VersionYear() / VersionMonth() / VersionPatch() instead and compose whatever
format you want.
Logger.info("Plume3D %(Engine.Version())") // e.g. "Plume3D 202601.001"
// Compose a dotted display string from the parts:var pretty = "%(Engine.VersionYear()).%(Engine.VersionMonth()).%(Engine.VersionPatch())"Logger.info(pretty) // "2026.1.1"Engine.VersionYear() / Engine.VersionMonth() / Engine.VersionPatch()
Section titled “Engine.VersionYear() / Engine.VersionMonth() / Engine.VersionPatch()”Returns: Num — Year, month, and patch components of the version number.
var year = Engine.VersionYear() // e.g. 2026var month = Engine.VersionMonth() // e.g. 1var patch = Engine.VersionPatch() // e.g. 1Engine.screenshot(path)
Section titled “Engine.screenshot(path)”Returns: Bool — true if the screenshot request was queued successfully.
Parameters:
path(String) — Path relative to the project root where the image will be saved (e.g."screenshots/frame.png").
Queues a screenshot to be written at the end of the frame. Supported image format depends on the build (e.g. PNG).
if (Engine.screenshot("screenshots/frame_001.png")) { Logger.info("Screenshot queued")}Engine.exit(code)
Section titled “Engine.exit(code)”Returns: Null.
Parameters:
code(Num) — The requested process exit code, clamped to0–255.0means success.
Requests termination of the run. The request is record-and-honor: it is noted immediately but acted on at the next safe point, so code after the call still runs to the end of the current method.
- Normal (windowed) run — the run ends cleanly at the end of the current frame;
the process exits successfully for code
0and with a failure status otherwise. - Headless test mode (
plume3d --test) — the exact0–255value becomes the process exit status. See the Testing guide.
if (saveAndQuitRequested) { Engine.exit(0) // quit cleanly at the end of this frame}Engine.entropy()
Section titled “Engine.entropy()”Returns: Num — A non-deterministic, non-negative 53-bit integer in
[0, 9007199254740991] (2^53 - 1 — the largest integer a Wren Num holds exactly).
Draws from the OS entropy source (std::random_device) and mixes in the
high-resolution clock, so the result stays well-distributed even on platforms where
random_device is weak. Every call returns a fresh value; it takes no seed.
Do not confuse this with Random — they are opposites. Random is a
frozen deterministic contract: the same seed always replays the same sequence, on
every platform. Engine.entropy() is non-deterministic and cannot be reproduced or
replayed — nothing derived from it will be identical across two runs. Use it for values
that must be unique (install ids, session handles, a one-off seed); use Random for
anything that must be reproducible (daily seeds, save profiles, deterministic runs).
Not cryptographic. The mix is fast and well-distributed, not hardened, and 53 bits is small by security standards. It is fine for values that must be unique but need not be secret. Do not use it for passwords, auth tokens, or anything whose safety depends on an attacker being unable to predict the value.
// A unique id — differs on every install, every run.var installId = Engine.entropy()
// Entropy is also how you start a deterministic run from an unpredictable seed:// the seed is random, but once chosen the sequence replays exactly. Log the seed// and you can reproduce the run later.var seed = Engine.entropy()Logger.info("run seed: %(seed)")var rng = Random.new(seed)Added in ADR 0009 (2026-07-10).
See Logger for logging. See Shader for the shader resource returned by Graphics.loadShader. See Random for seeded, deterministic random numbers.