r/ArtificialInteligence • • Oct 03 '26 • Bravo 1

šŸ“š Tutorial / Guide Explaining How AI Learns to Drive with Evolution

I love making hard things intuitive. I hope you enjoy this one!

This technique is called neuroevolution: training neural networks using evolutionary methods such as selection and mutation, without gradient descent.

Let me know if you have any questions.

Also shared to X: https://x.com/sinaatalay/status/2106270194817789968

1.5k Upvotes

167 comments sorted by

89

u/lazo40 Oct 03 '26

That’s really neat!! But like can the cars race on other tracks too or is it just this one??

121

u/egehancry Oct 03 '26

Actually, I haven’t tried that. I should have.

I could randomize the track throughout the evolution. Then, they should learn to drive on new tracks too.

20

u/VisionWithin Oct 03 '26

Looking forward to see that! I would also like that the car bodies also limit the observer line distances and a collision makes the cars stop their try.

21

u/egehancry Oct 03 '26

I did that in the beginning, but the training started getting trickier, and I had to add more inputs to the model (distance to the other cars). So I decided to keep it to one car for now.

I’ll explore this more in the next video :)

-21

u/[deleted] Oct 03 '26

[removed] — view removed comment

8

u/FrederickRon Oct 03 '26

You do realize this was just a fun experiment inside of a video game, right?

3

u/GianniV2 Oct 04 '26

did you hit your head when you were young?

2

u/just-a-nerd- Oct 04 '26

This is not even a LLM

3

u/filmgeekvt Oct 03 '26

Um, what?

5

u/Hairy_Talk_4232 Oct 03 '26

One of the next steps I think is progression; most of the cars in the lineup stayed in the same poace throughout the race, but one I noticed was able to overtake the one ahead of it, implying its weight parameters may be slightly more tuned to beating competition better than the others, so it may be worth to value that one as a next parent over one that simply won first place.

2

u/egehancry Oct 03 '26

Thank you! The next video will have these interesting aspects.

2

u/arebum Oct 03 '26

Definitely do that! A two layer network can "remember" just about anything, so if you overtrain it then its more likely just remembering the solution for this one track than learning how to drive. If you train it on random tracks, then you force it to learn how to drive instead of just remembering the solution

2

u/egehancry Oct 03 '26

Thank you! Next videos will be more rigorous.

1

u/VisualLerner Oct 03 '26

would be a good follow up video to show what overfitting is, which this probably is an example of given the context here

1

u/egehancry Oct 03 '26

Thank you. More videos will come...

1

u/theepi_pillodu Oct 03 '26

What do you mean by you never taught them to drive.

They aren't driving in some sense anyway.

BTW, You have the formulae, you gave them over 4k iterations. Practice makes man/bot perfect.

But in the last run, they didn't even try to overtake each other.

7

u/ChiefScout_2000 Oct 03 '26

In the last run they didn't try to overtake each other.

This proves competing AI models will just learn to get along! I feel so much better now.

2

u/Impossible_Way7017 Oct 03 '26

Or there was no penalty for collision. It’s likely they couldn’t overtake due to race start positioning, if each car is running the optimized route.

1

u/egehancry Oct 03 '26

Yes, there wasn't such thing as collision. The cars didn't knew there were other cars.

2

u/RobotechRicky Oct 03 '26

This also means that our new AI overlords will be benevolent to us. /s

2

u/TofuScrambleWrap Oct 03 '26

We did it reddit, we solved AI alignment

2

u/filmgeekvt Oct 03 '26

That wasn't the goal. The goal was to finish the track. That would need to be a different training.

1

u/WileyWilly1985 Oct 05 '26

I would love it if you did that, wish there was a way I could follow this I want to see that... OK, you will be the first redditor I ever followed (stalked) so don't let me down šŸ‘€ šŸ˜„

How long until you do random tracks so I can put it on my calendar.

This is seriously cool.

