VIPER 11 · NotesFly it →

Note 6 of 15

Fly-by-wire in a browser

A six-degree-of-freedom F-16 with its control laws, simplified honestly and tuned to feel right.

The F-16 was the first production fighter that a pilot never flies directly. Moving the side-stick does not move a control surface. It sends a request to a flight control computer, which works out how to move the surfaces to give you what you asked for. That is fly-by-wire, and it is why VIPER 11 can put a real-feeling F-16 in a browser tab without needing a simulator pilot’s licence to fly it.

Six degrees of freedom

Underneath is a proper flight model, a rigid body with six degrees of freedom: three of position and three of rotation. It integrates 240 times a second, working out the forces and moments on the airframe from the speed of the air, the angle of attack, the sideslip and the Mach number.

Ground effect, a tail-slide branch and gear and flap drag are all in there as well. The surfaces have real limits on how far and how fast they move. Slow down or climb high enough and they run out of authority, and the jet simply cannot do what you ask.

What the computer does with your hand

Figure 1 · The control laws

Each axis is a dynamic inversion. The computer decides on the response it wants, works out the angular acceleration needed to get there, subtracts what the airframe would do on its own, and solves for the surface deflection, clamped and rate-limited. It runs every physics step, 240 times a second.

Pitch is a G command. Pull the stick and you are asking for load factor, not pitch rate, so the jet feels the same at 200 knots as at 500. Let go and it holds the flight path. Full aft stick asks for 9 g, full forward −3 g, and the request is slewed at 14 g/s. Underneath, an angle-of-attack limiter holds the jet below 25°. The allowed G tapers from 9 g at 23° to 7 g at 25°, so you cannot stall it, however hard you pull. With the gear down the computer switches to landing gains: full aft is only 4 g, and the stick is softer around centre, so a flare is a gentle squeeze.

Figure 2 · Stick to G

The commanded load factor against stick position, read from the game’s own function. Gold: clean, up to 9 g with a soft knee from 7 g. Dashed: gear down, landing gains, at most 4 g.

Roll is a roll-rate command, up to 300° per second at full stick, about the velocity vector rather than the nose. At high angle of attack the jet therefore rolls around its flight path instead of skidding sideways. The rate is cut back when slow (about 155°/s at 170 kt), near the AoA limit and with the gear down. A prefilter softens the onset so the rudder can keep up. Yaw is a sideslip loop: the rudder holds the ball centred on its own, cancelling adverse yaw and damping the Dutch roll, so there are no pedals to dance on. The rudder keys add a few degrees of sideslip when you want it.

Gamified, but honest

The game’s own flight-physics notes list exactly where it departs from the real jet, and why:

Within those limits, the numbers line up with the real F-16. Corner speed is 350 knots at low altitude, with 27° per second of instantaneous turn there. Level top speed at 16,000 ft is Mach 1.5 in full afterburner and about Mach 1.0 at military power.

Figure 3 · Two takeoffs

Speed from brake release, from the flight model run headless. Gold: Fly, run up at military power against the brakes and released into afterburner. It rotates 10.8 s after release at 152 knots and is airborne at 11.9 s after 1,513 ft, inside the real jet’s 1,200–2,500 ft. White: the demo, with the gated thrust that stretches the roll to the reference clip’s 27 s and about 2,960 ft.
Rotation off 21L in the demo, then gear up and the pull into the climb.

Coming back down

The landing uses the same model. Gear and flaps add drag, and the trailing-edge flaps add lift; the speed brake opens over two seconds. On a stabilised approach the jet flies 1 g at about 145 knots, 12–13° angle of attack and about 20% throttle, close to the real F-16’s on-speed approach. Each wheel is checked against the ground. A touchdown over 900 feet per minute, nose-first, banked past 30° or faster than 230 knots is a crash. Anything else on a runway earns a grade, from GREASED IT (under 180 fpm) to ARRIVAL (under 900).

To help you get there, each runway has a PAPI, the precision approach path indicator: four lights beside the runway, each aimed at a slightly different angle. Above the glidepath you see more white, below it more red. Two white and two red means you are on a 3° slope.

Figure 4 · Reading the PAPI

Side view with the height exaggerated. The four units sit 320 m past the threshold on the left. From the inner unit outward they are set at 3°30′, 3°10′, 2°50′ and 2°30′, the real angles; the white and red sectors fan out from each one. Move the jet: the four lamps at the top are what you would see from the cockpit. (In the game the units stand 18 m apart instead of 9 m, so they stay distinct through the wide lens.)

None of this is required to enjoy the game: the tutorial flies you through it, and the assists catch most mistakes. But it is all there, and the jet you fly is the jet the numbers describe.

Fly it

viperoneone.com

VIPER 11 is a browser flight game: three.js, WebGL2 and Web Audio. Every figure on this page is drawn from the game’s own code and numbers. Made by apek. Follow me @apekshik for what’s next.