HTML5 + Box2D = Quick’N’Dirty Dakar Rally Sim

I very rarely mess with web development these days, but the power of current JavaScript engines and latest HTML5 features were just too juicy to pass on.

So sometime around early 2011, I took two afternoons and played with these technologies. Just now I remembered the project I had in hands, and decided I could give it a name and publish it on the net for your personal amusement.

Consider it pre-alpha, and expect bugs! 馃檪



  • Infinite landscape, using procedural generation (how else could I squeeze infinity into a few KBs?), and adaptive terrain features based on play style (namely, how fast you like to drive).
  • Somewhat realistic physics (based on Box2dJS library).
  • Incredibly detailed graphics engine based on WebGL. Nah just kidding, it’s the default HTML5聽canvas-based rendering provided by Box2D itself…
  • Physically-modelled rolling stones on the driving surface. Framerate suffers too much so they’re disabled by default. To re-enable, dive in the source code and hack away.
  • Tested on major PC browsers, and on Dolphin Browser Mini on Android.


  • right-arrow -> gas
  • left-arrow <- brake

Right now I’m in the middle of a physical home migration so the code is not githubbed yet, but you can access it by clicking the following link:

Quick’N’Dirty Darkar Rally Sim 2011

There’s no purpose as of yet, but you can try to race against the terrain and see how far you last before ending up on your roof or suffering a physics explosion.

License is GPLv3.


Mad oversteer

Some old vids in which I’m just the wheelman. Thanks to Darth Joules and Geert, the simracers who did the video capturing and editing (my crappy 1k ghz putter couldn’t handle all that stuff, 30 constant FPS was already a great achievement), and of course thanks to Eero Piitulainen for the excelent RBR physics (hope to see another physics engine of yours soon…).

Ahora lo que es en castellano: un par de viejos videos, de cuando sol铆a quemar rueda (virtual) semanalmente, en este caso con RBR. 聽Gracias a Darth Joules y Geert por la captura y edici贸n, y Eero por el brutal motor f铆sico que program贸 a contrarreloj para SCi y que a煤n hace vibrar a la comunidad. Una pena que el c贸digo se haya perdido en el limbo legal gracias a los 6 a帽os de abandono, los Ferraris de dudosa legalidad estrellados, la mierda que salpic贸 a Warthog Studios por sus relaciones con cierta mafia sueca de blanqueo, las detenciones de algunos CEOs y los consiguientes enchironamientos, y weno… mejor no seguir que escribo un libro 馃槅

Richard Alexander Burns

January 17, 1971 – November 25, 2005



Realistic Fractal Worlds

As you may or may not know, I’m involved in a pretty ambitious project, named Motorsport. Its purpose is to become the most realistic simulator of vehicles (usually cars), and as such, no ideas are being scrapped (as long as they contribute to the sim realism, that is).

There are a lot of ideas floating around. You can read about a couple of those new ideas here. However, I’m going to talk about something which you won’t find there: generation of real world 3d geometry and textures on the fly, with an unlimited level of detail.

Yeah, sounds gorgeus at first. But it’s not so gorgeus as it’s difficulty to code and get right (i guess).
The idea is to:

  1. Find a free (CC-licensed if possible) source of Earth data. We need both 2d textures and a 3d model, which can usually be found in the form of (unfortunately) freaking low-res textures and freaking low-res heightmaps.
    Possible sources:

    Ok, so that has nothing to do with fractal worlds.

  2. That’s where procedural contents come into play. Take a library such as LibNoise, take the aforementioned freaking low-res contents, mix them all in a bowl on the fly, and you can get 3d meshes and 2d textures with any level of detail you may want, perfectly consistent and reproducible across different computers.
  3. But this is a vehicle sim, so we must add some roads.
    Google Maps provides some road maps (as do many other websites such as Guia Campsa, but their data most probably can’t be used without paying royalties first)
    Then there’re some professionals who work creating landxml-compatible sets, which sometimes are not even possible to buy.
    And then there’s data created by regular people with their GPS-equipped cars, for example Open Street Maps.

    Once we got some good (or bad) road data, we drop it over the heightmap we got from point 1), seamlessly integrating it by using 3d mesh data and blended textures, and add some detail (bumps, side bankings, curbs, dust, camber, variable surface properties, …) in order to make the ride a bit more interesting.

Sounds easy, does it? Of course NOT. But it’s just a rough idea of what could be done in, say 23 years or so.. give or take a day 馃槈

Enough dreaming for now, I should go study something about OSs (Operating Systems, not Open Source Software! 馃檪

See ya!

Ps: yup, I’ve finally decided to write some posts in English, as I find it easier to find the words for technical subjects such as the one in this article. Plus English is a more efficient language when it comes to bandwidth! 馃槢