A flight program sees the vehicle through one object, fc, passed to
update(fc) fifty times per simulated second and to booster(fc) for each
separated stage. This page lists everything on it. It is drawn from the
simulator's own source — the flight computer and the structured reference its
editor completes from — not from memory; where the two disagree, or where
behaviour could not be confirmed, the entry says so.
The flight program explains the contract around
update(fc), and steering and guidance the guidance planes
in depth. The conventions below are what you need to read the tables.
Conventions
- Units are SI — metres, seconds, kilograms, newtons, pascals — unless a
row says otherwise. Angles are in degrees.
- Readings are sensed. With the mission's sensors set to realistic or hard,
every reading and every prediction is the flight computer's navigation
estimate, not the truth. With ideal sensors (the default) they are the truth.
- The guidance plane. Pitch, yaw and every along-track quantity are
measured in a guidance plane, a great circle with a forward direction, chosen
with
fc.setPlane(). On the default 'launch' plane forward is the launch
azimuth.
- Signs. Every along-track quantity is + forward:
horizontalSpeed,
target.distance, every error (+ means long, beyond the target). Every
crossrange is + right of forward. miss is the total distance.
- Commands only act inside
update or booster. Called from anywhere
else — a timer, a resolved promise — they throw.
- Rows marked “new” were added after the original planar simulator, or
changed meaning with the move to three dimensions. Everything else keeps its
original name and meaning, with “east” read as “forward in the guidance
plane”.
Time and identity
| Field | Unit | Meaning |
|---|
fc.t | s | Mission elapsed time. |
fc.dt | s | The control period, equal to the simulation step: 0.02 s in the app. Integrate with it rather than a constant. |
fc.name | | The vehicle's name. |
fc.stageNumber | | Design index, from 1, of the current bottom stage. |
fc.stageCount | | Stages still attached. |
fc.payloadAttached | | The payload is still on top. |
fc.fairingAttached | | The payload fairing is still on. |
fc.mission | object | The mission, frozen at launch, so one program can adapt to it. Fields below. New. |
fc.site | object | The launch site, the same object as fc.mission.site. New. |
fc.mission.… | Unit | Meaning |
|---|
profile | | 'orbital', 'rtls' (return to launch site) or 'hop'. |
target | | The main vehicle's landing platform: 'LZ-1' or 'SHIP'. |
boosterTarget | | The first target of separated stages; 'rtls' forces 'LZ-1'. |
hopAltitude | m | The altitude a hop must pass. |
shipDistance | m | The drone ship's station, downrange along the launch great circle. |
shipCrossrange | m | Its offset from that great circle, + right. New. |
sensors | | 'ideal', 'realistic' or 'hard'. |
site | object | { name, latitude, longitude, elevation }: degrees, and metres above the ellipsoid. New. |
azimuth | ° | The launch azimuth, clockwise from north. New. |
fidelity | | 'classic' on the classic equatorial range, 'realistic' everywhere else. New. |
The destination and arrival of a Moon or Mars mission are not in
fc.mission; read fc.destination and fc.plan.arrival.
Position and velocity
| Field | Unit | Meaning |
|---|
fc.altitude | m | Height of the vehicle's base above the reference ellipsoid — WGS84 on Earth, not sea level and not a sphere. |
fc.radarAltitude | m | The lowest point, feet or nozzles, above whatever is below: ground, deck or sea. |
fc.verticalSpeed | m/s | Surface-relative, + up. |
fc.horizontalSpeed | m/s | Surface-relative speed along the guidance plane, + forward. Sideways motion shows in fc.heading and fc.progradeYaw. New meaning. |
fc.surfaceSpeed | m/s | Speed relative to the rotating ground, all three components. |
fc.orbitalSpeed | m/s | Inertial speed. |
fc.latitude | ° | Geodetic latitude, + north. New. |
fc.longitude | ° | Longitude, + east, in (−180, 180]. On the classic range the pad is at 0. New meaning. |
fc.downrange | m | Surface distance from the pad along the launch great circle, + along the launch azimuth, whatever the guidance plane. |
fc.crossrange | m | Distance of the sub-point from the guidance great circle, + right. Always about zero on a { target } plane, which passes through the vehicle. New. |
fc.heading | ° | Compass heading of the surface velocity; fc.azimuth when the vehicle is nearly at rest. New. |
Attitude
Pitch is the nose's angle above the local horizon measured in the guidance
plane towards forward: 90 is straight up, 0 forward, 180 backward, −90 down,
wrapped to (−180, 180]. Yaw is the nose's angle out of the plane, + to the
right, from −90 to 90. Every direction field comes as a pair — a pitch and its
yaw companion — so that fc.steer(fc.airRetrograde, fc.airRetrogradeYaw)
points exactly along the relative wind wherever a crosswind blows it.
| Field | Unit | Meaning |
|---|
fc.plane | | The current guidance plane: 'launch', 'orbit', 'target', 'azimuth' or 'body'. New. |
fc.azimuth | ° | Compass bearing of the plane's forward direction at the vehicle. New. |
fc.pitch | ° | Nose angle above the horizon in the plane. New meaning (0 was east). |
fc.yaw | ° | Nose angle out of the plane, + right. New. |
fc.pitchRate | °/s | Rate of change of pitch. |
fc.prograde, fc.progradeYaw | ° | Direction of the surface-relative velocity. |
fc.retrograde, fc.retrogradeYaw | ° | Its opposite: pitch + 180°, wrapped, and the negated yaw. |
fc.airPrograde, fc.airProgradeYaw | ° | Direction of the air-relative velocity. Steer along it for zero angle of attack on the way up. |
fc.airRetrograde, fc.airRetrogradeYaw | ° | Its opposite: steer along it to fly tail-first into the relative wind. |
fc.orbitalPrograde, fc.orbitalProgradeYaw | ° | Direction of the inertial velocity, for orbital burns. The yaw is about zero on the 'orbit' plane. |
fc.orbitalRetrograde, fc.orbitalRetrogradeYaw | ° | Its opposite, for de-orbit and capture burns. |
The six pitch fields keep their original names and are now measured in the
guidance plane; their yaw companions are new.
Air data
| Field | Unit | Meaning |
|---|
fc.airspeed | m/s | Speed relative to the air, wind and gusts included. |
fc.aoa | ° | Angle of attack, 0–180; 180 is exactly tail-first. |
fc.mach | | Mach number. |
fc.dynamicPressure | Pa | q=21ρV2, with ρ the air density and V the airspeed. |
fc.airDensity | kg/m³ | Ambient density. |
fc.pressure | Pa | Ambient static pressure. |
There is no direct wind reading. The difference between the air-relative and
surface-relative fields is the wind's effect on the flight.
Loads
| Field | Unit | Meaning |
|---|
fc.qAlpha | Pa·° | Bending load, q⋅min(α,180°−α). The vehicle breaks up above fc.limits.qAlpha. |
fc.gForce | g | Magnitude of the sensed, non-gravitational acceleration. |
fc.accel | m/s² | The sensed acceleration in body and local axes. Fields below. New fields. |
fc.aeroAccel | m/s² | Its aerodynamic part — body, fins and legs — with the same fields plus drag (+ slowing, along the relative wind) and lift (across it). |
fc.gravity | m/s² | Local gravitational acceleration, J2 included, without a centrifugal term. |
fc.effectiveGravity | m/s² | Gravity minus (horizontal inertial speed)² / radius: the net pull on a coasting vehicle. About 9.78 on the pad, about zero in orbit. |
fc.limits | object | What the simulator enforces: { qAlpha, g, baseTemperature, noseTemperature } — 250 000 Pa·°, 15 g, and the base and nose temperature limits in kelvin. |
fc.accel.… | Meaning |
|---|
axial | Along the body axis, + towards the nose. |
normal | Across the body, + towards the side that faces forward when the vehicle is upright. |
lateral | Across the body, + towards its right side. New. |
up | Along the local vertical, + up. |
forward | Horizontal, forward in the guidance plane. New. |
right | Horizontal, right of forward. New. |
east | The original name for forward, kept; it equals forward. |
Thermal
| Field | Unit | Meaning |
|---|
fc.heatFlux | W/m² | Stagnation-point convective heat flux. |
fc.noseTemperature | K | Skin temperature at the forward end. |
fc.baseTemperature | K | Skin temperature at the engine end. |
fc.maxBaseTemperature | K | The base's limit: 2 400 K behind a heat shield, 900 K for a bare engine bay. |
Mass
| Field | Unit | Meaning |
|---|
fc.mass | kg | Total vehicle mass. |
fc.propellant | kg | Propellant the current stage can still burn. On real sites this excludes the unusable 1 % residual, which stays aboard and weighs; on the classic range it is all of it. |
fc.propellantCapacity | kg | What the current stage holds when full. |
fc.rcsGas | kg | Reaction-control propellant left: cold nitrogen at a specific impulse of 70 s, or on real sites hot gas on steel methalox stages — three times the thrust at 250 s. On real sites an attitude couple burns two thrusters' worth. |
Propulsion
"The lit engines, or those that would light" means: the engines burning, if
any are; otherwise the ones fc.setEngines() has selected.
| Field | Unit | Meaning |
|---|
fc.thrust | N | Actual thrust now. |
fc.maxThrust | N | Thrust at maximum throttle at the current ambient pressure, for the lit engines or those that would light. None from a vacuum nozzle in air too thick for it. |
fc.minThrust | N | The same at minimum throttle. |
fc.throttleSetting | 0–1.2 | The last commanded throttle. |
fc.minThrottle, fc.maxThrottle | 0–1.2 | The throttle range of the current engines — typically 0.4 and 1.0; the RS-25 goes to 1.09. With several engine groups, the lowest minimum and highest maximum among the selected ones. |
fc.engineRunning | | True while the engines are starting or running. |
fc.engineState | | 'off', 'starting', 'running' or 'stopping'. On real sites 'starting' covers the ignition dead time, 0.2–0.5 s with no thrust, as well as the spool-up. |
fc.activeEngines | | Engines lit. |
fc.engineCount | | Working engines on the stage. |
fc.ignitionsLeft | | Starts remaining; with several groups, the fewest among the groups that would light. |
fc.isp | s | Specific impulse at the current pressure, for the lit engines or those that would light. |
fc.twr | | Thrust-to-weight: fc.maxThrust over the weight. On real sites the weight is the one felt, with fc.effectiveGravity; on the classic range, with fc.gravity. |
fc.deltaV | m/s | Δv left in the current stage at the current pressure, on the usable propellant. |
fc.propellantSettled | | Ullage state; false after coasting in free fall. |
fc.engines | array | The current stage's engines: { state, offset, x, y, group } — state 'running', 'off' or 'failed'; x, y in metres in the base plane; offset equals x. New fields. |
fc.engineGroups | array | The current stage's engine groups at the current pressure; one entry on a one-engine-type stage. Fields below. New. |
fc.engineGroups[i].… | Meaning |
|---|
index, id, name | The group's position (group 0 lights first), engine type and display name. |
count, available, lit, selected | Engines designed, still working, burning, and selected to light. |
state | The group's engine state, as fc.engineState. |
vacuum | A vacuum-optimised nozzle. |
canFire, separationPressure | False when the air is too thick for a vacuum nozzle at its highest throttle — lit, it is destroyed — and the pressure (Pa) above which that happens. |
gimbal | Gimbal range in degrees; 0 is a fixed engine. |
minThrottle, maxThrottle | The group's own throttle range. |
thrust, maxThrust, minThrust | Thrust now, and at the group's throttle limits for its lit or selected engines (N). |
isp, ignitionsLeft | Specific impulse at the current pressure (s), and the group's own starts left. |
Landing gear
| Field | Unit | Meaning |
|---|
fc.legsDeployed | 0–1 | Landing-leg deployment progress. |
fc.finsDeployed | 0–1 | Grid-fin deployment progress. |
fc.hasLegs, fc.hasFins | | Whether the current stage carries legs, or grid fins, at all. |
fc.legCrush | 0–1 | Crush-core stroke used by the worst leg; zero until a hard touchdown. |
Orbit and target
| Field | Unit | Meaning |
|---|
fc.orbit | object | The osculating orbit about the body the vehicle is flying about. Fields below. |
fc.target | object or null | The landing platform this vehicle is aiming for, and on a Moon or Mars mission the destination. Fields below. New fields. |
fc.impact | object or null | Where an engine-off trajectory would come down, with drag and the mean wind. Refreshed at most every 0.1 s; null in a lasting orbit. Shape under queries. New fields. |
fc.cachedImpact | object or null | The last impact prediction, without computing a new one. |
fc.orbit.… | Unit | Meaning |
|---|
apoapsis, periapsis | m | Highest and lowest points. About Earth, above the equatorial radius, with the J2 correction of the original simulator; about the Moon or Mars, above the mean radius. Apoapsis is infinite on an open trajectory. |
semiMajorAxis, eccentricity | m, — | The conic's size and shape. |
period | s | Orbital period. |
timeToApoapsis, timeToPeriapsis | s | Time to the next apoapsis and periapsis. |
closed | | About Earth: bound, with a lowest point above the equatorial radius — it does not check the atmosphere, so compare periapsis with a height of your own. About the Moon or Mars: bound, with no check against the surface. |
inclination, raan | ° | Inclination to the equator, and the right ascension of the ascending node measured from the frame's +X axis — the Greenwich meridian at liftoff, on Earth. New. |
argPeriapsis, trueAnomaly | ° | Argument of periapsis and true anomaly. |
fc.target.… | Unit | Meaning |
|---|
id, name, type | | 'LZ-1' or 'SHIP'; its display name; 'ground' or 'ship'. |
distance | m | Along the guidance plane to the target, + ahead. |
crossrange | m | The target's offset from the guidance plane, + right. New. |
range, bearing | m, ° | Great-circle distance and initial compass bearing to it. New. |
latitude, longitude | ° | Its centre; the ship's drifts as it holds station. |
elevation | m | The pad's height, or the deck's including heave. |
velocity | m/s | The ship's drift along forward; zero for pads. |
crossVelocity | m/s | The ship's drift to the right. Ship only; new. |
deck | object | The ship's deck motion: { heave, heaveRate, roll, rollRate, pitch, pitchRate, surge, sway } in metres, m/s, degrees and °/s; pitch is + bow down. Ship only; new. |
body | | Moon or Mars missions: the destination, 'moon' or 'mars'. New. |
bodyRange, speed | m, m/s | Moon or Mars missions: the vehicle's height above the destination's mean surface and its speed relative to the destination's centre. New. |
closestApproach | object or null | Moon or Mars missions: { t, range }, the closest approach so far after injection, with t in seconds from now (negative once it is behind you) and range above the surface. New. |
On an Earth mission fc.target is null when the vehicle has no platform. On
a Moon or Mars mission it always carries the destination fields. About the
destination itself, the platform fields describe the landing pad when the
mission names one — distance is then the great-circle range and
crossrange zero — and are absent when it does not; range falls back to
bodyRange.
Destination
These are present on every flight. On an Earth mission fc.destination is
'earth', fc.body describes Earth and fc.plan is null.
| Field | Unit | Meaning |
|---|
fc.destination | | 'earth', 'moon' or 'mars'. New. |
fc.body | object | The body the vehicle is flying about now, which changes at a sphere-of-influence crossing: { id, name, mu, radius, gravity, rotationPeriod, hasAtmosphere } — μ in m³/s², mean radius in m, equatorial surface gravity in m/s², sidereal rotation period in s. New. |
fc.soi | object | { body, radius, distance, exitIn }: the current body, its sphere of influence and the vehicle's distance from its centre (m), and the seconds until the sphere changes, or null when no change is coming. New. |
fc.state | object | { r, v }, position (m) and velocity (m/s) as { x, y, z } about the current body, in the simulation frame: +Z on that body's spin axis, +X on its prime meridian at T+0 or at the last sphere-of-influence change; about the Sun, the J2000 equatorial frame. The frame fc.ephemeris() answers in. New. |
fc.plan | object or null | The launch window the mission flies, frozen at launch. Fields below. New. |
fc.plan.… | Unit | Meaning |
|---|
id, destination, arrival | | The window's identifier, 'moon' or 'mars', and 'flyby', 'orbit' or 'landing'. |
departure | s | The planned injection time, in seconds from T+0. |
coast | s | From liftoff to the injection burn: the parking-orbit coast. |
window | object | { open, best, close }, in seconds from T+0: the daily window at the site. |
tof | s | Time of flight from injection to arrival. |
c3 | m²/s² | Characteristic energy of the departure, v∞2; negative for the Moon. |
dvInjection, dvArrival, dvTotal | m/s | The planned burns. dvArrival is the capture only, zero for a flyby. |
vInfDep | m/s | The departure asymptote as { x, y, z } in the simulation frame. |
inclination, azimuth | ° | The parking orbit's inclination, and the ground azimuth that reaches it. |
parkingAltitude | m | The parking orbit's altitude, 200 000 by default. |
feasible, reason | | Whether this site can fly the window, and why not if it cannot. |
State
| Field | Unit | Meaning |
|---|
fc.contact | | Touching a surface. |
fc.landed | | Landed and settled. The program is no longer called for this vehicle. |
fc.mem | object | Per-vehicle storage that persists between calls. Top-level variables are shared by update and booster; keep per-stage state here. |
fc.phase | | Read and write: the label in the top bar, up to 40 characters. |
fc.sleeping | | True from an fc.sleep() or fc.cruise() call until it runs out. New. |
fc.failures | array | Failures this vehicle has suffered: { kind, t, stage, engine }, with kind 'engine-out', 'relight', 'gimbal' or 'fins'. |
Queries
Queries have no side effects and may be called at any time inside the
program. The predictors cost real time — a landing plan about 1.3 ms, a stop
point about 0.7 ms — so refresh them a few times a second, not every tick.
| Call | Returns | What it answers |
|---|
fc.predict({ dv, radialDv, normalDv, pitch, yaw, target }) | impact or null | Where the vehicle would come down after an impulsive burn now. dv is along the inertial velocity (+ prograde), or along pitch and yaw in the guidance plane when they are given; radialDv adds straight up; normalDv adds along the orbit normal (+ along the angular momentum: to the left of the motion, north when flying east). target measures the miss from that platform instead. New fields. |
fc.predict({ landingBurn, entryBurn, target }) | landing plan or null | The ideal landing burn: coast engine-off, then light at the latest moment that still stops landingBurn.altitude metres (default 0) above the surface. landingBurn takes { throttle, engines, attitude, altitude, legs }. entryBurn — defaults { altitude: 55000, engines: 3, throttle: 1, untilSpeed: 900 } — adds an air-retrograde entry burn first, so one call plans a whole booster return. |
fc.stopPoint({ throttle, engines, attitude, legs }) | stop point or null | Light the landing burn now, or keep the running one, and hold it: where does the descent stop? attitude is 'retrograde' (the default, ground-relative), 'air', 'auto' — air-relative above 11 kPa of dynamic pressure, ground-relative below 5 kPa, blended between — or a pitch in degrees. |
fc.burnTime(dv, throttle, engines) | s | How long the selected engines, or engines in any fc.setEngines() form, take to deliver dv at throttle (default: maximum) at the current pressure. Infinite if the stage lacks the Δv. |
fc.burnFor(dv, throttle, engines) | s | The same computation as fc.burnTime, under the name the destination missions use. New. |
fc.timeToAltitude(h, dir) | s or null | Seconds until the coasting vacuum trajectory reaches height h above the ellipsoid, going 'up', 'down' or whichever comes first; null if never. fc.timeToAltitude(0, 'down') is the vacuum impact time. |
fc.passes({ target, hours, within }) | array | When this orbit's ground track next passes the target, for timing a de-orbit: { time, distance, crossrange, latitude, longitude } per pass, within hours (default 30) and within metres (default 50 000). The orbit is coasted with Kepler and J2, without drag: call it when planning, not every tick. It throws if there is no target. New. |
fc.ephemeris(id, t) | object or null | Where 'sun', 'earth', 'moon' or 'mars' is relative to the current body, t seconds from now (default now): { id, r, v, range, speed } — position and velocity as { x, y, z } in the simulation frame, the distance from the vehicle to its centre, and the speed relative to the vehicle. Null for the current body itself; any other name throws. New. |
fc.soiTime() | s or null | Seconds until the sphere of influence changes, searched along the current osculating conic over one orbit or 30 days, whichever is shorter; the same number as fc.soi.exitIn. New. |
| Result | Fields |
|---|
| Impact | { error, crossrange, miss, time, latitude, longitude, speed }: along-plane miss (+ long), sideways miss (+ right), total miss, seconds to impact, where, and the impact speed. error, crossrange and miss are null when there is no target. |
| Stop point | { error, crossrange, miss, time, latitude, longitude, altitude, downrange, horizontalSpeed, crossSpeed, crashed, impactSpeed, burnTime, propellantLeft }. altitude is the base's height above the surface when the vertical speed reaches zero; downrange is metres from here along the plane; horizontalSpeed is what is left at the stop, + forward; crashed means the surface came first. |
| Landing plan | A stop point plus ignitionTime (s from now) and ignitionAltitude (m above the surface). On real sites these are when to call fc.ignite(), with the engine's dead time already allowed for. With crashed: true no ignition is early enough and the plan is a best effort. With an entry burn, also entryBurn: { startTime, startAltitude, endTime, endSpeed, propellantUsed, crashed }. |
The predictors are point masses with drag in the mean wind. They know neither
the gusts nor each engine's own thrust, so keep a burn closed-loop:
fc.stopPoint() during the burn tells you where it is really going.
const lb = fc.predict({ landingBurn: { engines: 1 } });
if (lb && fc.radarAltitude < lb.ignitionAltitude + 50) fc.ignite();
const s = fc.stopPoint(); // once lit, a few times a second
if (s) fc.throttle(fc.throttleSetting + (s.altitude < 0 ? 0.05 : -0.02));
Commands
Engines
| Command | Returns | Effect |
|---|
fc.ignite() | boolean | Start the selected engines of the bottom stage. Each group it lights uses one of its own ignitions; it needs settled propellant, and returns false when refused. While some engines burn it lights any selected group that is off. On real sites there is no thrust during the ignition dead time — Merlin 0.3 s, Raptor 0.4 s, RS-25 0.5 s — then the spool-up. |
fc.shutdown() | | Cut the engines, with a 0.25 s tail-off. |
fc.throttle(x) | | One setting for every group, 0–1. Values up to 1.2 are accepted and each group clamps to its own range; below minimum an engine holds its minimum. It slews at the engine's own rate. |
fc.setEngines(n) | | Which engines to use: a number takes the first n engines, group by group; [n0, n1, …] sets each group; 'all', 'sea-level' or 'vacuum' take whole groups. A running group can only lose engines; a group that is off lights at the next fc.ignite(). A malformed selection throws; one that selects nothing is ignored with a warning. |
fc.ullage(on) | | Fire the aft thrusters to settle the propellant before a relight, while gas lasts; fc.ullage(false) stops them. |
fc.setEngines('sea-level'); fc.ignite(); // liftoff without the vacuum engines
// … above the thick air:
const vac = fc.engineGroups.find((g) => g.vacuum);
if (vac && vac.canFire && vac.lit === 0) { fc.setEngines('all'); fc.ignite(); }
Attitude and guidance
| Command | Effect |
|---|
fc.steer(pitch, yaw) | The built-in autopilot holds this pitch in the guidance plane and this yaw, + right, −90 to 90; yaw defaults to 0. It uses the gimbal, the grid fins and the reaction control on all three axes, and keeps the vehicle rolled level with the plane. New form. |
fc.steer({ elevation, heading }) | Hold an absolute direction: elevation above the local horizon, −90 to 90, and a compass heading. New. |
fc.steer(null) | Autopilot off: the vehicle drifts. |
fc.control({ gimbal, rcs, fins }) | Manual actuators, until the next fc.steer(): gimbal in degrees, reaction control and fins from −1 to 1. Each is a number, acting on the pitch axis, or { pitch, yaw, roll }. On real sites each engine deflects within a cone at its own slew rate. New axes. |
fc.setPlane(plane) | Choose the guidance plane: 'launch' (the default: the Earth-fixed great circle through the pad at the launch azimuth); 'orbit' (the osculating orbital plane, forward = prograde); { target: 'LZ-1' } or { target: 'SHIP' } (the great circle through the vehicle and the target, forward = towards it); { body: 'moon' } and the like (the plane through the vehicle and that body, forward = towards it; not the body the vehicle is flying about); or { azimuth } (the Earth-fixed great circle through the sub-point at that bearing, fixed when set). New. |
fc.steer(fc.airRetrograde, fc.airRetrogradeYaw); // tail-first along the relative wind, crosswind included
fc.steer({ elevation: 85, heading: 45 }); // absolute: 85° up, leaning north-east
fc.setPlane({ target: fc.mission.boosterTarget }); // forward = towards the landing platform
At a sphere-of-influence crossing a vehicle on the 'launch' or azimuth plane
falls back to 'orbit', because an Earth-fixed plane means nothing about
another body.
Staging and hardware
| Command | Returns | Effect |
|---|
fc.separate() | boolean | Jettison the bottom stage; refused while clamped on the pad. It keeps flying under booster(fc) if the program defines one. |
fc.deployPayload() | boolean | Release the payload; refused on the pad. Drops the fairing first if it is still on. |
fc.jettisonFairing() | boolean | Drop the fairing as two halves. Above about 110 km it is dead weight gone; in thick air it exposes the payload. |
fc.deployLegs() | | Deploy the landing legs: irreversible, about 3 s, and they add drag. |
fc.deployFins() | | Deploy the grid fins: irreversible, about 2 s. |
Mission, time and logging
| Command | Effect |
|---|
fc.setTarget(id) | Divert to 'LZ-1' or 'SHIP': the landing then counts on that platform. An unknown id throws. |
fc.expend(reason) | Give up on this stage on purpose, typically in booster(fc) when a return cannot work. Its loss is then reported as expected, with your reason. Returns a boolean. |
fc.sleep(seconds) | Do not call the program for this vehicle for that much mission time; its commands hold, and a burn keeps burning. Coasting above 151 km with the engine, reaction control and ullage off, and its attitude settled on an unchanged steer command, it goes on rails meanwhile. A slew commanded just before sleeping is flown first, with its time and gas. New. |
fc.cruise(seconds) | Like fc.sleep, and also allows the cruise rails on a Moon or Mars mission: one simulation step may then cover up to an hour of coast. The rails return to 20 ms steps before an atmosphere, within 2 000 km of any surface, and at a sphere-of-influence crossing. New. |
fc.warp(n) | Ask the interface for n× time warp, 1 to 100 000. It changes how fast the flight is shown, never the physics; the interface applies a request once and the user can override it. |
fc.log(...args) | Print to the console with a mission-time stamp. Numbers that are not integers print to three decimals, objects as JSON, and lines over 2 000 characters are cut. |
if (phase === 'coast') fc.sleep(Math.max(0, fc.orbit.timeToApoapsis - 60));
if (phase === 'cruise') fc.cruise(6 * 3600);
Helpers and constants
These are available without the fc. prefix. All are frozen.
| Name | Meaning |
|---|
clamp(x, a, b) | Limit x to the interval from a to b. |
lerp(a, b, t) | Linear interpolation, a+(b−a)t. |
deg(rad), rad(deg) | Radians to degrees, and back. |
wrap180(deg) | Wrap an angle to (−180, 180]. |
new PID(kp, ki, kd, { min, max }) | A PID controller: .update(error, dt) returns the output, .reset() clears it. The integral and the output are both clamped to the interval from min to max; dt defaults to the simulation step. |
Math.random() | The standard Math, frozen, with random() seeded from the mission seed: the same seed flies the same flight. |
G0 | Standard gravity, 9.806 65 m/s². |
MU | Earth's gravitational parameter, 3.986 004 418 × 10¹⁴ m³/s². |
EARTH_RADIUS | WGS84 equatorial radius, 6 378 137 m. |
OMEGA | Earth's rotation rate, 7.292 115 9 × 10⁻⁵ rad/s. |
const alt = new PID(0.02, 0.002, 0.05, { min: 0, max: 1 });
fc.throttle(alt.update(100 - fc.altitude, fc.dt));
What the program cannot see
Inside a program these globals are undefined, though it may declare its own
variables with the same names: HS, globalThis, window, self,
document, frames, parent, top, opener, navigator, location,
localStorage, sessionStorage, indexedDB, caches, fetch,
XMLHttpRequest, WebSocket, Worker, SharedWorker, setTimeout,
setInterval, setImmediate, clearTimeout, clearInterval,
queueMicrotask, requestAnimationFrame, requestIdleCallback, Function,
Date, performance, process, require, module, exports, global,
THREE and importScripts.
Every for, while and do…while loop is guarded: more than 10 million
iterations, or 500 ms of wall-clock time, in one call stops the program with
an error. A command given an invalid number throws a TypeError —
fc.throttle("full"), say. Errors report the line in your source. If a
program throws during flight, that vehicle keeps its last commands and flies on
without software. This is a fence against accidents and casual cheating, not a
security boundary.
What this reference does not confirm
A few behaviours are documented from the source rather than observed in a
flight, or are open questions in the simulator itself:
- The predictors away from Earth.
fc.impact, fc.predict(),
fc.stopPoint(), fc.timeToAltitude() and fc.passes() are written against
Earth's shape, rotation and orbit propagation. What they return about the
Moon or Mars has not been validated, and the reference destination programs
do not rely on them there.
fc.target.closestApproach.t is computed as the time of the closest
approach so far minus now. That it is negative once the approach is behind
the vehicle follows from the code; it is not separately documented.
fc.plane on an azimuth plane. The simulator's in-app guide says it
reads 'launch'; the code sets 'azimuth', as listed here. For a body plane
it reads 'body', which the in-app reference does not yet list.
fc.orbit.closed. The in-app reference describes it as clearing the
atmosphere and the ground. The code checks only that the orbit is bound and,
about Earth, that its lowest point is above the equatorial radius. This page
follows the code.
fc.soi on an Earth mission reports Earth and its sphere of influence
about the Sun, with exitIn null, because nothing else is in the field. That
reading follows from the code.