1

u/Stochastic-Ape Oct 05 '26

Have you consider training on one set of tracks while testing on another set of tracks? Basically walk it forward? If both sets of tracks are randomly generated would that work?

1

u/TuringGoneWild Oct 03 '26

Also have the second best one be a cop. It touches them, that branch of the tree gets pruned.

1

u/Hairy_Talk_4232 Oct 03 '26

One of the next steps I think is progression; most of the cars in the lineup stayed in the same place throughout the race, but one I noticed was able to overtake the one ahead of it, implying its weight parameters may be slightly more tuned to beating competition better than the others, so it may be worth to value that one as a next parent over one that simply won first place.

0

u/SatanRaptor Oct 03 '26

As in Neuroevolution of Augmenting Topologies? No I think he had the topology of the artificial neural networks predefined manually.

3

u/[deleted] Oct 03 '26

[removed] — view removed comment

2

u/egehancry Oct 03 '26

Will be clarified in the next videos.

1

u/rukh999 Oct 03 '26

In this case the specific track because it's success or failure is measured around this one track. A car that could run any track but wasn't quite as fast at this one for instance would not be selected for.

37

u/Disastrous-Action897 Oct 03 '26

This is awesome. I teach people about AI, often. This is a great an explanation in an understandable context.

8

u/egehancry Oct 03 '26

Thank you!

22

u/Fit-Tangerine-6006 Oct 03 '26

Great way to visually learn how AI works, more please!šŸ™Ā 

3

u/egehancry Oct 03 '26

Thank you, there'll be more.

8

u/SatanRaptor Oct 03 '26

I agree but I think we should be wary to just say AI works like this, and rather say evolutionary algorithms work like this

6

u/Fit-Tangerine-6006 Oct 03 '26

True, maybe a bit of context might work well, just a few sec intro about how this AI system fit into the general landscape of AI modelsĀ 

1

u/SpearandMagicHelmet Oct 03 '26

Agreed. This would be helpful OP. Including something like this in each of your videos would really up their value.Ā 

1

u/egehancry Oct 03 '26

Thank you very much. More videos will come, and general landscape of AI models will be clearer.

13

u/Smittumi Oct 03 '26

How could you make a function to make them want to win, as in improve their position over the other drivers?Ā 

It seems like if there was an AI F1 out would be pretty boring if they all just drive in the same perfect pattern.

22

u/egehancry Oct 03 '26

Currently, they’re trained to finish the lap as quickly as possible.

To train them to race against each other, I’d need to put them on the same track with collisions enabled, so they can learn to overtake without crashing into each other.

3

u/specialpatrol Oct 03 '26

The collision would make it orders of mag more complex wouldn't it? Would the rays then also need to return the relative speed of the thing they hit, to properly learn to perceived the cars moving ahead of them?

3

u/egehancry Oct 03 '26

Yes, there’ll be more information, and therefore more input values. But evolution should be able to figure it out as long as all the necessary information is there. More will come in the next videos.

1

u/Benjamin244 Oct 03 '26

I feel that the added layer of an extra output to evaluate makes it much trickier, because while a laptime is a straightforward value to optimise and select genes for throughout the evolutions, finishing position (while still going for optimal lap times) will require more context?

Do you prioritise car number 2 overtaking car number 1, or car 20 overtaking car 15?

1

u/egehancry Oct 03 '26

Maybe just let them race with F1 rules.

3

u/WenYiMedia Oct 03 '26

You’re recreating Gran Turismo or Need for Speed. Bots. But the elements and functions are so much more in those games. It’s a good start!

1

u/egehancry Oct 03 '26

Thank you.

1

u/rukh999 Oct 03 '26

I'm imagining using Forza Horizon 6. It already has an auto drive mode but you could randomly select every tuning calibration and have it find the perfect calibration for each track.

6

u/TheBusterHymenOpen Oct 03 '26

