Training a neural-network to race banner

Training a neural-network to race

4 devlogs
13h 49m 51s

This is a generational algorithm in python, which uses my previous game Kawaii Tank Miniature as a base to train an AI to race on a track using raycasts and mutation of the tank’s run with the best fitness from the previous generation.

This project uses AI

I used Claude to fix my absurd amount of bugs and apply constraints to the AI because I’ve got no idea how to do that. I think it did change some other minor stuff but I’m not sure what exactly, might have just tweaked a few settings.

Demo Repository

Loading README...

koshivf

So while I fixed the .exe file issue, I took that opportunity to work on the AI a bit more.
Though the first successful test was, indeed, very successful, with near to 0 collisiosn and stuff, I couldn’t manage to replicate this performance again and actually discovered a few new problems.
The AI could take the checkpoints backwards, so it often made laps in the wrong direction, as it seems to have less difficulty driving this way. So I fixed this and introduced one-way checkpoints.
I also tweaked the settings a bit and now it seems to be quite regular in its performances, managing to complete a full lap almost every time. However, it still goes in the wrong direction sometimes, but I’m too lazy to fix that at this point :)

0
koshivf

Shipped this project!

Hours: 12.93
Cookies: 🍪 177
Multiplier: 13.7 cookies/hr

I made a generational algorithm which trains an AI to race on a track over 30 generations using a fitness system. It uses raycast to “scan” its surroundings and guess whether it must turn, brake or accelerate and by how much. I encountered a lot of bugs I couldn’t fix, some even came from the original Kawaii Tank Miniature game, so I decided to ask Claude for help, and how surprising, after debugging everything, it actually worked, though a lot of tweaks were needed to better constrain the AI and enhance its performance.
But yeah now it works (I think).

koshivf

IT WORKS, IT FRICKIN WORKS YAAAAAAAY!!!!!!!!!!!!!
many updates:

  • now uses raycasts as a “scanner”
  • an actual waiting menu to see how the AI training is going (instead of a black screen)
  • completely changed how the fitness is calculated after like 30 tests
  • changed the checkpoints from invisible png images to simple lines
  • finally managed to stop the AI from spam crashing into the wall
  • a shitload of debugs thanks to Claude because damn things got so messy
  • many new constraints on the AI because he found many ways to cheat and that was hella annoying
    Yeah a lot happened it’s been like 2 months since last devlog and somehow just 6 hours logged, I guess my Wifi barely clinging to life didn’t help with that… but whatever it frickin works so I’m happy now :)
0
koshivf

Ok so now it does start at the right position, and it does pass through all 4 checkpoints as you can see, but let’s just say that there is room for improvement…

Attachment
0
koshivf

I think I finally managed to make it “work” as it “technically” functions, simply with extremely poor performances. This may be a bit harder than I expected…
Lots of problems I don’t understand like where are the script’s tanks even spawning in the first place and how do they manage to get off the track even though there should be a physical border that makes them bounce back on the track.

Attachment
0