Lap System - JR 01

A Checkpoint System for Racing Games


This is a system that tracks the player around the course. It counts the total number of checkpoints to know when a lap is made. Math is also used to measure the distance between 2 checkpoints, with curves and straightaways.

Naming the Checkpoints

The system is a little complex, but it’s overall easy to use. The checkpoints work by changing the name of each checkpoint object in the object settings. The name is set by the next turn after the checkpoint as Middle, Right, or Left (M, R, L), then a dash “-” and its own value (1 - 89).

For example: “R-1”

Where do you need to place the Checkpoints?

You want to place a checkpoint at the beginning and at the end of every different turn (up to 180’). Turns that are 180 degrees need to be even, but you could also use 90 degree turns if they need to be uneven. It’s important that the objects are named correctly for these turns. It’s also very important to not overlap your checkpoints. Overlapping would count as a single collision, and you could end up skipping checkpoints, which this system does not allow.

Map Data and Position

The “Map Data” object is also needed for this to work. This object gets the data from all checkpoints and puts in several lists that the player and CPU’s can use. It’s also important for the names to be set correctly to get the Data in the correct order.

And also inside the Lap bundle is a score value that gets the distance of the checkpoint, total number of checkpoints, and the total number of laps. This score can be sent to an object to sort out all the scores between all the Racers, and give the player a position.

12 Likes

How do you make those headings and subheadings?

Hashtags,

Hashtags,

and more Hashtags
1 Like

I’m using HTML formatting

<div align = center>

### Naming the checkpoints
<div align = left>
2 Likes

thanks

1 Like

This hurts my brain lol

JR, you’re insane! But, it’s also cool!
Losing your mind has never been cooler

3 Likes

I’ve tried several methods trying to find the best way to implement this.
As well as making the system automated so the checkpoints could be moved around without redoing a lot of code (also I realized that name is an extractor option).

What really made this possible is figuring out and getting a “Point to Line” bundle working so the distance calculated to the progress of the Track. I’ll leave a link below for that bundle example. The turns are a pain because you have angles like between 315 and 45 degrees. It was well worth the effort in the end, the Positioning System is Super Responsive!

5 Likes

Update:
It seems if the Racer Collides with another object on the same frame as the checkpoint,
the checkpoint doesn’t get triggered.

I added a new bundle that counts when you are close to the next checkpoint and doesn’t overwrite if a collision IS seen in the Racer. And since Collisions are still used for checks, the reverse check still works in this system.

3 Likes