The real F1 race you mentioned is Monaco. The course is so tight that overtaking is difficult and you end up with a parade.

10

u/Perfect-Escape-3904 Oct 03 '26

You might like this guys videos, he’s been doing this with Trackmania for 5 years now.

He even has a similar presentation style to yours

https://youtu.be/a8Bo2DHrrow?si=s1ot9sPaogJhQEzD

3

u/egehancry Oct 03 '26

Thank you!

3

u/AleksZlovic Oct 03 '26

Adding weights is such a fascinating part of this. It’s still very nebulous to me, however. Any books someone can recommend on RL, BP, weights, and other stuff?

9

u/egehancry Oct 03 '26 edited Oct 03 '26

It’s been a while since I studied machine learning, but this course was really great. If you haven’t taken it yet, I’d recommend it:

Machine Learning by Professor Andrew Ng:

https://youtube.com/playlist?list=PLiPvV5TNogxIS4bHQVW4pMkj4CHA8COdX&si=-MRpE8eSTUmnPq5P

3

u/lotus_64 Oct 03 '26

Getting playlist doesn't exist. Could please share the playlist name

4

u/egehancry Oct 03 '26

Fixed. Thank you.

3

u/the_ai_wizard Oct 03 '26

its just brute force curve fitting

2

u/egehancry Oct 03 '26

That's ML and AI really.

2

u/the_ai_wizard Oct 03 '26

yep thats what im sayin'

3

u/Tube-Goblin Oct 03 '26

Great video. What breathe two functions? Are you ok to share the maths? Obviously ok if you don't.

11

u/egehancry Oct 03 '26

Thank you!

f and g are the two outputs of one small neural network.

Inputs (7 numbers):

The distance to the wall along 5 rays (0°, ±15°, ±45°, up to 100 m, divided by 30 m), the speed (divided by 30 m/s), and the car's angle to the road (radians). Let's call them x (column vector).

Neural Network (434 parameters):

first layer: h₁ = tanh(W₁x + b₁)     W₁ ∈ ā„Ā¹ā¶Ė£ā·,  b₁ ∈ ā„Ā¹ā¶,  h₁ ∈ ā„Ā¹ā¶
second layer: hā‚‚ = tanh(Wā‚‚h₁ + bā‚‚)    Wā‚‚ ∈ ā„Ā¹ā¶Ė£Ā¹ā¶, bā‚‚ ∈ ā„Ā¹ā¶,  hā‚‚ ∈ ā„Ā¹ā¶
result: y  = tanh(Wā‚ƒhā‚‚ + bā‚ƒ)    Wā‚ƒ ∈ ā„Ā²Ė£Ā¹ā¶,  bā‚ƒ ∈ ā„Ā²,   y ∈ (āˆ’1, 1)²

Wā‚– are weight matrices, bā‚– are bias vectors, and tanh is applied element-wise.

y = (y₁, yā‚‚):
  f(x) = y₁ = gas:    āˆ’1 = full brake … +1 = full gas
  g(x) = yā‚‚ = steer:  āˆ’1 = full left  … +1 = full right

f and g share the hidden layers h₁ and hā‚‚; f uses the first row of Wā‚ƒ and bā‚ƒ, g the second.

Number of parameters: (16Ā·7 + 16) + (16Ā·16 + 16) + (2Ā·16 + 2) = 434

Training:

20 cars start from random F1 grid slots and drive alone for 30 s. The 5 that get furthest survive unchanged as parents; 15 children are copies of them with Gaussian noise added to every weight, and each child also inherits a slightly mutated noise size (self-adaptive mutation). 4,000 generations; the first full lap came in generation 33.

Car Physics:

The car never slides, but its tyres have a grip budget shared between turning and braking (a "friction circle") that grows with speed (downforce). Arrive too fast and it can't turn tightly enough, so it has to learn braking points and lines.

1

u/Tube-Goblin Oct 03 '26

