Tutorial Β· 5 steps Β· flight kit

Make a 3D flight game with AI

Did you ask an AI for a flight game and get a grey box that falls through the floor? A 3D game needs a camera, a sky, terrain, controls and a game loop to agree with each other. Ask for all of that at once and one of them breaks.

The flight kit has all of it working. A plane flies over endless low-poly hills, rings give you points and the score is how far you flew. It's one file and it runs on a phone. The five prompts below turn it into a desert course called Dune Flyer. Swap in your own world as you go.

Fly Pieter, the browser flight sim that started the vibe coding wave, was made 100% with AI. Three flight games on this shelf show where the idea goes after the kit.

Step 1: Change the world

Read index.html. It is a three.js flight game: a plane flies over endless low-poly hills, rings give points, and the score is distance flown. Change the world to a desert at sunset: sand-coloured hills, an orange sky, and fog that fades the far hills into the sky. Keep everything in index.html and add no new libraries.
What you see

the same plane and controls, flying over orange sand. The far hills melt into the sky.

If it goes wrong

the hills stop at a hard line on the horizon. The fog colour and the sky colour don't match. Paste this:

The far hills end in a hard line. Set the fog colour to the exact sky colour, and start the fog closer so the hills fade out before the edge of the world.

Step 2: Make it feel like flying

Make the plane feel heavier. Climbing costs speed and diving gains it. Below a stall speed the nose drops on its own until the plane picks up speed again. Show speed and altitude in a small HUD in the top left corner.
What you see

the plane slows on a long climb and the nose dips when you push it too far. Two numbers in the corner change as you fly.

If it goes wrong

the plane stalls the moment the game starts and you can't get it back. Paste this:

The plane stalls as soon as the game starts. Start it at cruise speed, and set the stall speed to half of cruise speed.

Step 3: Turn the rings into a course

Turn the rings into a course. Place a ring every 300 metres along a path that bends left and right and rises and falls with the hills. Start a 30 second timer. Each ring you fly through adds 3 seconds. When the timer hits zero, stop the plane and show the distance flown and a Fly again button.
What you see

a line of rings snaking ahead of you, a timer counting down and a game over screen when it runs out.

If it goes wrong

you fly straight through a ring at speed and it doesn't count. The game checks where the plane is each frame, and a fast plane skips past the ring between two frames. Paste this:

Rings don't count when I fly through them fast. Check the line the plane travelled between the last frame and this one against each ring, not only its position this frame.

Step 4: Add sound

Add sound with the Web Audio API only, no audio files. An engine hum whose pitch rises with speed, a short chime for each ring, and a low thud on game over. Add a mute button in the top right corner that remembers its setting in localStorage.
What you see

a hum that climbs as you dive and a chime on every ring.

Want a sound you can tweak first? Make one in the sound effect maker.

If it goes wrong

there's no sound at all, most often on a phone. Browsers block audio until the player taps or presses a key. Paste this:

There is no sound. Create or resume the audio context on the first tap, click or key press, and start the engine hum then.

Step 5: Add a title screen and a best score

Add a title screen with the name Dune Flyer, a Play button and the best distance so far, saved in localStorage. On game over, show the best distance next to this run's distance. Add a Share button that copies "I flew 2.4 km in Dune Flyer" with this run's distance and the page address.
What you see

a title screen before the first flight and your best run waiting there when you come back.

Want a pixel plane on the title screen? Draw one in the pixel sprite maker.

If it goes wrong

the best score reads NaN or null on a first visit. Paste this:

The best distance shows NaN on a first visit. When nothing is saved yet, treat the best distance as 0.

Where makers took it

Fly Hi, physics-first flight

Fly Hi

A flight simulator that leans into physics. Feel the lift and try not to stall.

@donvitoSee the game

Put it on the shelf

Flown your own course? Get it a public link with the hosting tutorial, then send it to us. Listing is free. Your game gets its own page and a place on the flight simulators shelf.

Submit your game

FAQ

Do I need to know three.js to make a flight game with AI?

No. The kit already sets up the scene, the camera and the plane, and the AI reads that code before it changes anything. When a prompt goes wrong, describe what you see on screen in plain words and paste that.

Will my flight game work on a phone?

The kit does. You drag to steer, and it keeps 60 frames a second on a mid-range phone because it skips shadows and post-processing. Play on your phone after each prompt, since a heavy change can slow it down.

Can I make it multiplayer like Fly Pieter?

Yes, with a server. The kit makes no network calls, so every player flies alone. For a shared sky, ask the AI for a small WebSocket server that sends each plane's position to the other players, and host it somewhere that runs code.