Race 1.0

Published 2023-06-12


Use z to accelerate and the arrow keys to turn.

Hey everyone,
this is my first post here, so hopefully I'm doing everything correct.

I discovered PICO-8 around two weeks ago and was intrigued by its design philosophy. As someone who is only interested in Game development as a hobby, I love that basically all tools needed for developing a small game.

So I've been playing around with the program for the last two weeks and decided that the best way to learn how to use PICO-8 (and Lua, as I never used that language before) was to develop a small game.

The result is this small racing game against the time (as I don't have any idea how to write an AI for a racing game) with two tracks. The gameplay is nothing to write home about but I'm still quite fond of the end result.

In principle it's pretty easy to add more tracks, just "draw" them on the map screen with the sprites. However, I didn't bother to write a code that automates the finish-line or the creation of checkpoints along the track, so those have to be set in code.

Some small things I personally find neat:

Upon loading a track, the game checks for any audience sprites set in the map editor and replaces them with animated audience objects.
The animated audience will slowly bob up and down if the player is far away and will bob up and down fast and throw confetti if the player is close by. The confetti is done using a simple particle system, randomly spawning in particles with a random velocity and a fixed acceleration along the y-direction to make the particles "fall to the ground".
The distance to the player is checked using a modified Euclidean norm (basically n(x,y) = sqrt(x^2 + (a*y)^2) with 0<a<1) that deemphasizes the distance in y-direction. As long as the audience is mostly setup along a horizontal line along parts of the track that go along x-direction this means that the audience only reacts to the player as he's/she's driving past them but the player doesn't have to be super close to the curb in y-direction.

When the game detects a collision with one of the barrier sprites, the corresponding sprites are are replaced by "broken" versions of the object.

I used the particle system to draw tire tracks behind the car. Unfortunately handling the tire tracks this way it was too much of a drain on the performance to have them permanent.