Brilliant. How does the noise contribute to the model drift? What is the percentage that affects the weights of the model?

2

u/egehancry Oct 03 '26

Actually, that’s a good question. I haven’t experimented with it much since I saw that the algorithm worked, but I probably should have. The next videos will include more of this kind of interesting information.

1

u/Positive_Method3022 Oct 04 '26

Why 7 inputs requires 16 neurons in the first layer? And why the second layer also uses 16 neurons?

1

u/egehancry Oct 04 '26

They are all arbitrary. You can choose any number. It worked and we got good drivers, so I didn't change it any further.

1

u/specialpatrol Oct 04 '26 edited Oct 04 '26

Really interesting thanks. Instead of the creation of children and addition of noise, you could use the race rank as the loss function and incrementally update the weights of all the cars towards that goal. This is more like a genetic algorithm isn't it? What do you think the difference is?

Thought about it. To update the weights against loss you'd need to create a loss function at each decision (change of position in race?). Whereas your method just updates the weights once per race.

3

u/Dany-GG Oct 03 '26

Do I need some crazy specs o my PC to replicate this?

4

u/egehancry Oct 03 '26

Not really, it's a very small model. Use JAX.

If you want to go super fast, you can use Modal (https://modal.com). It’s very affordable and easy to set up (your coding agent will do it for you).

4

u/Practical_Departure8 Oct 03 '26

Neat variation of genetic programming

1

u/Solrax Oct 03 '26

Yes, watching this before I read the comments I thought it was genetic programming. Can someone explain what is gained by adding the neural net?

3

u/egehancry Oct 03 '26

The evolutionary algorithm can optimize the parameters of any function. But if the function itself is not expressive enough to represent a good driver, no choice of parameters will make it one.

The neural network provides that expressive power: it gives you a function where some parameter settings can represent a good driving strategy. The evolutionary algorithm’s job is then to find those parameters.

2

u/Solrax Oct 03 '26

Thank you, a very concise and enlightening answer! I'll have to look into this more since I've always been interested in genetic programming.

1

u/egehancry Oct 03 '26

You're welcome! Good luck!

2

u/Sore6 Oct 03 '26

out of curiosity: instead of letting ai figure it oit completely - could you cut down training time / generations by showing a perfect lap yourself to the ai and learn from that one example so it alternates from there?

3

u/egehancry Oct 03 '26

Showing a perfect lap yourself gives you some training data, but, it doesn’t necessarily mean that you'll have the weights of the neural network that will drive like you.

You could use supervised learning to train the network to imitate your driving, but you would need much more data. A single lap would not be enough.

That’s the problem with this kind of task: we don’t have a large dataset of humans playing this game. With the evolutionary approach though, we can optimize the neural network without needing that data.

2

u/Sore6 Oct 03 '26

thanks for the reply, very interesting!

2

u/__asm__ Oct 03 '26

Pretty neat. Have you considered benchmarking it against some well-known self-driving 2D racing heuristics like: Vector Field Histogram, Potential Field Method, Follow-the-Gap, or Pure Pursuit?

Would be curious to see how it compares.

4

u/egehancry Oct 03 '26

Thank you. I didn’t, but I also didn’t push too hard to make this model perfect. I mainly wanted to make the video.

It would definitely be interesting to see how difficult it is to get the level of those models.

2

u/pfunf Oct 03 '26

Great video

1

u/egehancry Oct 03 '26

Thank you!

2

u/guttanzer Oct 03 '26

Nice work.

For the folks asking about higher-order behaviors like racing strategy and tactics, safety vs speed on varying tracks and so on, implementing those features would require a richer, more complex setup. This one is a great learning tool for its simplicity.

These cars are piloted by a feed-forward NN that is reacting to near-field observations and the most basic car model of a momentum vector. The only ā€œmemoryā€ in this setup is the momentum vector. The aircraft equivalent is the flight controller in a fly-by-wire aircraft.

Since the system has no memory of the track it reacts its way into turns. It doesn’t anticipate and plan ahead the way a real driver would. So tuning the weights in the NN is equivalent to tuning a F1 car by making tire choices and altering the wing and suspension settings - the evolutionary algorithm is optimizing performance parameters, not performance.

Given this setup, I’d create a few different track styles and compare the optimal car controllers on those. Make one track have only wide, sweeping turns. Make another city-block like, with sharp 90 degree turns. Have another with only increasing radius turns, and another sister track with only decreasing radius turns (equivalently, have them race in different directions on the same wonky track).

I suspect you will find that a car tuned for one track will be slow or unsafe on a different type of track. What you may learn is why.

2

u/egehancry Oct 03 '26

Thank you very much for the elaboration and the additional information.

5

u/Kinu4U Oct 03 '26

You should randomise the track everytime so they "evolve" to be able to race any track. It will take a few billions iterations instead of thousands.

4

u/According_Gift_7095 Oct 03 '26

ā€˜Nobody taught them’ is incorrect, you taught them with specific functions then had a computer calculate at scale all possibilities, removing those that did t work until all worked.

Love this and all computer progress, just take Jaron Lanier’s view that we should always think of this as ā€˜human collaboration’ vs some magic black box called ā€˜AI’ where the spark is coming from somewhere other than us, the creators, designers and input

1

u/TonyDRFT Oct 03 '26

Very interesting! It seems this is not the fastest line though, in racing you want to get as much speed possible at the exit of the corner (so it benefits from this speed the whole straight after the corner), this means sometimes sacrificing the corner entry speed and curve... Then there are several racing and breaking techniques based on physics, like weight transfer and resulting grip... etc

1

u/egehancry Oct 03 '26

That’s a good point. This comment explained it well: https://www.reddit.com/r/ArtificialInteligence/comments/1wwghrd/comment/pdma67i

It’s not the fastest line because the drivers don’t have memory. They only see their current distances to the walls, so they can only react to what they see at that moment. They don’t know what the track looks like ahead.

If we also feed the track data, and where they're at on it, they would learn.

1

u/loftyspy Oct 03 '26

This is genuinely very cool. Could you also link the game for me hehe, kinda a racing fan.

1

u/egehancry Oct 03 '26

Actually, I should make the game available online. And the models… Stay tuned, I’ll keep you posted. Thank you!

1

u/_ginj_ Oct 03 '26

Whats the compute time for each generation? Hardware?

2

u/egehancry Oct 03 '26

I used JAX on the CPU of a MacBook Pro (M4 Pro). It's a very small model (434 parameters), so a generation (20 cars, 30 seconds of driving each) takes about 0.1 s, and 4000 generations take around 7 minutes.

1

u/_ginj_ Oct 03 '26

That's so cool, thanks!

1

u/Infinite-Month-3454 Oct 03 '26

An elegant exposition of process.

1

u/egehancry Oct 03 '26

Thank you.

1

u/AppealSame4367 Oct 03 '26

You sound like Mark Zuckerberg :D

1

u/egehancry Oct 03 '26

I don’t know how to build a dam. 😁

1

u/geonber Oct 03 '26

fascinating thanks

1

u/egehancry Oct 03 '26

Thank you.

1

u/JasonMckin Oct 03 '26

Academic question: does the fact that the steering and gas were not explicitly programmed make it AI? or does the model itself have to evolve for it to be AI?

Because it seems like you could just have just explicitly programmed how steering and gas worked and then it would drive exactly the same.

So the learning was only at development time, not at runtime. At runtime, it’s just passively feeding sensor data to the model to get directions on steering and gas.

Does AI require runtime updates to the model or does any non-explicit programming get considered as AI even if there is no ongoing model learning at runtime?

1

u/egehancry Oct 03 '26

There's no standards body that defines these terms, so nobody can say "if it does X, it's AI." The precise term for this is machine learning: the behavior was learned, not written.

Explicit programming would be rules like "wall close on the left, steer right" or "corner coming, brake." I didn't write any of that. I programmed the car's physics (what gas and steering do), not the driver (when to use them). The driver is 434 numbers that evolution found, and nobody could write those by hand.

And no, it doesn't need to keep learning at runtime. Most models are trained once and then frozen. ChatGPT doesn't change its weights while you chat with it either.

1

u/JasonMckin Oct 03 '26

It is interesting that the video is described as AI learning to drive while the video shows the car in motion. Ā The car wasn’t in motion at all when the learning happened nor was any real-time information used to guide the driving. Ā 

I guess I’m just curious how non-explicit the learning here actually was. Ā There’s a kind of stokes theorem like equivalence here between explicitly programming behavior -versus- implicitly programming the boundaries of the behavior and supposedly ā€œlearningā€ the behavior from the boundaries. Ā I know that’s machine learning, but is it AI?

What exactly did the model learn or decide that wasn't fully specified by the setup? Ā Can the model handle any situations the developer didn't enumerate explicitly or implicitly? Ā Does the car ever make speculative or probabilistic decisions at runtime outside of the boundaries of its training conditions?

0

u/JasonMckin Oct 04 '26

I think you’re seeing some of my skepticism in others’ comments as well.

The question is whether simply turning an explicit program into an implicit one where you provide strict goals/boundaries and then use adaptive evolutionary optimization constitutes AI.

Newton’s method is a way to calculate roots of an equation without explicitly solving the equation. Ā It’s not AI, it’s just an implicit iterative approach to get to a solution.

It feels like there’s a difference betweenĀ  optimizing parameters for one particular fitness landscape versus building a generalized model that has to adapt at runtime to sensory input about the fitness landscape.

1

u/Impossible_Way7017 Oct 03 '26

How did you decide on the neural net architecture?

1

u/egehancry Oct 03 '26

Just trying out something, and seeing it works. 434 parameters was enough to learn.

1

u/Impossible_Way7017 Oct 04 '26

I feel like that’s my biggest challenge with neural nets if figuring out the architecture to use. Like naively why not 433 parameters

1

u/egehancry Oct 04 '26

It's all experimental. That's how modern ML is for sure today.

1

u/rawbdor Oct 03 '26

Why was a neural network required at all here? What did the neural network do?

Couldn't you just use genetic algortithms without a neural network to discover the optimal function definitions? Ninety percent of your success was based on the genetic nature of the algorithm, seeding the next generation from the prior generation's winners. At what point does the neural network actually come into play, and how?

I did a very similar project decades ago except there was no neural network, just a normal genetic algorithm to find the most efficient and accurate function definitions.

1

u/egehancry Oct 03 '26

The evolutionary algorithm can optimize the parameters of any function. But if the function itself is not expressive enough to represent a good driver, no choice of parameters will make it one.

The neural network provides that expressive power: it gives you a function where some parameter settings can represent a good driving strategy. The evolutionary algorithm’s job is then to find those parameters.

1

u/rawbdor Oct 03 '26

So is it fair to say you used AI to help design the algorithm and then you just let the generic algorithm run on its own? Or is that wrong?

Was there some back and forth between the AI component and the genetic component between runs?

1

u/egehancry Oct 03 '26

Not quite. The neural network isn't a separate AI that helped design anything. It is the function the evolutionary algorithm evolves.

In your project, the genetic algorithm searched over function definitions directly. Here I fixed the form of the function by hand: a small neural network, which is just one big formula (multiply, add, squash with tanh, three times) with 434 adjustable numbers. The algorithm only mutates these 434 numbers, nothing else.

So there's one loop and no back and forth: a standard evolutionary algorithm whose individuals happen to be neural networks. That combination is called neuroevolution.

1

u/Tribun4201 Oct 03 '26

If the track doesnt change, isnt this just machine learning instead of AI?

1

u/egehancry Oct 03 '26

There's no standards body for these terms, but generally these are AI/ML topics.

1

u/kidjupiter Oct 03 '26

Great explanation. Now, just add a "pain" factor that each driver experiences when they crash and watch them eventually refuse to race. Then, sit back and watch the AI psychosis backlash to your "cruel" experiments.

1

u/egehancry Oct 03 '26

Thank you. More videos will come.

1

u/ConcertoInX Oct 04 '26

This is a neat presentation of evolutionary computing! One theory question for further exploration I have is, how confident are you that this process avoids getting stuck at local optima, i.e. might the AI be locking into a driving profile too early? Would some evolutionary processes like including crossover or doing simulated annealing see a more comprehensive search for the "best" driving profile?

2

u/egehancry Oct 04 '26

Thank you very much.

I think it’s very hard to be fully confident. But at least you know the theoretical lower bound on the lap time, roughly (track length) / (maximum speed), so you can get some sense of how far the result is from optimal.

Beyond that, you can experiment with things like the magnitude of noise added to the weights in each generation and compare the results. A lot of it is experimentation and looking at the data.

I don’t know much about annealing or crossover, but I’m sure there’s much more that could be done.

1

u/Positive_Method3022 Oct 04 '26

You didn't explain how many layers and how many nodes in each layer in the neural network are chosen. Can you explain that?

1

u/egehancry Oct 04 '26

I explained the math in detail here: https://www.reddit.com/r/ArtificialInteligence/comments/1wwghrd/comment/pdkkz06

The neural network shown in the video is exact: it has 2 hidden layers with 16 neurons each.

3

u/Aggravating-Catch461 Oct 03 '26

if anyone is interested, there is a game on steam on this principle: https://store.steampowered.com/app/3312030/AI_Learns_To_Drive/

3

u/sleo82 Oct 04 '26

If you're curious about this topic, I would recommend looking at this course (the videos are free online). It shows how the real world problems like localization, PID controls, etc are solved in self driving cars. Most of these can be solved without using a neural network. But would be interested to see how your neural network evolves to handle things like sensor errors, changing courses, unknown maps, etc.

https://omscs.gatech.edu/cs-7638-robotics-ai-techniques-course-videos

2

u/New-Ingenuity-5437 Oct 03 '26

What are some good ways to try neural evolution stuff. I’ve seen videos for many years on this stuff and it’s always been so cool

2

u/JoseLunaArts Oct 03 '26

Now lets do some drafting.

2

u/fitm3 Oct 03 '26

Now they need to learn to over take and not collide :)

