Log In  

Cart #fewefimugo-8 | 2019-09-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

how to play

Use z to accelerate and the arrow keys to turn.

Post

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:

Animated audience

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.

"Destructible" barriers

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

Tire tracks

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.

P#67699 2019-09-15 18:03 ( Edited 2019-09-15 19:16)

Neat! With enough polish for a first game, well done.

You may want to tweak steering behavior:

  • hitting track side often fully reverse car direction
  • steering angle should be proportional to speed (or add a bit of drift)

Good luck.

P#67705 2019-09-15 18:54
1

Hey Freds, thanks for your comment, I appreciate it. :)

I know the steering is kinda wonky. I've been tinkering with how collisions work all throughout development to get rid of the problem. In the beginning the collisions were basically modelled like ideal inelastic collisions with the barrier having infinite mass. I've replaced this model with an ad-hoc model for elastic collisions, but there's still situations where it feels really bad (mostly the situations where you hit a barrier face on, those are the situations when the car fully reverses direction). I'm not really sure how to make this better but I'll keep trying.

The steering angle was actually proportional to speed in the beginning, I got rid of this because with the wonky collisions it's even harder to regain control of the car if you can't turn at low speeds. If I ever solve the problem with the collisions, I'll change back to the old steering model.

P#67706 2019-09-15 19:12

As the track is a basic rectangle, perhaps have the steering so if for instance the car is facing up and needs to steer right, you just hold RIGHT until the car finally turns enough to be facing to the right and then turns no further. Same for the other directions. Up, Down, Left, Right.

Diagonal achieved by holding two arrow keys at a time.

Since the 4-arrow keys would be used, could have (O) to accelerate forward and (X) to put it into reverse (to back out of an obstacle).

As it is the steering currently is quite responsive and hard to manage in actual gameplay despite the brevity of the track.

P#67720 2019-09-15 23:24 ( Edited 2019-09-15 23:25)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-20 14:23:31 | 0.010s | Q:17