RaceLab banner

RaceLab

9 devlogs
23h 1m 21s

It’s a Python program where you can build your own map / racetrack and drive it. Or you can also train AIs to complete runs as fast as possible, …or at least complete a lap to begin with that’d be more realistic…

koshivf

Bro I swear I’m straight up autistic I just switched the car’s width and height aaaarghh.
Well anyway more seriously I think the most important things were fixed.
I think I’ll add the AI’s lap time in the Training menu aside of the AI’s fitness.
But apart from that, I think the AI part is pretty much done, next step will be to finish to implement the Json Map thingy, basically I want to be able to export a map to a Json file and import it to load a map directly. That’d be sick.

1

Comments

Darko Sabo
Darko Sabo 1 day ago

kinda tuff

koshivf

I successfully implemented the AI training algorithm into the game. As you can see it does drive by itself correctly around the track, passing through every checkpoint, but I forgor to make the AI drive towards the finish line when one of its rays detects it, like I did for the checkpoint, so it never finished a lap…
And also you might notice the car sprite isn’t correctly oriented, dw about it
And There isn’t any info about the lap time or anything but don’t worry
And for some reason the training stopped after 5 generations instead of 30, but just, don’t worry…
Yeah I still got a lot of stuff to fix ig…

0
koshivf

Fixed some weird issues with collisions, so that it checked which of the 4 corner of the car touched the tile, making it a bit more accurate to the car sprite’s actual size and all, so that you didn’t have to pass the center of the car over the tile for it to activate.
But that caused issued on its own with the loop mode, as passing on the finish/spawn tile would mean that during the slight interval between which the front wheels touch the tile and when the rear wheels touch it, it would count as a lap so you would get 10ms lap times when you passed on the tile. So I implemented a mask the size of the car instead and now everything seems to work perfectly, though the collisions are still a little messed up but let’s not talk about that…

Attachment
0
koshivf
  • Added Checkpoint tiles, the order in which you place them is the one in which you need to drive through, you can visualize that order thanks to the checkpoint’s number written on the tile itself.

  • Furthermore, I’ve identified a problem, in some cases, like a racetrack design like a real one, the spawn point and the finish point are at the same place, but in other cases where you just race from point A to point B, similarly to Trackmania races, then you’re not actually doing laps in a circle, you just speedrun a finished trajectory. So I’ve created 2 categories of tracks: Loop and Point to point, the map automatically goes to Loop mode when you place the finish point on the spawn point, in which case you can drive laps infinitely. And when both points are separated, it goes to Point to point mode, where you don’t accomplish laps, so when you reach the finish point it ends and a pop up appears showing you your time and allowing you to retry with your all time best record and registered.

  • Oh and also I almost forgot but you can now rotate the spawn angle, when you select the spawn tool and hold r, you can use the mouse wheel and scroll to rotate it, allowing you to spawn in more appropriate directions rather than just straight up all the time.

0
koshivf

Added some car sprites, couldn’t exactly find what I was searching for but this gets the job done I guess.
Now before getting directly into the drive mode, it first pops up a menu to select a car model, which you can choose by pressing ENTER

0
koshivf

Finally implemented the drive mode, for now the car’s just a rectangle but I plan to add car sprites and a car selector menu. But for now yeah you can drive on your map and there are acceptable collision physics (this is terribly frustrating to work with) though I might have to tweak the car settings a bit cuz it seems a bit too fast sometimes.

0
koshivf

Made the menu bar at the botton of the screen visible because for some reason Windows was resizing the game window and croping the menu off, thnks windows…
So as you can see ladies and gentlemen you’ve got 4 tools at your disposition right now, a wall tool, a spawn tool, a finish tool and an erase tool (I lack the necessary creativity for proper names)
At the left side of the said-menu, you’ll find some hints on what keys do what, some are missing because otherwise it was too packed to properly see anything.
Then at the opposite side you’ll see useless information like the active tool if for some reason you couldn’t already notice it, and a display of the coords of the cell you are hovering with your cursor.

Oh and also I (Claude) fixed an issue where if you moved to fast it didn’t register the tiles you where placing so instead of a continuous line you ended up with random points everywhere. So I just copied the Bersenham line algorithm Claude spewed me and now it magically works idk how ╮( ▔-▔)╭

Attachment
0
koshivf

Added Panning and zooming and now the grid is supposedly infinite, contrarily to before when it was pretty limited, which wasn’t practical for map making.
Moreover, for safety reasons, the alpha amount for the grid color reduces gradually while zooming back otherwise we’d end up with a bright blue rectangle which activated my windows blue screen of death ptsd.

0
koshivf

Started making the map builder/editor, for resource optimization purposes (aka laziness) it’s a grid based system where you can turn each tile of the map into a wall, a spawn point or a finish point.
Now the problem is that you can place several spawn or finish point, which is weird cuz why would you have more than one of these, it’s not like you could spawn a 2 places simultaneously, so that must be fixed. Now that part is just the first step of the project, because ofc you still need to have a car you can drive on your map, and then the objective (if I have time and stuff) is to have AIs train on your map. So yeah., long way to go…

Attachment
0