Script the simulator

The simulator at /teskooano/ can be driven from JavaScript in the page: from the browser console, a Playwright or Puppeteer script, or an AI agent controlling a browser. This page covers what works today and how to use it. The MCP server is the other way in: it builds and analyses systems on teskooano.space without a browser.

Open a system by URL

The simplest script is a link. Every view below can be opened, reloaded and shared:

URL Opens
/teskooano/ The library, or the last system if Settings › Start says so; Sol on the very first visit
/teskooano/c/{slug} A catalogue system, such as /teskooano/c/trappist-1
/teskooano/seed/{seed} A generated system; the same seed gives the same system
/teskooano/s/{id} A saved system: yours, or anyone’s if it is public

Once the app has started, these hand over to its own hash routes: /teskooano/c/sol?focus=earth becomes /teskooano/?focus=earth#/c/sol. The hash routes work as links too, and moving between them needs no page load:

Hash Opens
#/library The Systems library over the open system
#/library/{section} The library at catalogue, yours, seed or recent
#/c/{slug} A catalogue system
#/s/{id} A saved system
#/s/{id}/edit Reserved for the editor; opens the saved system for now
#/seed/{seed} A generated system

Opening a system any way, from the library or a script, adds a history entry, so the browser’s back and forward move between the systems and the library. A system that can’t open, such as one that needs a plan, opens the library with the reason and leaves the address on the open system.

Add any of these parameters:

Parameter Does
focus={body} Puts the camera on a body, by id or name (any case), with no flight
distance={radii} How far out, in the body’s radii (default 3)
side=day day (the default, 30° off the star), terminator (half lit) or night (rim-lit, the star behind)
lat={deg}&lon={deg} Looks straight down on a place instead, north and east positive, and turns with the body; ignores side
ui=off Opens in photo mode: only the scene shows
renderer=webgl Draws with WebGL instead of WebGPU, to compare

For example, /teskooano/c/sol?focus=saturn&distance=4&side=terminator&ui=off opens Saturn half lit, with nothing but the scene. A bad value is ignored rather than refused.

Longitude 0° is where the globe faced at simulation time zero, not a real map’s prime meridian: surfaces are procedural.

Wait for the app, then for the scene

The app sets window.teskooano once it has started. Nothing announces it, so wait for it to appear:

while (!window.teskooano) await new Promise((r) => setTimeout(r, 200));

Then wait for the scene before you trust what’s on screen. While a system loads, the loading screen shows photos of planets: they are pictures, not the live engine.

await window.teskooano.whenReady();

whenReady() resolves once a system has loaded and every world is drawn in full: surfaces baked, close-up detail built, nothing streaming in, and quiet for half a second. The <html> element has a data-engine-ready attribute while that holds, and loses it as soon as new work starts, such as after a camera move. In Playwright:

await page.waitForSelector("html[data-engine-ready]");

Functions

The app’s actions are functions you call by name:

const result = await window.teskooano.pluginManager.execute("camera:view", {
  body: "mars",
  distanceRadii: 2,
  side: "day",
});
// { success: true, message: "Viewing Mars." }
Function Arguments Does
camera:view { body, distanceRadii?, side?, lat?, lon? } Puts the active view’s camera on a body, as the URL parameters do
camera:saveView { name } Saves the active view’s camera as a named view of this system (paid plans)
camera:listViews none Lists this system’s saved views
camera:goToView { id, jumpTime? } Returns to a saved view
camera:renameView { id, name } Renames a saved view
camera:deleteView { id } Deletes a saved view
camera:viewLink { id } A link that opens this system on that view
system:loadCatalogue { slug } Opens a catalogue system
system:loadSaved { id } Opens a saved system: yours, or anyone’s if it is public
system:generateRandom { seed? } Generates a system from a seed, or a random one
system:loadFile { file } Opens a system file you pass in, after checking it
system:getOpen none Names the open system, where it came from and its hash route
system:listRecent none Lists the systems opened on this device, newest first
library:open { section? } Opens the Systems library, at a section such as recent
view:addCompositeEnginePanel none Opens another engine view, up to your plan’s limit; see Your plan’s limits
account:getLimits none Your plan and its limits; see Your plan’s limits
view:togglePhotoMode none Turns photo mode on or off
view:capture { width?, height?, longEdge?, hideInterface? } Saves a PNG of the active view; see Screenshots
view:startRecording { width?, height?, longEdge?, fps? } Starts recording the active view as video
view:stopRecording none Stops the recording and returns the video
tour:start { tourId? } Starts the guided tour
help:openFeedback none Opens the feedback form

The system, library and camera functions answer { success, message }, and the system ones add a symbol for the toast they show. system:getOpen and system:listRecent put what they read in data:

const { data } = await window.teskooano.pluginManager.execute("system:getOpen");
// { name: "Sol", source: { kind: "catalogue", slug: "sol" }, route: "#/c/sol", ... }

Systems opened recently are kept on the device, so system:loadCatalogue and system:loadSaved open them offline too. They report a body or system they can’t find as success: false rather than throwing. Calling a name that doesn’t exist returns undefined and logs an error.

To list every function the running app has registered:

window.teskooano.pluginManager
  .getPlugins()
  .flatMap((plugin) => (plugin.functions ?? []).map((f) => f.id));

Names ending in :initialize set the app up at start-up; don’t call them.

Your plan’s limits

account:getLimits reports the plan the app is running under and what it allows, so a script or agent can check before it asks for more:

const { data } =
  await window.teskooano.pluginManager.execute("account:getLimits");
