Overview
Expert blueprint for racing games balancing physics, competition, and sense of speed.
When to Use
Use this skill when building any racing game genre including:
- Arcade racers (Need for Speed, Burnout style)
- Kart racing games (Mario Kart style)
- Realistic racing simulators (Assetto Corsa, Gran Turismo style)
- Time trial / ghost car systems
- Multiplayer competitive racing
- Any game requiring vehicle physics, checkpoint systems, AI opponents, drift mechanics, or racing UI
Core Loop
- Race: Player controls a vehicle on a track.
- Compete: Player overtakes opponents or beats the clock.
- Upgrade: Player earns currency/points to buy parts/cars.
- Tune: Player adjusts vehicle stats (grip, acceleration).
- Master: Player learns track layouts and optimal lines.
Skill Chain
| Phase |
Skills |
Purpose |
| 1. Physics |
physics-bodies, vehicle-wheel-3d |
Car movement, suspension, collisions |
| 2. AI |
navigation, steering-behaviors |
Opponent pathfinding, rubber-banding |
| 3. Input |
input-mapping |
Analog steering, acceleration, braking |
| 4. UI |
progress-bars, labels |
Speedometer, lap timer, minimap |
| 5. Feel |
camera-shake, godot-particles |
Speed perception, tire smoke, sparks |
Prerequisites
- Godot 4.x project with 3D setup.
- Input actions mapped:
right, left, forward, back (or equivalent analog axes).
- Basic understanding of
VehicleBody3D and VehicleWheel3D.
Procedure
1. Vehicle Controller Setup
- Create a
VehicleBody3D node.
- Attach
VehicleWheel3D nodes for each wheel.
- Load
scripts/arcade_vehicle_physics.gd when implementing high-performance arcade handling with custom gravity, air control, and friction-slip drifting.
- Load
scripts/raycast_suspension.gd when configuring spring/damper models for raycast wheels with configurable stiffness.
- Implement steering and engine force:
# car_controller.gd
extends VehicleBody3D
@export var max_torque: float = 300.0
@export var max_steering: float = 0.4
func _physics_process(delta: float) -> void:
steering = lerp(steering, Input.get_axis("right", "left") * max_steering, 5 * delta)
engine_force = Input.get_axis("back", "forward") * max_torque
2. Checkpoint System
- Place
Area3D nodes sequentially along the track.
- Load
scripts/lap_tracker.gd for high-precision lap management with sequential checkpoint logic.
- Load
scripts/racing_checkpoint.gd for indexed trigger gate modular track-based lap progression.
- Implement validation:
# checkpoint_manager.gd
extends Node
var checkpoints: Array[Area3D] = []
var current_checkpoint_index: int = 0
signal lap_completed
func _on_checkpoint_entered(body: Node3D, index: int) -> void:
if index == current_checkpoint_index + 1:
current_checkpoint_index = index
elif index == 0 and current_checkpoint_index == checkpoints.size() - 1:
complete_lap()
func complete_lap() -> void:
current_checkpoint_index = 0
lap_completed.emit()
3. Race Manager
- Create a high-level state machine for race states (COUNTDOWN, RACING, FINISHED).
- Use
await for async countdown timers.
# race_manager.gd
extends Node
enum State { COUNTDOWN, RACING, FINISHED }
var current_state: State = State.COUNTDOWN
var elapsed_time: float = 0.0
func start_race() -> void:
await countdown()
current_state = State.RACING
func _process(delta: float) -> void:
if current_state == State.RACING:
elapsed_time += delta
func countdown() -> void:
var count = 3
while count > 0:
await get_tree().create_timer(1.0).timeout
count -= 1
4. AI & Competition
- Load
scripts/spline_ai_controller.gd when implementing professional racing AI using Path3D predictive steering and rubber-banding logic.
- Load
scripts/slipstream_handler.gd when adding drafting zones with relative dot-product checks for speed boosts.
- Implement rubber-banding to keep races competitive:
class_name RubberBandingSystem extends Node
@export var player_vehicle: VehicleBody3D
@export var base_speed: float = 120.0
func update_ai_speed(ai_car: VehicleBody3D) -> void:
if not is_instance_valid(player_vehicle):
return
var dist = ai_car.global_position.distance_to(player_vehicle.global_position)
var ai_is_ahead = ai_car_is_ahead_of_player(ai_car, player_vehicle)
if ai_is_ahead:
ai_car.max_speed = base_speed * 0.9
else:
ai_car.max_speed = base_speed * 1.1
func ai_car_is_ahead_of_player(ai_car: VehicleBody3D, player: VehicleBody3D) -> bool:
var forward_dir = -player.global_transform.basis.z.normalized()
var to_ai = (ai_car.global_position - player.global_position).normalized()
return forward_dir.dot(to_ai) > 0.0
5. Drifting & Boost Mechanics
- Implement drift by reducing friction or applying sideways force.
- Load
scripts/arcade_vehicle_controller.gd for an alternative tight, raycast-based vehicle movement model for non-physics karts.
- Implement Drift-Boost (Mini-Turbo) by accumulating charge and applying
apply_central_impulse():
class_name DriftBoostSystem extends Node
@export var vehicle: VehicleBody3D
var drift_charge: float = 0.0
const BOOST_MULTIPLIER = 1000.0
var is_drifting: bool = false
func _physics_process(delta: float) -> void:
if not is_instance_valid(vehicle):
return
if is_drifting:
drift_charge += delta
elif drift_charge > 0.0:
execute_boost()
func execute_boost() -> void:
if is_instance_valid(vehicle):
var boost_force := -vehicle.global_transform.basis.z * (drift_charge * BOOST_MULTIPLIER)
vehicle.apply_central_impulse(boost_force)
drift_charge = 0.0
6. Visuals, Audio, & UI
- Load
scripts/skid_mark_emitter.gd when implementing conditional tire-slip trail systems for persistent visual feedback.
- Load
scripts/engine_audio_controller.gd for RPM-to-pitch audio synthesis for engine revving and gear shifts.
- Load
scripts/minimap_icon_projector.gd for 3D-to-2D bridge for projecting racers onto a localized UI.
- Load
scripts/force_feedback_router.gd for haptic and rumble management based on terrain and collisions.
- Load
scripts/ghost_recorder.gd for binary transform serialization for lightweight ghost car playback.
- Attach
GPUParticles3D to wheels for tire smoke, toggling emitting based on wheel.get_skidinfo() < 0.5.
- Use
SubViewport for rear-view mirror or minimap texture.
- Use
Doppler effect on AudioListener for realistic passing sounds.
Pitfalls
Physics & Handling
- NEVER use a rigid camera attachment; strictly use a Smooth Follow pattern with
lerp() to prevent motion sickness.
- NEVER prioritize realism over fun; strictly increase Gravity Scale (2x-3x) and keep friction high for responsive arcade feel.
- NEVER use
VehicleBody3D default settings for karts; strictly rewrite suspension using Raycasts or custom spring/damper models.
- NEVER apply steering torque directly to mass; strictly use a steering curve factored by lateral velocity.
- NEVER calculate suspension without a damper model; strictly include damping to prevent eternal oscillation (bouncing).
- NEVER ignore the Center of Mass property; strictly offset it downward to ensure stability during high-speed turns.
- NEVER multiply engine force by
delta; it is an integrated force in the physics solver.
- NEVER rely on
is_action_pressed() for manual gear shifting; strictly use is_action_just_pressed() for single-tap accuracy.
AI & Competition
- NEVER use static AI speeds; strictly use Rubber-Banding to keep races competitive based on player distance.
- NEVER run AI pathfinding across the entire track every frame; strictly use a "Look-Ahead" point on a spline/path.
- NEVER ignore racing Checkpoints; strictly enforce sequential
Area3D validation to prevent track shortcuts.
- NEVER use standard
Area3D for slipstreaming without a Dot Product check to ensure the player is directly behind.
Visuals & Audio
- NEVER skip "Sense of Speed" effects; strictly implement dynamic FOV scaling, motion blur, and high-speed camera shake.
- NEVER update minimap transforms for static elements in
_process(); strictly update dynamic racers only.
- NEVER serialize ghost cars as mass transform lists; strictly store positions/quaternions at fixed intervals.
- NEVER use constant pitch for engine sounds; strictly map RPM or engine load to
pitch_scale.
- NEVER spawn particles for skid marks every frame; strictly use Trail3D or procedural strips for low-cost persistence.
- NEVER use standard Strings for surface detection; strictly use
StringName (e.g., &"asphalt").
Security & Deprecation
- NEVER expose raw file paths when saving ghost data; always sanitize and use
FileAccess with the User directory to avoid path traversal.
- NEVER rely on the deprecated
yield() for async; use await with Callable or Signal as shown in the Race Manager.
- NEVER store sensitive player telemetry in plain text; encrypt or hash if transmitting over network.
Verification
Related skills
- godot-master - Master Godot skill reference
physics-bodies - RigidBody3D, VehicleBody3D physics fundamentals
vehicle-wheel-3d - Wheel configuration, suspension tuning
navigation - Path3D, NavigationServer for AI pathfinding
steering-behaviors - Seek, flee, arrival for AI movement
input-mapping - Analog input handling for steering/acceleration
progress-bars - Speedometer, fuel gauge, boost meter UI
labels - Lap timer, position counter, sector times
camera-shake - Impact, rumble, high-speed shake effects
godot-particles - Tire smoke, sparks, dust trails
1---
2name: game-godot-genre-racing
3version: 1.1.1
4description: "Blueprints Godot 4 racing: VehicleBody3D and VehicleWheel3D, sequential checkpoints, rubber-banding AI, drift-boost, speed-FOV camera, lap UI, and ghost cars. Use when building arcade, kart, or sim racers, time trials, or track vehicle physics. Not for Godot MultiplayerAPI/RPC (networking-multiplayer) or non-racing vehicle sandboxes. Do not use for 2D platformers or other genre chairs."
5risk: safe
6source: openrouter-deepsearch
7date_added: 2026-06-16
8metadata:
9 source: https://skillmd.com/skills/kayforkind/game-godot-genre-racing
10---
11
12## Overview
13Expert blueprint for racing games balancing physics, competition, and sense of speed.
14
15## When to Use
16Use this skill when building any racing game genre including:
17- Arcade racers (Need for Speed, Burnout style)
18- Kart racing games (Mario Kart style)
19- Realistic racing simulators (Assetto Corsa, Gran Turismo style)
20- Time trial / ghost car systems
21- Multiplayer competitive racing
22- Any game requiring vehicle physics, checkpoint systems, AI opponents, drift mechanics, or racing UI
23
24### Core Loop
251. **Race**: Player controls a vehicle on a track.
262. **Compete**: Player overtakes opponents or beats the clock.
273. **Upgrade**: Player earns currency/points to buy parts/cars.
284. **Tune**: Player adjusts vehicle stats (grip, acceleration).
295. **Master**: Player learns track layouts and optimal lines.
30
31### Skill Chain
32| Phase | Skills | Purpose |
33|-------|--------|---------|
34| 1. Physics | `physics-bodies`, `vehicle-wheel-3d` | Car movement, suspension, collisions |
35| 2. AI | `navigation`, `steering-behaviors` | Opponent pathfinding, rubber-banding |
36| 3. Input | `input-mapping` | Analog steering, acceleration, braking |
37| 4. UI | `progress-bars`, `labels` | Speedometer, lap timer, minimap |
38| 5. Feel | `camera-shake`, `godot-particles` | Speed perception, tire smoke, sparks |
39
40## Prerequisites
41- Godot 4.x project with 3D setup.
42- Input actions mapped: `right`, `left`, `forward`, `back` (or equivalent analog axes).
43- Basic understanding of `VehicleBody3D` and `VehicleWheel3D`.
44
45## Procedure
46
47### 1. Vehicle Controller Setup
481. Create a `VehicleBody3D` node.
492. Attach `VehicleWheel3D` nodes for each wheel.
503. Load `scripts/arcade_vehicle_physics.gd` when implementing high-performance arcade handling with custom gravity, air control, and friction-slip drifting.
514. Load `scripts/raycast_suspension.gd` when configuring spring/damper models for raycast wheels with configurable stiffness.
525. Implement steering and engine force:
53```gdscript
54# car_controller.gd
55extends VehicleBody3D
56
57@export var max_torque: float = 300.0
58@export var max_steering: float = 0.4
59
60func _physics_process(delta: float) -> void:
61 steering = lerp(steering, Input.get_axis("right", "left") * max_steering, 5 * delta)
62 engine_force = Input.get_axis("back", "forward") * max_torque
63```
64
65### 2. Checkpoint System
661. Place `Area3D` nodes sequentially along the track.
672. Load `scripts/lap_tracker.gd` for high-precision lap management with sequential checkpoint logic.
683. Load `scripts/racing_checkpoint.gd` for indexed trigger gate modular track-based lap progression.
694. Implement validation:
70```gdscript
71# checkpoint_manager.gd
72extends Node
73
74var checkpoints: Array[Area3D] = []
75var current_checkpoint_index: int = 0
76signal lap_completed
77
78func _on_checkpoint_entered(body: Node3D, index: int) -> void:
79 if index == current_checkpoint_index + 1:
80 current_checkpoint_index = index
81 elif index == 0 and current_checkpoint_index == checkpoints.size() - 1:
82 complete_lap()
83
84func complete_lap() -> void:
85 current_checkpoint_index = 0
86 lap_completed.emit()
87```
88
89### 3. Race Manager
901. Create a high-level state machine for race states (COUNTDOWN, RACING, FINISHED).
912. Use `await` for async countdown timers.
92```gdscript
93# race_manager.gd
94extends Node
95
96enum State { COUNTDOWN, RACING, FINISHED }
97var current_state: State = State.COUNTDOWN
98var elapsed_time: float = 0.0
99
100func start_race() -> void:
101 await countdown()
102 current_state = State.RACING
103
104func _process(delta: float) -> void:
105 if current_state == State.RACING:
106 elapsed_time += delta
107
108func countdown() -> void:
109 var count = 3
110 while count > 0:
111 await get_tree().create_timer(1.0).timeout
112 count -= 1
113```
114
115### 4. AI & Competition
1161. Load `scripts/spline_ai_controller.gd` when implementing professional racing AI using Path3D predictive steering and rubber-banding logic.
1172. Load `scripts/slipstream_handler.gd` when adding drafting zones with relative dot-product checks for speed boosts.
1183. Implement rubber-banding to keep races competitive:
119```gdscript
120class_name RubberBandingSystem extends Node
121
122@export var player_vehicle: VehicleBody3D
123@export var base_speed: float = 120.0
124
125func update_ai_speed(ai_car: VehicleBody3D) -> void:
126 if not is_instance_valid(player_vehicle):
127 return
128
129 var dist = ai_car.global_position.distance_to(player_vehicle.global_position)
130 var ai_is_ahead = ai_car_is_ahead_of_player(ai_car, player_vehicle)
131
132 if ai_is_ahead:
133 ai_car.max_speed = base_speed * 0.9
134 else:
135 ai_car.max_speed = base_speed * 1.1
136
137func ai_car_is_ahead_of_player(ai_car: VehicleBody3D, player: VehicleBody3D) -> bool:
138 var forward_dir = -player.global_transform.basis.z.normalized()
139 var to_ai = (ai_car.global_position - player.global_position).normalized()
140 return forward_dir.dot(to_ai) > 0.0
141```
142
143### 5. Drifting & Boost Mechanics
1441. Implement drift by reducing friction or applying sideways force.
1452. Load `scripts/arcade_vehicle_controller.gd` for an alternative tight, raycast-based vehicle movement model for non-physics karts.
1463. Implement Drift-Boost (Mini-Turbo) by accumulating charge and applying `apply_central_impulse()`:
147```gdscript
148class_name DriftBoostSystem extends Node
149
150@export var vehicle: VehicleBody3D
151var drift_charge: float = 0.0
152const BOOST_MULTIPLIER = 1000.0
153var is_drifting: bool = false
154
155func _physics_process(delta: float) -> void:
156 if not is_instance_valid(vehicle):
157 return
158
159 if is_drifting:
160 drift_charge += delta
161 elif drift_charge > 0.0:
162 execute_boost()
163
164func execute_boost() -> void:
165 if is_instance_valid(vehicle):
166 var boost_force := -vehicle.global_transform.basis.z * (drift_charge * BOOST_MULTIPLIER)
167 vehicle.apply_central_impulse(boost_force)
168 drift_charge = 0.0
169```
170
171### 6. Visuals, Audio, & UI
1721. Load `scripts/skid_mark_emitter.gd` when implementing conditional tire-slip trail systems for persistent visual feedback.
1732. Load `scripts/engine_audio_controller.gd` for RPM-to-pitch audio synthesis for engine revving and gear shifts.
1743. Load `scripts/minimap_icon_projector.gd` for 3D-to-2D bridge for projecting racers onto a localized UI.
1754. Load `scripts/force_feedback_router.gd` for haptic and rumble management based on terrain and collisions.
1765. Load `scripts/ghost_recorder.gd` for binary transform serialization for lightweight ghost car playback.
1776. Attach `GPUParticles3D` to wheels for tire smoke, toggling `emitting` based on `wheel.get_skidinfo() < 0.5`.
1787. Use `SubViewport` for rear-view mirror or minimap texture.
1798. Use `Doppler` effect on `AudioListener` for realistic passing sounds.
180
181## Pitfalls
182
183### Physics & Handling
184- NEVER use a rigid camera attachment; strictly use a **Smooth Follow** pattern with `lerp()` to prevent motion sickness.
185- NEVER prioritize realism over fun; strictly increase **Gravity Scale** (2x-3x) and keep friction high for responsive arcade feel.
186- NEVER use `VehicleBody3D` default settings for karts; strictly rewrite suspension using Raycasts or custom spring/damper models.
187- NEVER apply steering torque directly to mass; strictly use a steering curve factored by lateral velocity.
188- NEVER calculate suspension without a damper model; strictly include damping to prevent eternal oscillation (bouncing).
189- NEVER ignore the **Center of Mass** property; strictly offset it downward to ensure stability during high-speed turns.
190- NEVER multiply engine force by `delta`; it is an integrated force in the physics solver.
191- NEVER rely on `is_action_pressed()` for manual gear shifting; strictly use `is_action_just_pressed()` for single-tap accuracy.
192
193### AI & Competition
194- NEVER use static AI speeds; strictly use **Rubber-Banding** to keep races competitive based on player distance.
195- NEVER run AI pathfinding across the entire track every frame; strictly use a "Look-Ahead" point on a spline/path.
196- NEVER ignore racing **Checkpoints**; strictly enforce sequential `Area3D` validation to prevent track shortcuts.
197- NEVER use standard `Area3D` for slipstreaming without a **Dot Product** check to ensure the player is directly behind.
198
199### Visuals & Audio
200- NEVER skip "Sense of Speed" effects; strictly implement dynamic **FOV scaling**, motion blur, and high-speed camera shake.
201- NEVER update minimap transforms for static elements in `_process()`; strictly update dynamic racers only.
202- NEVER serialize ghost cars as mass transform lists; strictly store positions/quaternions at fixed intervals.
203- NEVER use constant pitch for engine sounds; strictly map RPM or engine load to `pitch_scale`.
204- NEVER spawn particles for skid marks every frame; strictly use **Trail3D** or procedural strips for low-cost persistence.
205- NEVER use standard Strings for surface detection; strictly use `StringName` (e.g., `&"asphalt"`).
206
207### Security & Deprecation
208- NEVER expose raw file paths when saving ghost data; always sanitize and use `FileAccess` with the `User` directory to avoid path traversal.
209- NEVER rely on the deprecated `yield()` for async; use `await` with `Callable` or `Signal` as shown in the Race Manager.
210- NEVER store sensitive player telemetry in plain text; encrypt or hash if transmitting over network.
211
212## Verification
213- [ ] Verify VehicleBody3D center of mass is offset downward for stability
214- [ ] Confirm gravity scale is set to 2.0-3.0 for arcade feel
215- [ ] Test checkpoint system prevents shortcuts (sequential validation)
216- [ ] Verify rubber-banding AI adjusts speed based on player distance
217- [ ] Confirm drift mechanic reduces lateral friction and provides exit boost
218- [ ] Test camera uses smooth follow (lerp) not rigid attachment
219- [ ] Verify FOV scales with speed for sense of speed
220- [ ] Confirm engine audio pitch maps to RPM/engine load
221- [ ] Test ghost recorder uses binary serialization (PackedVector3Array)
222- [ ] Verify skid marks use Trail3D not per-frame particles
223- [ ] Confirm minimap only updates dynamic elements in _process()
224- [ ] Test slipstream uses dot product for behind-check
225- [ ] Verify suspension includes damper model (no eternal oscillation)
226- [ ] Confirm steering uses curve factored by lateral velocity
227- [ ] Test gear shifting uses is_action_just_pressed() not is_action_pressed()
228- [ ] Ensure no deprecated `yield()` calls remain in scripts
229- [ ] Validate all file I/O uses sanitized paths within `user://` directory
230
231## Related skills
232- [godot-master](../godot-master/SKILL.md) - Master Godot skill reference
233- `physics-bodies` - RigidBody3D, VehicleBody3D physics fundamentals
234- `vehicle-wheel-3d` - Wheel configuration, suspension tuning
235- `navigation` - Path3D, NavigationServer for AI pathfinding
236- `steering-behaviors` - Seek, flee, arrival for AI movement
237- `input-mapping` - Analog input handling for steering/acceleration
238- `progress-bars` - Speedometer, fuel gauge, boost meter UI
239- `labels` - Lap timer, position counter, sector times
240- `camera-shake` - Impact, rumble, high-speed shake effects
241- `godot-particles` - Tire smoke, sparks, dust trails