<!-- GENERATED by starlens/site/tools/reference_pages.py from the engine's sources: do not edit; run it. -->

[[nav: reference | here=start]]

<div class="doc">

<!-- Start here: the twin in a page. A guide of the reference, written by hand (2026-11-05; the words are a DRAFT for
     the operator, ruling 30). tools/reference_pages.py wraps it as the reference's pages are wrapped (the tree, the
     doc's column, the plaintext line, the pager); its links are page-relative from reference/guides/start/. -->
# Start here: the twin in a page

<p class="plain"><a href="../../guides/start.md">this page as plaintext</a></p>

The twin is the reference simulation, the same rules the console's worlds run, built as one WebAssembly module of
434,093 bytes (162,549 brotli'd). A world is a grid of integer words, one a cell, and a step is a pure function of the
last: the same world, the same ops at the same frames, the same digest, on any machine. That is the contract every
example on these pages stands on, and the one the replay below tests.

This is the twin, running in this page. It opened a 64-cell cube with a sea, an island and a spring, and steps it
twenty times a second on a worker; the line under it is its frame, the first eight hex digits of its digest, and what
it holds.

[[view: step | caption=The cube, live: its spring runs over the island into the sea]]

## Three ways in

- **A world someone made**: `[[world: <cart>]]` in a page mounts the player on a cart, a world's files and its
  record, with the replay witness the site checked when it built ([the player](../../player/)).
- **A demo**: `[[view: <id>]]` mounts the view you are looking at, on a world, the ops laid on it and the steps it runs
  before you see it. The demos are listed in the engine's own table, `web/api.json`, beside the exports they show
  ([the engine](../../engine/)).
- **By hand**: the worker is a plain message protocol ([the worker](../../worker/)). Open a world, change it, step
  it, run it, read its state back (this fence is written by tools/reference_pages.py from the demo `op-sphere` in
  the engine's `api.json`, its world and its op, so the code shown and the view under it cannot part):

<!-- fence: demo op-sphere js -->
```js
// from a page at the site's root; the worker fetches, so it is given whole addresses
const at = (p) => new URL(p, document.baseURI).href;
const worker = new Worker(at("media/toys/lab-worker.js"), { type: "module" });
worker.onmessage = (e) => {
  const m = e.data;
  if (m.type === "state" && m.opened) {
    worker.postMessage({ type: "op", op: { op: "sphere", x: 32, y: 8, z: 32, r: 4, mat: 2 } });   // the demo's op, at frame 0
    worker.postMessage({ type: "run", on: true });
  }
  if (m.type === "state") console.log(m.frame, m.digest, m.census);
};
worker.postMessage({
  type: "open",
  wasm: at("media/world-rt/starlab_wasm.wasm"),
  files: { "meta.lua": at("media/house/worlds/cube/meta.lua"), "grid.png": at("media/house/worlds/cube/grid.png") },
  lay: at("media/house/worlds/cube/lay.json"),
});
```
<!-- /fence -->

That script is this demo: a sphere of water, radius 4, dropped over the island at frame 0.

[[view: op-sphere]]

## Tell it from a card

A StarScript card reaches the page it is on: `set tell.world "meteor"` is a value kept like any other, and told to the
page as it is set. Here the live view answers it: a meteor drops a ball of lava, a comet one of ice, a flash flashes
the view. Press Play on the card, with the view below it in sight.

[[board: ref-tell-world | w=fill]]

[[view: tell | caption=The view the card tells]]

## Replay it

A tape is the world as it opened and every op at its frame. Laid on a fresh world and stepped to its last frame, it
gives the digest it was taken with, or it is not the same world: a reader refuses an op it does not know, by name,
rather than skip it ([the tape's format](../../formats/world-tape/)). This one is two ops, lava at frame 30 and ice at
frame 90, laid and stepped to frame 200.

[[view: load-tape]]

## Where next

The tree on the left is the whole reference, folded: [the engine's exports](../../engine/), [the worker's
messages](../../worker/), [the view's look](../../view/), [the board's runtime](../../board/), [StarScript's
verbs](../../starscript/), [the formats](../../formats/world-tape/) and [the apps' verbs](../../verbs/). Every page
has a plaintext twin, the link under its title, for a reader that wants the words without the page.

<details class="changes">
<summary>The work on this page: the commits of the last 30 days on its sources, the work open against them, its checks</summary>

[[timeline: src=starlens/site/reference-prose/guides/start.md | kinds=commit | days=30]]

[[work: open | src=starlens/site/reference-prose/guides/start.md]]

[[work: checks | rows=lint/web-reference]]

</details>

<nav class="pager"><a href="../../">← index</a><a href="../../">The reference</a><a href="../../engine/">engine →</a></nav>

*Generated by `tools/reference_pages.py` from `reference-prose/guides/start.md (by hand; its fences from their sources)`; the twin `bfaad079a7ce` (434093 bytes). The words are a draft.*

</div>