2

u/Cold-Permission-5249 Oct 03 '26

Now give them the goal to win.

2

u/johndsmits Oct 03 '26

You're taking the LOS approach which will get stable quickly. It's how missile ATR systems run (for decades).

Once you get there them tackle vehicle on the track, should end up fairly predictable.

2

u/kgold0 Oct 04 '26

Consider car collision and drag!!! Then start adding different factors to each individual car (engine, tires, aerodynamics, accelerating, braking, handling)!

And maybe have it auto select the parents for the next generation (even have it decide what makes a good parent for the next generation).

2

u/AdAstramentis Oct 04 '26

Next level is to train on incline/decline or curved paths which will cause different physics on trajectories.

2

u/ProbablyCarl Oct 04 '26

Now turn crash physics on.

2

u/Equal_Animator7440 Oct 04 '26

Does System 1 thinking models simplify the whole evaluation?

I imagine the inputs are the distances and the model decides on turn right, turn left, or straight as output.

2

u/molumen Oct 04 '26

Now add car collisions and watch them learn overtaking. That will look like real drivers' behavior.

2

u/Antique-Wonk Oct 04 '26

This is really cool. Need to try for sure.

2

u/Witty-Elk2052 Oct 04 '26

moar evolution 🧬

2

u/6gv5 Oct 04 '26

