Counting Laps in a Race

After seeing few other tutorials and demo, I ended to set up a way to count the laps in a Race so that if you don’t follow the exact order or if you go in a wrong way the laps are not counted at all or you need to follow a longer path to have your laps counted.

I put a transparent layer on a first checkpoint that, when collided, ends itself and sends a message to a second checkpoint that adds itself and, again if collided, ends itself and sends a message to a third checkpoint or to the final plane that counts a lap and ends itself starting again the circle. In this way if you want to activate the final plane you have to follow every single checkpoint.

Do you think this is a too elaborated workflow? Is there a more consolidated way? I used only logic blocks and not pyton.


if it works, just use it?! :slight_smile:

using virtual gates does sound like the most sensible way to ensure a proper flow but rather than adding numbers why dont you concatonate gate letters so
gate 1 = a
gate2 =b
gate3 = c
therefore unless the current recorded path = “abc” then its not a lap. if it = ‘cba’ then they’ve definately gone the wrong direction!
The only other way I think you can do this is to use python to check that the orientation of the car is within certain range compared to an empty put at the finish line to decide wether its a valid lap depending on the direction the car crosses.

I guess if you managed to work this out as a script you’d be able to use it at key points to do what a lot of commecial racing games do which is to flash on the screen “wrong direction”

Im going to have a go to see if I can work up a bit of python for this

The letters clue sounds good, even if I should learn better the way to use the concatenated and recorded path. I used a simple logic blocks system; a little brainy but effective… and the loop is infinite.

A warning about the direction would be great, mainly for offroad tracks, but also for F1 like tracks because after a crash you could lose the orientation. In this case the check has to be done in real time for each frame and not for check points only. Maybe an always sensor compared to the direction of the path?

re the direction warning

Ive noticed that most games let you go a short distance the wrong way without warning I guess cos the overhead of constantly (every frame change) checking the direction would have a massive effect on the fps.

Another way Ive seen in games (like burnout) is a kind of 0ne-way wall that lets you go through one direction but not the other. I know you can make a face invisible but I dont know if there is any way of doing this. I’ll have a play.

A oneway wall is surely a kind of solution, even if takes you away the freedom to go around if you are only exploring the track after a race. You can put, one near the other, a solid transparent plane and a ghost plane. The ghost plane when collided ends itself and send a message to the solid plane that ends itself as well. If you are in a wrong direction you hit directly the solid plane that cannot be crossed.

Otherwise you can have some events: jump slope, closing gates, broken walls, etc.