Hill Country Drive: a 3D driving game in the browser

Muted preview Play the game
Play opens the game on its own page. Drive with touch or a keyboard.

Hill Country Drive is a free-roam 3D driving game in the browser. Choose the Street or Trail build, a paint color and options, then roam open hill-country roads with traffic, collect flags and finish a one-lap run. On a phone, you steer with an on-screen wheel; on a desktop, you drive with the keyboard. Want a break? Tap AUTO, and the truck drives itself.

What it does

Roam at your own pace, chase the flags, or sit back and let the truck drive.

  • Open roads, with traffic

    Roam freely on open hill-country roads, with traffic around you.

  • Flags and a one-lap run

    Collect flags as you drive and finish a one-lap run.

  • Two builds, 8 colors

    Pick the Street or Trail build, one of 8 paint colors, and options.

  • Made for thumbs

    Steer with an on-screen wheel or left and right buttons, then press GAS, BRAKE and DRIFT. On a desktop, use the keyboard.

  • Driver's-seat camera

    Ride behind the wheel, with a live gauge cluster in front of you.

  • It drives itself

    Tap AUTO, and the truck drives itself, cruising at 55 mph. By default, it goes for the flags.

  • Drifting

    Hold DRIFT above 13 mph while you steer into a turn, and the truck slides.

  • A real engine sound

    The engine sound comes from a real public-domain diesel recording.

  • One JavaScript file

    The game's JavaScript fits in one plain file, with no framework. It loads one 3D library, two fonts, its photos and its engine sound.

How this 3D driving game in the browser works

Four ideas do most of the work. Here is each one in plain English.

  • Real photos on a 3D truck

    The truck starts as two real public-domain photos. The game projects them onto a 3D model, the way a projector casts a picture onto a shaped screen, so the truck carries detail from a real photo. You then choose the build, one of 8 paint colors and options.

  • Drift physics

    Above 13 mph, hold DRIFT while you steer into a turn, and the truck slides through it. Keep GAS on and turn the wheel all the way as you press DRIFT. In tests at 40 to 60 mph, the slide averaged 28 to 34 degrees. Let go of DRIFT and the wheel, and the truck straightens out in under 2 seconds.

  • Touch controls

    On a phone, the steering wheel sits under your left thumb, and GAS, BRAKE, DRIFT and AUTO sit under your right. Tests checked the layout on two upright phone screens and one sideways, with no overlaps. On a desktop, you drive with the keyboard.

  • Self-driving

    Tap AUTO, and the truck takes over. It cruises at 55 mph, slows for bends and traffic, and by default goes for the flags.

The game on a phone held sideways, with the steering wheel at the left and the AUTO, BRAKE, GAS and DRIFT buttons at the right
A phone held sideways: the wheel on the left; AUTO, BRAKE, GAS and DRIFT on the right.
The view from the driver's seat, with a gauge cluster showing 47 mph
The driver's-seat camera, with the live gauge cluster.

Numbers

From the game's code file and from test runs.

  • ~170 KB The game's code, in one JavaScript file. The 3D library, fonts, photos and sound load as separate files
  • ~1,560 Lines in that one file
  • 28–34° Average slide angle in tests at 40 to 60 mph, with GAS on and the wheel turned all the way as DRIFT goes on
  • <2 s For the truck to straighten in those tests after you let go of DRIFT and the wheel
  • 3 Phone screens checked (390×844, 360×740, 844×390): no overlaps, no sideways scroll

Built with

One JavaScript file for the game, one 3D library and the browser's own audio, with no framework.

  • three.jsr128
  • WebGL3D graphics
  • Web AudioEngine sound
  • Plain JavaScriptOne JS file

Credits and licenses. The truck images start from two public-domain (CC0) photos on Wikimedia Commons. The sky photo and the road, ground, rock and bark textures come from Poly Haven. The engine sound comes from a CC0 recording on Freesound. The game uses three.js (MIT license) and the Inter and Barlow Condensed fonts (SIL Open Font License). This site serves all of these files itself.

Got an idea that should run in the browser?

Already live? Get a free audit of what you have today.

Start a project
Free audit