Levelwick guide
How to make a racing game with AI
Make a fun top-down or endless racing game with an AI game maker: handling numbers, laps and checkpoints, opponents, touch controls and bug fixes.
Steps
- Choose the racing style. Decide between a top-down lap racer, an endless lane dodger or a side-view hill climb. Each needs different controls and rules.
- Describe handling in numbers. Specify time to top speed, how fast the car slows down, how steering changes with speed, and what happens off-road.
- Add laps and checkpoints. Ask for invisible checkpoints so laps can't be skipped, and for a lap timer with a best lap.
- Add touch controls. Request on-screen buttons for steering and gas/brake, sized for thumbs.
- Add opponents. Ask for computer cars that follow a list of checkpoints with small speed differences.
- Polish the feel. Add skid marks, a speed effect, a countdown and a results screen with a rematch button.
Pick a racing style that fits one prompt
Racing covers very different games. Before writing your prompt, choose one:
- Top-down lap racer: a looping track, laps, checkpoints and maybe rivals.
- Endless lane dodger: the road scrolls, you switch lanes and avoid traffic.
- Side-view hill climb: physics, terrain and balance in the air.
Trying to mix them in a first prompt usually produces a game that does none well.
Handling is the game
Words like "realistic" or "arcade" don't tell an AI much. Numbers do:
The car reaches top speed in about 2 seconds, coasts to a stop over 2 seconds, can't turn when stopped, and turns tightest at medium speed. Driving on grass halves top speed.
Speed-dependent steering is the detail that stops a car feeling like a mouse cursor. If the result still feels wrong, ask for a hidden tuning panel with sliders and copy the values you like into your next prompt.
Make laps fair
A finish line alone lets players drive backward across it. Ask for checkpoints: three or four invisible gates that must be passed in order before a lap counts. Add a lap timer and a best lap stored in the browser so players have something to beat even without rivals.
Simple rivals work best
"Smart" AI drivers are hard to get right in a generated game. Instead, ask for cars that steer toward the next checkpoint in a list, with each car given a slightly different top speed and a small random wobble. That produces believable races and is easy to tune.
Phones need their own controls
Tilt controls can be unreliable across devices and browsers, so start with buttons: left/right at the bottom left, gas/brake at the bottom right, each at least 64 px and supporting multi-touch so players can steer and accelerate at once.
Bugs you'll probably meet
- The car goes through walls at speed: "Move the car in small steps each frame and check walls after each step."
- Laps count twice: "A lap only counts after all checkpoints are passed in order; reset the checkpoint index when a lap completes."
- Too fast on some screens: "Use delta time from requestAnimationFrame for all movement."
Finishing touches
A 3-2-1-GO countdown, skid marks while turning hard, a results screen with total time and a Rematch button make a small racer feel complete. Add a ghost car of your best lap later if you want a strong single-player hook.
FAQ
Should I ask for 3D?
Start in 2D or pseudo-3D. They're more reliable in generated games, and the handling matters more than the camera.
Why can I skip half the track?
The lap probably only checks the finish line. Ask for ordered checkpoints that must all be passed.
How do I make opponents feel fair?
Give them slightly different top speeds and keep them on a checkpoint path. Avoid rubber-banding that makes them suddenly faster.
Does tilt steering work?
It can, but support varies by device and browser and may need permission. Offer on-screen buttons as the default.