Starvard University · School of Technology
How to build the flying game players describe as it just feels right: one small flight model in two modes, the hover fraction that makes the throttle honest, the camera tilt that keeps the horizon in view at speed, gates that give the sky a purpose, and a ghost of your best lap to chase. Every number in this course comes from a real, playable game, and at the end the whole source code is free to take.
The whole course in brief
The ten lessons
Lesson 1
Most flying games that feel wrong are aeroplane simulators in disguise: runways, stalls, airspeed, a page of instruments. Almost nobody wants that in a browser tab. The flying that feels like magic, the kind in first person drone racing, is far simpler. Your craft is three things: a position, a velocity, and an orientation. Your pilot is four numbers, each between -1 and 1: throttle, yaw, pitch, and roll, plus two switches, boost and precision. Everything else in this course is arithmetic on those, run once per frame.
Build a drone, not a plane. A drone hovers, so a new pilot can stop mid air and think. A drone turns in its own length, so it fits through gates, doors, and canyons. A drone has no stall speed and no runway, so the first ten seconds of your game are flying, not taxiing. The game this course teaches from, a one island racer with thirteen glowing gates, is a single HTML file of about 82 KB, and its entire flight model fits in one function. Small is not a compromise here. Small is why it feels tight.
Play it here
This is the game the whole course is drawn from, playable without leaving the page. Click it, and you are flying: W and S are the throttle, A and D turn you, the arrow keys pitch and roll, Space boosts, Shift flies precise. Thirteen golden gates make the lap.
If the frame is shy on your device, play it full screen at Open Arcade.
One key switches how the whole craft flies: X. You start in Level mode, where the sticks tilt the craft and letting go settles it flat and holds your altitude (Lesson 2). Press X and you are in Acro mode: the sticks now command spin rates, the craft holds whatever angle you leave it at, and flips and rolls are yours to make and yours to stop (Lesson 6). Press X again to come back. Fly your first lap in Level, then try the same lap in Acro, and you will feel in your hands exactly what those two lessons are about.
Lesson 2
Level mode is the forgiving one, and it is the right first flight model for almost every game and almost every player. The sticks do not spin the craft; they tilt it. Push the pitch stick and the craft banks toward a target angle, 38 degrees at the very most on the beginner setting. Let go, and the target is flat and level, so the craft settles itself and holds its altitude. You steer where it points; the model handles the rest.
Two details do the heavy lifting. First, the craft eases toward the target tilt instead of snapping to it: in code, the orientation is slerped toward the target with a smoothing factor of 1 - exp(-dt x 9), which is fast enough to feel instant and soft enough to feel physical. Second, yaw is just the heading turning at a capped rate, 160 degrees per second on the beginner setting. Nothing in Level mode can flip, stall, or surprise a new pilot, and that is the point. In the real game, one key (X) swaps between Level and Acro, so pilots graduate when they are ready, and the physics function branches exactly once.
Lesson 3
Here is the trick that makes the throttle honest. Throttle does not map to raw power. It maps onto the thrust to weight ratio, the number that says how many times its own weight the craft can lift. If that ratio is 3.2, then hover, the thrust that exactly cancels gravity, is the fraction 1 / 3.2 of full power. Centre the stick and the game applies exactly that fraction, so centred means hover: in both modes, on every setting, with no trimming and no guessing.
Push up from centre and the remaining power arrives smoothly up to full. Pull down and thrust fades toward zero. Thrust always points along the craft's own up axis, which is why banking turns you: tilt the craft and part of its lift becomes a sideways push. One correction keeps Level mode calm: divide the thrust by the tilt, capped, so a banked craft holds its altitude through a turn instead of sliding down it. Gravity always applies, boost adds half the craft's full thrust again, and that is the entire engine. Four short ideas, and a pilot can hold a hover inside a minute of first touching the keys.
Lesson 4
First person flying lives or dies on the camera, and the camera has one secret: tilt it up. In the game this course teaches from, the camera sits right at the craft and is pitched up by 25 degrees, called the uptilt. It feels like cheating until you understand it. To move forward, a drone pitches its nose down. A level camera on a pitched down craft stares at the ground, and the pilot sees nothing but grass rushing up. Tilt the camera up by roughly the cruising pitch, and at speed the view sits level on the horizon, with the next gate in frame. Twenty to thirty degrees is the working range; 25 is a fine place to start.
Two more camera habits sell the speed for free. Let the field of view widen slightly as the craft accelerates, a few degrees between hover and full boost, and the world stretches at the edges the way it does in every racing film. And offer a chase view, the same craft watched from behind and smoothed, for players who find first person queasy. Both views are the same craft and the same physics; only the camera moves.
Lesson 5
Your controls are a first impression, so spend nothing the player has to learn twice. The layout that works: W and S for throttle, A and D for yaw, the arrow keys for pitch and roll, Space to boost, Shift for precision (it shrinks the maximum tilt to 60 percent, for threading gaps), and X to swap flight modes. Clicking the game captures the mouse and the keys; pressing Escape gives them back. Every one of those choices matches something the player has done in another game, so the tutorial your game needs is one line long.
Gamepads map one to one: the left stick is throttle and yaw, the right stick is pitch and roll, because that is how real drone radios are laid out, and any player arriving from a simulator will feel at home instantly. Whatever you do, never require the controller. Keyboard first, controller welcome, touch as two on screen sticks if you must. The test: hand the game to someone who has never seen it, say nothing, and watch whether their hands find the flying on their own.
Lesson 6
Acro mode is how real FPV drones fly, and it is a handful until it clicks, which is exactly why it is the graduation and not the starting point. The sticks stop picking angles and start commanding spin: hold the stick and the craft rotates at a set rate around that axis, flips and rolls included. Centre the stick and the craft holds whatever angle it has reached, even upside down. Nothing levels, nothing helps. It is also, once learned, far more expressive than Level mode, because the craft can do anything the pilot can imagine.
The feel lives in one small function. A raw stick would be unusable, twitchy in the middle where fine control lives. So the stick's travel is shaped by an expo curve: gentle near the centre, fierce at the edges. The curve used in the real game blends the stick value with its cube, weighted by an expo setting, then scales between a centre rate and a maximum rate. The resulting angular velocity is smoothed, integrated into the craft's orientation as a rotation each frame, and normalised. That is the whole of Acro: rates, one curve, one integration. Because Level mode already built the state, the inputs, the thrust, and the camera, Acro really is just a second branch in the same physics function.
Lesson 7
Every number that decides how the craft feels, the spin rates, the expo, the thrust to weight ratio, the maximum tilt, the yaw rate, belongs in one small table, not scattered through the code. The real game ships three rows. Chill: centre rate 140 degrees per second, maximum 420, expo 0.35, thrust to weight 3.2, maximum angle 38 degrees, yaw 160. Sport: 200, 670, 0.54, 4.3, 55 degrees, yaw 260. Insane: 260, 1000, 0.62, 5.8, 70 degrees, yaw 380. Same code, three different aircraft, and a settings screen becomes three buttons.
Ship Chill first, and make it the default every new pilot meets. When a playtester says the game feels sluggish or wild, you are not editing physics; you are nudging one row of one table, and you can do it live while they watch. This is also your difficulty system, your accessibility setting, and your expert mode, all for the price of six numbers times three rows.
Lesson 8
Flying in an empty sky is a screensaver. Flying becomes a game the moment the sky has a purpose, and the cheapest purpose ever invented is a line of glowing gates. The island racer uses thirteen: big rings, lit gold, placed so each one is visible from the last, threading the harbour, the lighthouse point, and the hill town into one readable lap. Gates teach the controls better than any tutorial text, because the next gate is always the obvious answer to the only question a new pilot asks: where do I go?
Placement is the craft. Keep the first three gates nearly straight and low, so the first lap is a success story. Vary height before you vary direction; climbing and diving feel like adventure while the steering is still easy. Put a gate somewhere beautiful on purpose, over the water at the lighthouse, say, so the course shows off your world. Then time the lap, show the split at each gate, and the sky has a sport in it.
Lesson 9
The finest opponent in a flying game is the pilot's own yesterday. Record the craft's position and orientation every frame of a lap, and when the lap is the pilot's best, save it. Next lap, play it back as a translucent ghost flying the same course. No networking, no matchmaking, no other players required, and yet every lap is a race: the ghost shows exactly where the time went, which gate was wide, which climb was lazy, in a way no split time on a scoreboard ever has.
Implementation is almost rude in its simplicity: an array of samples, a timer, and a second craft model with a see through material following the samples. Store the best lap in the browser's local storage so it survives between visits. In the island racer the ghost is the whole endgame: thirteen gates take a minute to learn and a month to master, because the person you are chasing is you, improving.
The five rules that keep it friendly
Lesson 10
How a flying game handles failure decides whether new pilots stay. The unfriendly way is a wreck, a menu, a restart from zero. The friendly way, and the way the island racer does it: freeze for two seconds, just long enough to laugh, and respawn at the last gate passed, still on the same lap. The punishment for a crash is two seconds and a little pride, so pilots attempt the daring line through the trees on their third lap instead of their thirtieth.
Then ship it, small and whole: one HTML file, no build step, no server, the flight model from Lessons 1 to 7, a gate course from Lesson 8, a ghost from Lesson 9. Playtest with one question in mind: can a person who has never flown finish a lap within three tries? If not, the answer is almost never more features. It is a gentler profile, a wider first gate, or two more degrees of uptilt. When a stranger finishes a lap and immediately turns around to beat their ghost, you have made a flying game.
Sources
Starvard is a free university being built right now by kind, hard-working people. Do a first small task with us, like checking a course, adding a book to the library, or testing pages on your phone, and get $10 for it.
Get $10: help us build →