// {
//   tier: "explorer",          // public signed out, free, adventurer, explorer or pioneer
//   account: "signed-in",      // or "signed-out", or "none" in the standalone app
//   source: "server",          // "server": the site's figures; "tier": the plan's defaults
//   limits: {
//     engineViews: 6, bodyCap: 250, savedSystems: 1000,
//     storageBytes: 1073741824, documentBytes: 1048576, versions: 100,
//     savedViews: 200, photoLongEdge: 3840, videoLongEdge: 3840,
//     sourcesPerDay: 75, apiUnitsPerMonth: 10000, apiUnitsPerDay: 1000,
//   },
//   entitlements: [{ plan: "explorer", source: "subscription", expiresAt: null }],
// }

A limit of null means none beyond what the device can do, except photoLongEdge, where null is screen-size photos only, and videoLongEdge, where it is no video. Sizes are in pixels along the longest edge, and storage in bytes. The figures come from the site when it sends them, and otherwise from the plan as the plans page lists it.

The app holds to these limits itself. view:addCompositeEnginePanel past engineViews opens no view: it answers { success: false, reason: "engine_view_limit", message } and shows the upgrade dialog. Signed out, Teskooano is a viewer: the editor, saved views, your systems and new systems from a seed are hidden.

Editing a system

The editor’s functions build and change the open system, with the same operations as the MCP system_edit tool: add_star, add_body, update_body, set_orbit, remove_body and rename, in the same units.

const { pluginManager } = window.teskooano;
await pluginManager.execute("editor:enter");
const star = (await pluginManager.execute("editor:getSession")).data.session
  .file.objects[0].id;
await pluginManager.execute("editor:apply", {
  ops: [
    {
      op: "add_body",
      name: "Aster",
      type: "PLANET",
      parentId: star,
      mass: { earth: 1 },
      radius: { earth: 1 },
      orbit: { semiMajorAxis_au: 1.2 },
    },
  ],
});
await pluginManager.execute("editor:undo");
Function Arguments Does
editor:enter none Switches to Edit and pauses the simulation, if your plan allows it
editor:exit none Done: back to View, with the simulation running. The edits stay
editor:apply { ops } Applies builder operations as one change and redraws; all apply or none do
editor:undo none Undoes the last change
editor:redo none Redoes the change undone last
editor:play { running? } Runs the edited system without leaving Edit, or pauses it with false
editor:setNote { note } Sets the note kept with the version when the edits are saved
editor:discard none Throws the edits away and shows the system as it was opened
editor:getSession none The mode, whether the editor opens and why not, and the session

Each answers { success, message, reason?, data? }. data is the edit session: the system as opened (base), the operations since (ops), the result (file), the note, whether there is anything to save (dirty), the body count and your plan’s cap. A refusal says why in reason:

  • sign-in: the editor needs an account.
  • upgrade: the system has more bodies than your plan edits; it opens in View.
  • body_limit, kind_limit: the change would pass your plan’s body cap, or add a black hole, neutron star, giant star or iron world on a free plan.
  • invalid: an operation didn’t apply; message says which and why.
  • not-editing: call editor:enter first.

Free accounts edit up to 15 bodies; Adventurer 100, Explorer 250, and Pioneer and Perpetual have no cap. The edits are kept on this device until they’re saved or discarded, so they survive signing in or upgrading.

Screenshots

Photo mode hides the header, the tool groups, the side panel, notifications, labels, AU rings, orbit lines and the grid, leaving only the scene. It doesn’t change any view’s saved settings, and ends with Esc (H toggles it). Open the page with ui=off, or call view:togglePhotoMode; the <html> element has a data-photo-mode attribute while it is on.

view:capture saves a picture of the active view. It waits for the view’s next frame, then draws that frame again at the size you ask for, with the same colours and glow as the screen, so you get the scene as it is now rather than the frame before your last change:

const { success, message, data } = await window.teskooano.pluginManager.execute(
  "view:capture",
  { width: 3840, height: 2160, hideInterface: true },
);
// data: { blob, width, height, mimeType: "image/png" }
  • With no size, the picture is the view’s own size in device pixels.
  • Give width and height, one of them (the other follows the view’s shape), or longEdge for the view’s shape at that length: { longEdge: 3840 } is 3840 × 2160 from a 16:9 view.
  • hideInterface: true hides orbit lines, the grid and markers for the picture, as photo mode does, and brings them back afterwards. Labels are never in the picture.
  • A size larger than your plan allows is made smaller, keeping its shape, and message says so.
Plan Photos Video
Signed out and Free The view’s size None
Adventurer Up to 2K (2560 px) Up to 2K
Explorer Up to 4K (3840 px) Up to 4K
Pioneer, Perpetual Up to 8K (7680 px) Up to 8K

Sizes are the longest edge, and paid plans always get at least the view’s own size for photos. Your graphics card can set a lower limit; most draw up to 8192 pixels.

To record video, start and stop it:

const pm = window.teskooano.pluginManager;
await pm.execute("view:startRecording", { longEdge: 2560, fps: 30 });
// ...move the camera, run the simulation...
const { data } = await pm.execute("view:stopRecording");
// data: { blob, width, height, mimeType: "video/webm" }

While it records, the view draws at the recording’s size and shows it scaled to fit, so a recording in a different shape from the view shows bars at the sides. Recording is WebM, at up to 60 frames a second, and needs a browser that can record a canvas. The photo and video button in the tool groups does the same and downloads the file.

For a clean, repeatable shot:

  1. Open the system with focus, distance and side (or lat and lon) and ui=off.
  2. Wait for window.teskooano and then whenReady().
  3. Call view:capture, or take the screenshot with your browser tooling.

Sol, a catalogue system or a fixed seed gives the same scene every time. The simulation keeps running, so for a still frame of a fast moon, capture as soon as the scene is ready.

Settings

Settings the player picks, such as the sky, lens flare and trail length, are saved in the browser and, when signed in, to their profile. A script that changes them through the Settings panel changes them for that player, so reset what you change.

Original