Ghost Rally

Published 2023-06-12


The game is a race-against-yourself rally game. It features accurate rigid body physics and car handling.
Goal is to beat yourself every lap!

Enjoy racing as in the 80's, whith over powered cars very close to the public!
tip hitting any of the lil' dudes:

[0x0]
incurs a +5s time penalty :]

warning the game is complete yet the car handling is really picky - I am releasing it as is, as I can't tweak the gameplay without breaking the physic engine :/

Source code & tools: ghost-rally

Sound effect code: taken from @tiagosr rally game
Trifill: @p01

Physic engine was started from scratch following Barraf's 'classic' paper.
I quickly dropped this version as it relied too much on numeric convergence !

The current version uses part of Randy Gaul C++ physic library and underlying principles.
The key aspect to get stable collision is to resolve impacts only for the incident face, e.g. the plane most facing the ground:

This is obviously an heavily simplified version, limited to dynamic-to-static resolution.
Randy's engine architecture relies on very few magic constants and is extremely stable (well, as long as pico numbers don't get in the way!!).

The physic engine is designed as an extension a generic 3d actor class and can easily be taken out for other games.

The car is modeled using a front and rear tire. Each tire has lateral and longitudinal forces, as detailed in this article: The Racing Line - Combined Tyre Forces.
Other good readings:
Car Physics for Games
Box2d Top Down Racing Game

The gif above shows forces applied to the car and their application point:

Slip angle and slip ratio curves are defined using SFX 4 and 5 - tweak them to see effect in game!

The game started as a terrain renderer using marching squares.
Terrain height map is 64x64, displayed as a 128x128 grid to display marching square "diamond tiles":

The car is textured mapped, using a custom version of @p01 trifill.
The Blender model directly references an export of the cart spritesheet.

The game uses my usual Blender/Python export toolchain.
A custom terrain editor is available as a pico-8 cart (contact me if needed)