Trigger Rally: Unleashing the Potential of HTML5 Games

Craig Buckler

You’ve no doubt played a few HTML5 games. While they’re technically impressive, many are limited demonstrations or offer a simplistic gaming experience reminiscent of platformers, puzzles and shoot’em-ups we played in the 80’s and 90’s. Few game developers consider web browsers to be a good substitute for native OS or Flash code.

I thought the same. Until I played Trigger Rally Online.

Trigger Rally Online

The game is a JavaScript port of Trigger Rally, an open source single player 3D racing game for Linux written in C++. It uses canvas, WebGL and the three.js library.

The online edition works in WebGL-enabled browsers. That’s currently Chrome but also Firefox 10 if WebGL is enabled for your graphic card and you can live without sound. Even on modest hardware, you should achieve 20 frames per second. If you can’t play it, take a look at the YouTube video.

Technically, Trigger Rally uses a JSON-defined height map to for level geometry, a color map in combination with an image to paint the geometry, a foliage map to place plants on the landscape and checkpoint coordinates to define the race path. It should be possible to create your own maps so I wouldn’t be surprised if someone’s working on an online editor. Sound is generated using the Web Audio API. A standard engine loop is pitch-shifted in real-time as you accelerate and decelerate. It’s simple but effective.

Quite simply, the game is astounding. While it’s currently little limited to one car and course, it demonstrates the potential of HTML5 games. If anything, it’s better than any of the 3D games and examples I’ve seen created in Flash.

Do yourself a favor and “investigate” Trigger Rally Online. It’s Friday, after all.

CSS Master, 3rd Edition