Contents

Under the hood

Flight computer reference

Every sensor and command on the fc object, in one place.

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

FieldUnitMeaning
fc.tsMission elapsed time.
fc.dtsThe control period, equal to the simulation step: 0.02 s in the app. Integrate with it rather than a constant.
fc.nameThe vehicle's name.
fc.stageNumberDesign index, from 1, of the current bottom stage.
fc.stageCountStages still attached.
fc.payloadAttachedThe payload is still on top.
fc.fairingAttachedThe payload fairing is still on.
fc.missionobjectThe mission, frozen at launch, so one program can adapt to it. Fields below. New.
fc.siteobjectThe launch site, the same object as fc.mission.site. New.
fc.mission.…UnitMeaning
profile'orbital', 'rtls' (return to launch site) or 'hop'.
targetThe main vehicle's landing platform: 'LZ-1' or 'SHIP'.
boosterTargetThe first target of separated stages; 'rtls' forces 'LZ-1'.
hopAltitudemThe altitude a hop must pass.
shipDistancemThe drone ship's station, downrange along the launch great circle.
shipCrossrangemIts offset from that great circle, + right. New.
sensors'ideal', 'realistic' or 'hard'.
siteobject{ 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

FieldUnitMeaning
fc.altitudemHeight of the vehicle's base above the reference ellipsoid — WGS84 on Earth, not sea level and not a sphere.
fc.radarAltitudemThe lowest point, feet or nozzles, above whatever is below: ground, deck or sea.
fc.verticalSpeedm/sSurface-relative, + up.
fc.horizontalSpeedm/sSurface-relative speed along the guidance plane, + forward. Sideways motion shows in fc.heading and fc.progradeYaw. New meaning.
fc.surfaceSpeedm/sSpeed relative to the rotating ground, all three components.
fc.orbitalSpeedm/sInertial 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.downrangemSurface distance from the pad along the launch great circle, + along the launch azimuth, whatever the guidance plane.
fc.crossrangemDistance 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.

FieldUnitMeaning
fc.planeThe 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°/sRate 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

FieldUnitMeaning
fc.airspeedm/sSpeed relative to the air, wind and gusts included.
fc.aoa°Angle of attack, 0–180; 180 is exactly tail-first.
fc.machMach number.
fc.dynamicPressurePa, with the air density and the airspeed.
fc.airDensitykg/m³Ambient density.
fc.pressurePaAmbient 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

FieldUnitMeaning
fc.qAlphaPa·°Bending load, . The vehicle breaks up above fc.limits.qAlpha.
fc.gForcegMagnitude of the sensed, non-gravitational acceleration.
fc.accelm/s²The sensed acceleration in body and local axes. Fields below. New fields.
fc.aeroAccelm/s²Its aerodynamic part — body, fins and legs — with the same fields plus drag (+ slowing, along the relative wind) and lift (across it).
fc.gravitym/s²Local gravitational acceleration, included, without a centrifugal term.
fc.effectiveGravitym/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.limitsobjectWhat the simulator enforces: { qAlpha, g, baseTemperature, noseTemperature } — 250 000 Pa·°, 15 g, and the base and nose temperature limits in kelvin.
fc.accel.…Meaning
axialAlong the body axis, + towards the nose.
normalAcross the body, + towards the side that faces forward when the vehicle is upright.
lateralAcross the body, + towards its right side. New.
upAlong the local vertical, + up.
forwardHorizontal, forward in the guidance plane. New.
rightHorizontal, right of forward. New.
eastThe original name for forward, kept; it equals forward.

Thermal

FieldUnitMeaning
fc.heatFluxW/m²Stagnation-point convective heat flux.
fc.noseTemperatureKSkin temperature at the forward end.
fc.baseTemperatureKSkin temperature at the engine end.
fc.maxBaseTemperatureKThe base's limit: 2 400 K behind a heat shield, 900 K for a bare engine bay.

Mass

FieldUnitMeaning
fc.masskgTotal vehicle mass.
fc.propellantkgPropellant 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.propellantCapacitykgWhat the current stage holds when full.
fc.rcsGaskgReaction-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.

FieldUnitMeaning
fc.thrustNActual thrust now.
fc.maxThrustNThrust 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.minThrustNThe same at minimum throttle.
fc.throttleSetting0–1.2The last commanded throttle.
fc.minThrottle, fc.maxThrottle0–1.2The 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.engineRunningTrue 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.activeEnginesEngines lit.
fc.engineCountWorking engines on the stage.
fc.ignitionsLeftStarts remaining; with several groups, the fewest among the groups that would light.
fc.ispsSpecific impulse at the current pressure, for the lit engines or those that would light.
fc.twrThrust-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.deltaVm/s left in the current stage at the current pressure, on the usable propellant.
fc.propellantSettledUllage state; false after coasting in free fall.
fc.enginesarrayThe 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.engineGroupsarrayThe 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, nameThe group's position (group 0 lights first), engine type and display name.
count, available, lit, selectedEngines designed, still working, burning, and selected to light.
stateThe group's engine state, as fc.engineState.
vacuumA vacuum-optimised nozzle.
canFire, separationPressureFalse 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.
gimbalGimbal range in degrees; 0 is a fixed engine.
minThrottle, maxThrottleThe group's own throttle range.
thrust, maxThrust, minThrustThrust now, and at the group's throttle limits for its lit or selected engines (N).
isp, ignitionsLeftSpecific impulse at the current pressure (s), and the group's own starts left.

Landing gear

FieldUnitMeaning
fc.legsDeployed0–1Landing-leg deployment progress.
fc.finsDeployed0–1Grid-fin deployment progress.
fc.hasLegs, fc.hasFinsWhether the current stage carries legs, or grid fins, at all.
fc.legCrush0–1Crush-core stroke used by the worst leg; zero until a hard touchdown.

Orbit and target

FieldUnitMeaning
fc.orbitobjectThe osculating orbit about the body the vehicle is flying about. Fields below.
fc.targetobject or nullThe landing platform this vehicle is aiming for, and on a Moon or Mars mission the destination. Fields below. New fields.
fc.impactobject or nullWhere 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.cachedImpactobject or nullThe last impact prediction, without computing a new one.
fc.orbit.…UnitMeaning
apoapsis, periapsismHighest and lowest points. About Earth, above the equatorial radius, with the correction of the original simulator; about the Moon or Mars, above the mean radius. Apoapsis is infinite on an open trajectory.
semiMajorAxis, eccentricitym, —The conic's size and shape.
periodsOrbital period.
timeToApoapsis, timeToPeriapsissTime to the next apoapsis and periapsis.
closedAbout 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 axis — the Greenwich meridian at liftoff, on Earth. New.
argPeriapsis, trueAnomaly°Argument of periapsis and true anomaly.
fc.target.…UnitMeaning
id, name, type'LZ-1' or 'SHIP'; its display name; 'ground' or 'ship'.
distancemAlong the guidance plane to the target, + ahead.
crossrangemThe target's offset from the guidance plane, + right. New.
range, bearingm, °Great-circle distance and initial compass bearing to it. New.
latitude, longitude°Its centre; the ship's drifts as it holds station.
elevationmThe pad's height, or the deck's including heave.
velocitym/sThe ship's drift along forward; zero for pads.
crossVelocitym/sThe ship's drift to the right. Ship only; new.
deckobjectThe 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.
bodyMoon or Mars missions: the destination, 'moon' or 'mars'. New.
bodyRange, speedm, m/sMoon or Mars missions: the vehicle's height above the destination's mean surface and its speed relative to the destination's centre. New.
closestApproachobject or nullMoon 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.

FieldUnitMeaning
fc.destination'earth', 'moon' or 'mars'. New.
fc.bodyobjectThe 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.soiobject{ 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.stateobject{ r, v }, position (m) and velocity (m/s) as { x, y, z } about the current body, in the simulation frame: on that body's spin axis, 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.planobject or nullThe launch window the mission flies, frozen at launch. Fields below. New.
fc.plan.…UnitMeaning
id, destination, arrivalThe window's identifier, 'moon' or 'mars', and 'flyby', 'orbit' or 'landing'.
departuresThe planned injection time, in seconds from T+0.
coastsFrom liftoff to the injection burn: the parking-orbit coast.
windowobject{ open, best, close }, in seconds from T+0: the daily window at the site.
tofsTime of flight from injection to arrival.
c3m²/s²Characteristic energy of the departure, ; negative for the Moon.
dvInjection, dvArrival, dvTotalm/sThe planned burns. dvArrival is the capture only, zero for a flyby.
vInfDepm/sThe departure asymptote as { x, y, z } in the simulation frame.
inclination, azimuth°The parking orbit's inclination, and the ground azimuth that reaches it.
parkingAltitudemThe parking orbit's altitude, 200 000 by default.
feasible, reasonWhether this site can fly the window, and why not if it cannot.

State

FieldUnitMeaning
fc.contactTouching a surface.
fc.landedLanded and settled. The program is no longer called for this vehicle.
fc.memobjectPer-vehicle storage that persists between calls. Top-level variables are shared by update and booster; keep per-stage state here.
fc.phaseRead and write: the label in the top bar, up to 40 characters.
fc.sleepingTrue from an fc.sleep() or fc.cruise() call until it runs out. New.
fc.failuresarrayFailures 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.

CallReturnsWhat it answers
fc.predict({ dv, radialDv, normalDv, pitch, yaw, target })impact or nullWhere 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 nullThe 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 nullLight 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)sHow 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 .
fc.burnFor(dv, throttle, engines)sThe same computation as fc.burnTime, under the name the destination missions use. New.
fc.timeToAltitude(h, dir)s or nullSeconds 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 })arrayWhen 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 , without drag: call it when planning, not every tick. It throws if there is no target. New.
fc.ephemeris(id, t)object or nullWhere '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 nullSeconds 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.
ResultFields
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 planA 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

CommandReturnsEffect
fc.ignite()booleanStart 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

CommandEffect
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

CommandReturnsEffect
fc.separate()booleanJettison the bottom stage; refused while clamped on the pad. It keeps flying under booster(fc) if the program defines one.
fc.deployPayload()booleanRelease the payload; refused on the pad. Drops the fairing first if it is still on.
fc.jettisonFairing()booleanDrop 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

CommandEffect
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.

NameMeaning
clamp(x, a, b)Limit x to the interval from a to b.
lerp(a, b, t)Linear interpolation, .
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.
G0Standard gravity, 9.806 65 m/s².
MUEarth's gravitational parameter, 3.986 004 418 × 10¹⁴ m³/s².
EARTH_RADIUSWGS84 equatorial radius, 6 378 137 m.
OMEGAEarth'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 TypeErrorfc.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.