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:
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 :/
- left/right: turn
- up/down: accelerate/brake
- c: recover (when flipping over!)
Source code & tools: ghost-rally
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:
- G force (down)
- read tyre pushing car (with a lateral component to counter slide)
- front tyre and turning forces (again with a lateral component)
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)
Well done !
Graphism are really good, even if it is difficult to recognize the car (colors help a lot if you know it) I like the top down view.
+1 for ghost on 2nd lap
shooting people should give extra time :D
It is really difficult to control the car, you don't ride, you fight your car !
Do you think you'll try to improve the physics engine ?
Thanks for the links, it is really interesting !
The physics and rendering are really impressive. I'd love to hear more about how you're doing the texture mapping on the car. I haven't seen anyone do that with decent performance on Pico-8 before.
I guess I've gotten to used to modern racing games with analogue controls because I initially wanted to hold down the left/right keys to turn, but once I got used to just lightly tapping them the control felt pretty good. Then it just becomes a matter of anticipating the track to know when to slow down so you don't go sailing through the air off a steep hill.
I like the little touches of bumping objects around when you hit them and I had a little chuckle the first time I hit a spectator and a little angel floated up.
You tweeted a gif of a car selection screen, are you still intending to put that into the game or are you too limited for tokens?
@paranoidcactus: thanks but many other pico games used texture mapping before mine! (see @electrigryphon or @J-Fry work). My version is non-perspective correct (useless at this resolution) and uses the inner loop of @p01 trifill.
Pers. correct: left / Affine mapping: right (aka PS1 texture mapping :)
I am really short on tokens, the selection menu is definitely out - I misread the pico documentation and initially planned to have a loading screen cart, but it requires multicart :/
Other than that:
- w=1/z is linear in screen space, so is u/z (or u*w). Let that sink in and you should see the light :)
- deconstruct @p01 trifill (really boils down to rendering 2 trapezes).
Now use that to feed trifill with additional texture parameters, eg (x,y, w,uw, vw) - they can all be linearly interpolated... - and you are done ;)
Can you please tell me why you multiply the slip angle curve by the slip ratio curve? @ Line 490:
I'm trying to understand the tyre physics to make a racing game and I can't find an explanation about this equation on the internet.
Also, super cool game, thank you very much!
[Please log in to post a comment]