Contents

The playground

The program editor

Where the flight software is written, kept, launched and debugged: the Program panel, the Docs panel, and the console and charts in Details.

The Program panel holds the flight software: one JavaScript program, with an update(fc) function the simulator calls fifty times per simulated second and, if the booster is to come home, a booster(fc) for it. What goes inside those functions is the subject of the flight program and the reference. This page is about the tools around them.

The Program panel: the program picker reading My first flight, a Revert button and a menu button, the line Based on the Starter template example, the code editor with thirty lines of a flight program, and a status line reading Saved 16:00, Ln 17, Col 7, Ctrl Enter launch
  1. 1The program picker: your programs and the examples.
  2. 2Revert to the example it was made from.
  3. 3More program actions.
  4. 4What the program is, or which example it came from.
  5. 5Line numbers, with fold markers beside the blocks.
  6. 6The code. fc and its members are coloured apart.
  7. 7Saving: Saving…, then Saved and the time.
  8. 8The cursor's line and column.
  9. 9Ctrl Enter launches from the editor.
  10. 10Widen the editor.
A program of your own, made from the starter template. Its status line says it is saved, where the cursor is, and how to launch.

Examples and your programs

The picker at the top of the panel lists two groups. Your programs are the ones you have written or changed. Examples are the ones that ship with the simulator:

The program picker open: Your programs with My first flight ticked, then Examples: Full mission, Hop, Starter template, Moon flyby, Moon landing, Mars flyby and Mars landing
Seven examples, and one program of your own above them.
ExampleWhat it flies
Full mission — orbit & return from anywhereThe reference flight software for Aster: orbit, payload, de-orbit and landing, and booster(fc) bringing the first stage home. The default program.
Hop — suborbital hop to LZ-1The Hopper up past the hop altitude and down onto Landing Zone 1 with a hoverslam.
Starter templateLiftoff and the start of a gravity turn. Everything after that is yours.
Moon flybyThe Odyssey stack from a parking orbit to a close pass of the Moon.
Moon landingThe same, then lunar orbit, de-orbit and a powered descent to the surface.
Mars flybyThe ten-month transfer to a pass over Mars.
Mars landingEntry, descent and landing on Mars with the Odyssey Mars stack.

Under the picker, a line describes the program: an example's own description, two lines of it until you press More, or for one of yours Based on the "…" example.

An example is never overwritten. The moment you edit one, your text is saved as a new program called, say, Full mission — orbit & return from anywhere (edited), a toast says Saved as "…" — the example stays untouched, and the picker switches to it. Until then the status line reads Example — edits are saved as your copy. Because examples are not copied until you change them, a new version of an example reaches you as soon as the simulator ships it.

A program you made from an example remembers which one. Revert replaces its text with the example's current version, after asking; the text you had goes into the program's history first. If the example has changed since you made your copy, the panel says so — The "…" example has been updated since you forked it — and offers Keep mine or Open the new version.

Saving and history

There is no save button, because there is nothing to forget. Every edit is saved in the browser 0.7 s after you stop typing: the status line shows an amber dot and Saving…, then Saved and the time. If the browser refuses the storage, it says Storage unavailable — not saved.

Ctrl S (⌘ S on a Mac) saves at once and also keeps a snapshot of the program in its history. Every launch keeps one too. Each of your programs keeps its last twelve snapshots (examples have no history: they never change), and Restore from history in the program menu lists them by date and length; restoring one first snapshots the text you are replacing, so a restore can itself be undone the same way. On an example you have not touched, Ctrl S has nothing to keep and says so: Nothing to save.

Everything is kept in this browser's storage. To move a program elsewhere, download it or share it.

The program menu

The button beside Revert opens the rest.

The program menu open: New program from the starter, Duplicate, Rename, Delete, Import a .js file, Download as .js, Insert a snippet with its submenu of ten snippets, and Restore from history
The program menu with Insert a snippet open. The snippets marked v2 use flight-computer features added in version 2.
  • New program from the starter asks for a name, then makes a copy of the starter template under it.
  • Duplicate does the same with the current program, offering … (copy) as the name. Cancelling either makes nothing.
  • Rename… and Delete apply to your own programs; Delete asks, and removes the program and its history.
  • Import a .js file… adds a program from a file, and Download as .js saves the current one.
  • Insert a snippet puts a working fragment at the cursor: a state-machine skeleton, a booster skeleton, a hoverslam landing burn, ideal ignition from fc.predict, a de-orbit that waits for the burn to land on target, de-orbit planning with fc.passes, flying towards a target, holding a compass heading, settling the propellant before a relight, and a PID on vertical speed. A fragment of several lines goes on lines of its own.
  • Restore from history, above.

Most of these, and every example, are also in the command palette under Program.

Writing a program

The editor is CodeMirror, set up for JavaScript: line numbers, folding, bracket matching and closing, indentation that follows the braces, several cursors at once, and search. It indents by two spaces.

It knows the flight computer. fc and its members are coloured apart from the rest of the code, and so are the helpers the program can call, such as clamp and PID. Typing fc. lists what comes next, each entry with its unit or its signature, and a card describing the one selected. Pointing at an fc. name in the code shows the same card.

Typing fc.stop in the editor: the completion list offers stopPoint with its signature, and a card beside it describes fc.stopPoint with a v2 tag
Completion after fc.stop. The card is the same entry as in the Docs panel and the reference.
KeysIn the editor
Ctrl EnterLaunch
Ctrl SSave and keep a history snapshot
Ctrl SpaceComplete fc. names
Ctrl /Comment or uncomment the line
Ctrl FSearch
Tab, Shift TabIndent and unindent
Esc, then TabLeave the editor

