Behind the Scenes: Building a 3D Racing Game with SceneKit
ENGINEERINGAugust 10, 20268 min read

Behind the Scenes: Building a 3D Racing Game with SceneKit

When we set out to build Velocity Unleashed, we made a deliberate choice: no third-party game engines. Everything would be built with Apple's native frameworks. Here's how we pulled it off.

Why SceneKit?

SceneKit is Apple's built-in 3D framework that sits on top of Metal. While it's often dismissed as "too simple" for games, we found it surprisingly capable when pushed to its limits:

  • Metal-backed rendering gives us 60 FPS performance with complex scenes
  • Built-in physics engine (based on Bullet Physics) handles collisions and rigid body dynamics
  • Seamless SwiftUI integration lets us overlay HUD elements without performance penalty
  • Asset pipeline supports USDZ, DAE, OBJ, and SCN formats natively

The Track Curve: Our Key Invariant

The heart of every racing game is the track. Ours is defined by a parametric curve that must stay identical between the game engine and our asset generation pipeline:

angle = t × π × 2 × 1.6
x = sin(angle) × 190 + sin(angle × 2.8) × 28
z = cos(angle) × 125 + cos(angle × 2.1) × 20
y = sin(angle × 1.9) × 5.2

This curve generates smooth, realistic racing lines with elevation changes, sweeping turns, and natural camber.

240Hz Physics

We run our physics simulation at 240Hz using a fixed timestep clock (FixedStepClock). This is 4x the rendering frame rate and ensures that:

  • Grip calculations are precise even at high speeds
  • Collision detection never misses a frame
  • The feel of driving is smooth and predictable regardless of rendering performance

Procedural Audio

Perhaps the most satisfying technical achievement is our engine sound system. Using AVAudioEngine, we modulate audio loops in real-time based on RPM, throttle position, and speed:

  • Multiple harmonic layers blend together for realistic engine timbre
  • Exhaust pops trigger on deceleration
  • Tire screeches vary with lateral slip angle

What's Next

We're exploring Metal shader enhancements for dynamic weather effects and improved particle systems. Stay tuned for more technical deep dives.

comment0
LinkedIn
Sharing to LinkedIn?Rich 1200x630 Card
Copy a formatted technical post with relevant tags, or share directly.
PADDOCK CONVERSATIONS

Community Responses0

rate_reviewLeave a Response / Technical Question

Share feedback on this dev log, ask the engineering team a question, or discuss game mechanics with other racers.

Be respectful to fellow racers.
chat_bubble_outline

No comments yet.

Be the first to share your thoughts on this dev log!