Interesting, they end up choosing almost the same exact trajectory, which makes sense as all cars are essentially the same and they race on the same track. Might be worth giving each car some slightly different parameters (power/acceleration, max speed, weight, drag, braking, etc) so that they all need to evolve from initial training, possibly ending up developing "personalized" racing styles.

2

u/Massive_Lavishness90 Oct 04 '26

uh dude, have you seen the game "AI learns to drive" on Steam? It's basically this.

2

u/NoMindZen Oct 04 '26

šŸ‘€

2

u/DJ_Flugscham Oct 05 '26

This is great.

2

u/fokac93 Oct 05 '26

Nice. Ai doesn’t even know it’s driving it is just calling functions

3

u/SirGelson Oct 03 '26

Overfitted.

1

u/haux_haux Oct 03 '26

Feel bad / feel good?

1

u/smrt_pants Oct 03 '26

Not sure the comment, ā€œno body taught them to driveā€ is true. You gave it a set of formulas and kept picking the best performance as an input to the start of the next race. You technically taught the model to be better with each iteration, so what did the AI do for itself?

1

u/infamouslycrocodile Oct 05 '26

Amazing video but we should crack down on "nobody taught them to drive". If by "nobody" you mean the environment then that makes sense but like evolution in our plane of existence these car creatures too have been taught by the nature of their existence.