Tab indents when the cursor is in the leading space of a line or text is selected; elsewhere it moves to the next two-column stop. That is why the keys that leave the editor are Esc and then Tab.

The panel is 400 pixels wide, which cuts long lines. Widen the editor, the arrows at the end of the status line, takes it to 820 pixels, or 60 % of the window if that is less. It only widens the Program panel, and it is remembered.

Errors

The editor compiles the program a moment after you stop typing and underlines the first syntax error; point at it for the message. The launch-readiness card on the pad checks too: Program compiles in green, or the line and the error in red.

Launching compiles again before anything else happens. A program that does not compile does not launch, and the weather seed is not used up, so the next launch still flies the same conditions. Instead the Program panel opens, the line is marked in the gutter, and a bar under the editor gives Line 8 · SyntaxError: … — the line number is a link back to it.

A syntax error on line 8, fc.steer(90; — the line is marked in red and underlined, and the bar under the editor reads Line 8 · SyntaxError: missing ) after argument list

Before launch: the launch stops at the line.

Line 25 marked in red, and the bar under the editor reading Line 25 · Runtime error at T+01:10 — TypeError: Cannot read properties of undefined (reading 'toFixed')

In flight: the first runtime error, with its time.

A missing bracket, and a misspelt fc.dynamicPressure. Editing the program clears the mark; the cross dismisses the bar.

An error while flying is different. The program has already launched, so the flight goes on, but the program stops running for that vehicle: the console reports Flight software crashed on Aster: … The vehicle keeps its last commands, and the vehicle does exactly that. The first runtime error is also marked in the editor, with the mission time it happened at. If the console is not open, the Details button in the top bar gets a red dot and the Console tab a count, until you look.

Launching from the editor

Ctrl Enter launches from inside the editor, without leaving the keyboard. Usually the panel then closes to make room for the flight; pin it — the pin in its header — to keep the code in view while it flies.

Ctrl Enter from the editor, with the panel pinned and Details on the Console. The readiness card warned first: this program has no booster(fc), so the booster will be lost. Real time until liftoff, then ×10.

Editing during a flight changes nothing in the air: the flight runs the program it was launched with, and the panel shows Program edited — launch again to fly it until you do.

Programs from someone else

A program that arrives in a shared link or an imported file is added to your programs, but it is not trusted. It runs inside the page, with the same access as the playground itself, so it does not compile — not even to check it — until you have read it and said so.

The Program panel with an amber notice: This program came from a file. It runs with the same access as this page — read it before you run it. A button reads Trust and run this program.
An imported file. Launching it asks the same question once more.

Trust and run this program clears the flag. Launching an untrusted program asks first — Run a program from someone else? — and editing it yourself also makes it yours.

The Docs panel

The fourth panel on the rail is the flight computer's documentation, inside the app: a guide in five parts — getting started, flying, the Program API, missions and landing, the physics model with its frames and units — a section on what changed from version 1, and the keyboard shortcuts. The chips under the search box jump to each part.

The Docs panel searching for ullage: 4 entries, with the word marked in the guide's section on ullage and relights, in the section on time warp and sleep, and in the Program API entries propellantSettled and fc.ullage

Searching for ullage.

A code sample in the Docs panel with Copy and Insert buttons over its top right corner

Every sample has Copy and Insert.

The search keeps only the paragraphs, list items and table rows that mention it, and marks the matches.

The search filters as you type, down to the individual rows of the API tables, and counts what is left; Esc clears it. Each API entry gives the name, its unit, what it is, its fields and often a one-line example, and entries new in version 2 carry a v2 tag. Every code sample has Copy and Insert: Insert puts it at the cursor in the editor and switches to the Program panel.

The panel is also where the command palette sends a docs search. Choosing an fc name there opens the panel filtered on it, scrolled to its entry. This site's reference has the same entries in one page.

Details: telemetry, charts and console

The Details sheet (T) is where a flight is debugged. Its Telemetry tab is shown in the tour; the other two tabs are the program's.

Charts

Charts plots the vehicle in focus against mission time: altitude with speed, and dynamic pressure with g-load. Each chart has two scales, one on each side, in the colour of its series. Dashed vertical lines mark the main vehicle's major events — liftoff, max-Q, separation, orbit, payload, entry, the landing or the loss. Pointing at a chart draws a crosshair and reads both series at that moment in the legend.

Details on the Charts tab at T+175 s: altitude and surface speed on the upper chart, dynamic pressure and g-load on the lower one, with a crosshair at T+01:12 reading 30.0 kPa and 2.26 g
The reference flight at T+175 s, pointing at max-Q. The g-load drops to zero at staging; the dashed lines are max-Q and separation.

The speed series follows the speed readout in the flight view: click its label there to switch between surface and orbital speed, and the chart switches with it. Samples are taken every half second of mission time, and closer together near the ground; on a long flight the interval doubles each time the chart fills, and the header says what it is now.

Console

Console is everything the flight said, in order, with the mission time: the launch briefing (the vehicle, the weather and whether it is go, the hardware dispersions), the flight's events, the playground's own notes, every fc.log() your program makes, and its errors.

Details on the Console tab: the launch briefing in green and blue, the program's log lines in white, events such as Liftoff, Supersonic and Max-Q, and in red the crash of the flight software with a link to line 25
My first flight at T+74 s. White lines are the program's own fc.log output; the red line links to the error in the editor.

Three filters at the top narrow it: All, Program (your fc.log output and errors) and Events (the flight's events and the playground's notes). The bin clears it. A message repeated many times in a row is shown once with a × count, so a log call inside update(fc) does not bury everything else, and a message from a booster's program carries the booster's name. An error's line number is a link into the editor.

To take the numbers somewhere else, Export CSV on the Telemetry tab saves the flight recorder's samples for the vehicle in focus.