DemoCode
Flight Simulator demo

Flight Simulator puts you in the left seat of a Cessna 172SP Skyhawk, lined up on runway 31 at New York LaGuardia with the engine running. The 3D steam-gauge cockpit has a yoke, rudder pedals, throttle, mixture, flap lever and trim wheel that all move with your inputs, and a working six-pack, tachometer, VOR, radio stack and transponder driven by a six-degree-of-freedom flight model with stalls, prop wash, left-turning tendencies, ground handling and fuel burn.

Below you lie about 14,000 real building footprints from OpenStreetMap, the East River, Hudson, Verrazzano and George Washington bridges, the Statue of Liberty, Citi Field, and a LaGuardia with FAA runway markings, a control tower, PAPIs and airliners landing on runway 22. Scripted LaGuardia ATC plays through a VHF radio filter on whichever frequency COM1 is tuned to, an ATC menu lets you make your own calls, and a hint card walks you from the takeoff clearance to the straight-in back home.

How it works

The simulation is separate from the cockpit, the scenery, the audio and the interface. The flight model is plain JavaScript with no DOM, stepped at about 120 Hz: it takes control inputs and wind and surface information and updates the aircraft's position, orientation, engine and fuel. The gauges, the HUD and the cockpit animation all read values the simulation derives each step, such as indicated airspeed, altitude, vertical speed and heading.

The gauge faces are drawn on canvases and used as textures on the 3D panel, with needle damping and gyro lag applied to the readings. The scenery is built from data files derived from OpenStreetMap, with procedural low-rise buildings filling the boroughs and landmark models for the bridges and other sights.

Sound is synthesised, with engine, wind, rolling, stall-horn and flap-motor sounds following the simulation. The ATC is scripted: clips are played through a radio filter, and you hear only the station tuned on COM1, as in a real aircraft. Tower, Ground, ATIS and New York Departure each have their own traffic.

Controls

ActionKeyboardTouch
Pitch and rollW, S, A, D (hold; the yoke stays where you leave it)Left yoke pad
Rudder and nosewheelQ and ERudder buttons
Centre yoke and rudderXNone
ThrottleR and F, PageUp and PageDown, 1 to 9 and 0 for presetsRight throttle lever
FlapsG to extend, T to retractFlap buttons
Elevator trimU and JTrim buttons
BrakesSpace (hold); P is the parking brakeBRAKE (hold)
Engine start and stopIEngine button
MixtureComma to lean, period to enrich, M for full rich or idle cut-offLean and Rich buttons
Look around and zoomArrow keys, drag the mouse, mouse wheel; C or double-click resetsDrag and pinch; double-tap resets
ATC menu, help, data overlay, pauseO, H, V, EscTop bar

A gamepad with standard mapping is also supported. For a first flight, press P to release the parking brake, press O and call ready for departure, then apply full throttle once you have your takeoff clearance. Rotate at 55 knots and climb at 74.

Built with

JavaScript and Three.js, bundled with Vite, with Vitest and ESLint for tests and linting. Map data is from OpenStreetMap contributors.