Docs Tutorials
Take apart: Voxel Rally
Play a kart racer, then see how race gates, AI rivals, item boxes and a cup script make it a racing game.
In the editor: Welcome ▸ Tutorials ▸ 4.1 ▸ ▶ Start opens a fresh copy of Voxel Rally with this lesson's checklist.
Take apart · about 35 minutes · Advanced mode
What you'll learn: how a racing game is put together: gates that count laps, rivals with their own driving styles, item boxes, and a script that runs a cup.
Before you start: do Capstone: a roguelite with three generated floors, so you can read script graphs and Quick code.
#1. Play it first
Open Voxel Rally from the sample games on the welcome window's Start tab (or File ▸ New Project… and pick it) and press F5. In the Paddock, pick a single race on Sunny Ridge Circuit. Drive with WASD, hold Space to drift (a long drift ends in a boost), and drive through the spinning glass boxes. Press Shift or E to use the item you get. R puts you back on the road.
Then try a time trial and race your own ghost.
#2. Read the notes
Stop with Shift+F5 and switch to Advanced with Basic | Advanced on the toolbar, so the Explorer, the Scripts tab and every behavior setting show. Open Explorer ▸ Notes. Each note is pinned to the level, script or model it explains. Read the welcome note first, then keep the list open as you go.
#3. A track is a row of gates
Open the Sunny Ridge Circuit level. Checkpoint markers sit around the road, with the Script names Gate 1, Gate 2 and on. They show in the editor but not in the game. Click the marker on the start line: that's Gate 1. (Type race gate in the Explorer's filter box to list them all.) Look at its Race gate: Order, Width (tiles), Laps, Countdown first, and Seen while playing turned off.
This is the whole pattern: any level with a Race gate is a race. The countdown, the laps, the places, the wrong-way warning and the results all come from the engine. Gates must be passed in order, so a lap can't be cut short. The dirt shortcut by the S-bends counts because no gate sits on the part it skips.
#4. The rivals are Racers
Click Ruby's car on the starting grid (its Script name is Ruby). Its Racer behavior is its driving style: Results name, Top speed, Cornering skill, Lane (tiles) and Catch up. Compare the four:
| Rival | Style |
|---|---|
| Ruby | fast everywhere, late on the brakes, uses Catch up |
| Kai | best in corners, no Catch up |
| Moss | highest top speed, poor cornering |
| Juno | drives the outside lane |
Your own car is the player. Game Settings ▸ Driving sets its feel: Top speed, Acceleration, Steering, Grip, Drift and Boost.
#5. Items and boosts
Click a glass box: its Item box has Items (which race items it can roll) and Comes back after (s). The further back a racer is, the better the odds. The pads on the straights have Boost pad. Rivals grab boxes and use items too.
#6. The cup is code
Open the Scripts tab. The paddock (main control) is the menu: it asks with choice(), keeps your pick in game variables and calls load_level(). Race day (main control) runs on every race track. It compares race_place("Ruby") with yours to make a rival taunt when one passes you, then gives points by place from local pts = [10, 7, 5, 3, 1], fills the Cup standings HUD and loads the next track.
#7. Change it
- On Gate 1, set Laps to 1 for a quick race.
- Raise Moss's Cornering skill and watch him pull away.
- Set one box's Items to just
turbo. - In Race day (main control), give 15 points for a win instead of 10.
Play it now: run the cup and check each change. If you raised the car's top speed, raise the speed bar's max in the HUD too.
#Try it yourself
- Tick Ghost of your best lap on a cup track's Gate 1 and race the rivals and your ghost at once.
- Place another Boost pad before a hill and see if your lap time drops.
- Make a fifth rival from a copy of Juno's car with its own Results name.
#Learn more
- Racing: the race functions and HUD values.
- Behaviors and items.
- Game settings.
#Next
Get an email when Voxel Game Maker launches
It's coming to Steam with a launch discount. One email on launch day, the odd progress update, nothing else.