1

u/Historical_Ice_1844 Oct 06 '26

I've built (Claude did with my assistance) something based on your post: credits at bottom

https://neuroevolution.useful-shit.org

1

u/AmphibianTurbulent58 Oct 06 '26

I should have paid more attention in math class, 🤣🤣 I got the logic tho

1

u/bull_bear25 Oct 06 '26

Looks a bit overfittingĀ 

1

u/Popular-Elephant-884 Oct 07 '26

This is so cool. Thank you.

1

u/zulutune Oct 07 '26

To achieve this only in 400 generations is beyond my intuition, I find that miraculous.

I have a question though: when you create these different drivers in each generation, how do you make sure to not randomize too far of the ā€œparentā€?

1

u/Prize-Bee9481 Oct 09 '26

For anyone interested there's a whole free course on YouTube where someone builds this using vanilla JavaScript to build the neural network and do all the drawings (in primitives) too. He even visualises the network diagram.

1

u/awesam9 Oct 23 '26

You have a repo ?

0

u/Illustrious-Egg5459 Oct 03 '26

how much of this video did AI generate? obviously the script, and the voice. the visuals too?

1

u/egehancry Oct 03 '26

All of this work is generated by me sitting in front of my laptop and talking to Claude Code.

0

u/Pazienca Oct 03 '26

Anyone else can't stand this AI voice anymore?

-3

u/WillTheyKickMeAgain Oct 03 '26

What does it mean no one taught them to drive? The whole approach, programmed by a human, teaches them to drive. Let’s not think this is some sort of magic and forget what we’re doing here.Ā 

2

u/egehancry Oct 03 '26

But nothing in it tells them how to drive. All you are doing is picking the best drivers, making slightly changed copies of them, and repeating that thousands of times. I wouldn't call that teaching driving, but yes, we invented the system to produce the model that knows how to drive.

1

u/WillTheyKickMeAgain Oct 03 '26

Knows? It has optimized some parameters. It has no clue that this is anything to do with driving.

-6

u/FootballPositive1044 Oct 03 '26

Nothing special, ai slop. There is trackmania based videos that has explored this concept ages ago and much better.Ā 

2

u/redditMacha Oct 03 '26

This one was good. Op or creator did a good job. Will check out trackmania

1

u/egehancry Oct 03 '26

Thank you.

1

u/[deleted] Oct 09 '26

[removed] — view removed comment

1

u/egehancry Oct 09 '26

More will come!