Log In  

Ghost Rally

Cart [#grally-0#] | Code | 2019-06-02 | License: CC4-BY-NC-SA | Embed
20

Game

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:
[61x16]
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 :/

Controls

  • left/right: turn
  • up/down: accelerate/brake
  • c: recover (when flipping over!)

Dev Log

Source code & tools: ghost-rally

Credits:

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

Physic Engine

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.

Car Physic

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!

Terrain

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":

Textured Car

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

Toolchain

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

P#64950 2019-06-02 14:33 ( Edited 2019-06-04 20:11)

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 !

P#64953 2019-06-02 15:39 ( Edited 2019-06-02 19:16)

Do you think you'll try to improve the physics engine ?
Unlikely - I spent weeks tweaking the car physics and I am literaly running in circle :)

P#64954 2019-06-02 16:33 ( Edited 2019-06-02 16:33)
1

Would it be possible to use the other action button instead of up for accelerating? Personally I think it would make it easier to control the car!

P#64956 2019-06-02 18:07

maaaaybe if I can find a couple of tokens :/

P#64959 2019-06-02 19:14

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?

P#64971 2019-06-03 11:58

@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 :/

P#64977 2019-06-03 19:43 ( Edited 2019-06-03 20:01)

Super cool!

About the texture mapping, I would also like to know where I can read about it. The others may have done it first, but they didn't include links to papers :)

P#64993 2019-06-05 04:03 ( Edited 2019-06-05 04:07)
1

@Catatafish Thanks
You want papers? sigh ;)
This is a classic: Chris Hecker

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 ;)

P#64999 2019-06-05 06:45 ( Edited 2019-06-05 21:08)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-08-25 00:08 | 0.087s | 4194k | Q:44