A.I. teaches itself to drive in Trackmania


A.I. teaches itself to drive in Trackmania, using NEAT algorithm, which is a particular type of Genetic Algorithm. This algorithm is used to select a neural network with optimal weights, and also an optimal structure.
Thanks Trabadia ! His PLclip channel : plclip.info
More information about NEAT algorithm :
Contact :
Discord - yOsh_85#5919
Twitter - yoshtm1


  • Yosh
    Yosh4 miesięcy temu

    Thanks for watching this video ! This is the first time i'm using NEAT algorithm, so there is obviously still room for improvement. The main problem is that my AI doesn't have a map memory, and can't anticipate "what comes next" with its current inputs. I have some ideas to improve my AI, so don't forget to subscribe if you want to see the next steps of this project ;)

  • matix676


    17 godzin temu

    "Did he sell it?" "Yes" "Increase ze price"

  • Azriel Jale

    Azriel Jale

    Dzień temu

    Yosh you shouldve put a wr human time as red car to each iteration. Just for comparisons sake.

  • Jeff Talbot

    Jeff Talbot

    7 dni temu

    Yea....LOTS of room for improvement. I'm not sure we learned anything.

  • stayox


    11 dni temu

    la vidéo est intéressante mais désolé je suis obligé de mute parce que l'accent anglais x)

  • Diophantine


    19 dni temu

    There are two easy paths as I see it. Either evolve a vector map which outline the flow path that the car should follow (which could include acceleration), or add progress of car through as input and slightly expand the model so that it can use the input. Either path I imagine should result in improved results. If you're lucky, the training time may go down significantly.

  • Florin Balanescu
    Florin Balanescu29 minut temu

    From my experience, Q-learning (or DQNN if you're also using it in conjunction with NNs) it's a much harder problem to solve/converge. For the generational approach of the RL, have you thought of having some other information picked up way in front of the current car like, the next turn/curve or the next 2 turns as 2 additional input floats, or even the distance to them (+2 floats)? That would be to alleviate lack of track memory. It is clear that a human that masters the track would first have to learn it, so in order to match it with an AI, we would probably want to help it remember the next turn or couple of turns in advance. Waiting for your next videos.

  • Technicalities
    Technicalities5 godzin temu

    me at 13:32 ewwww what is that

  • ltviktor
    ltviktor12 godzin temu

    anyone know the song starting at 8:42 ? none of the apps recognized it :/

  • David Konevky
    David Konevky12 godzin temu

    I feel like this would have worked much better if the AI was punished for touching the wall

  • The Refuge
    The Refuge13 godzin temu

    French accent ?

  • Minovsky Addict
    Minovsky Addict17 godzin temu

    I feel like if you had imposed a penalty for striking the wall the plateau wouldn't have happened as as early as it did, even your best times were still nailing the wall and using the collision to reduce speed to get around the sharper corners.

  • Agent Smith
    Agent Smith17 godzin temu

    It might take millions of tries instead of just a hundred to get one that can compete with humans.

  • NJ
    NJ18 godzin temu

    Generalization seems so cool. Quite a human-like trait, very impressive.

  • GAMERMAYNE Nicholson
    GAMERMAYNE Nicholson22 godzin temu

    you could add a distance travelled component to the fitness function to accelerate its progress towards corner cutting, weighting distance in higher proportions in the later runs could help

  • feh meh
    feh mehDzień temu

    This is why sperm.

  • Suckynewb
    SuckynewbDzień temu

    Yea the biggest flaw is that it's not really learning "How to drive", it's just learning to navigate this track through trial and error. If it was able to "see" walls and knew walls=bad, it would be able to learn new tracks and possible complete them on the first run. Then throw in some scaling rewards for reaching checkpoints in a certain amount of time and you've got a racer.

  • John Doe
    John DoeDzień temu

    13:32 might be one of the most beautiful things ive seen in a video game.

  • Wahya Danuwoa
    Wahya DanuwoaDzień temu

    Would doing something similar to this with "creatures" be possible to help students understand genetics and evolution? Including predation and prey, and other survival abilities. Maybe throw in chaos for mutation?

  • Yosh


    Dzień temu

    Take a look at "Primer" on youtube ;)

  • Azriel Jale
    Azriel JaleDzień temu

    You shouldve put a wr human time as red car to each iteration. Just for comparisons sake.

  • Matt Bland
    Matt BlandDzień temu

    Talking about algorithms, the PLclip one is injecting a Google Chromebook advert every 30 to 90 seconds or so at the moment making the video unwatchable.

  • Wapn Perfo
    Wapn PerfoDzień temu

    Perhaps that is humanities greatest attribute. Being able to grasp a concept quickly, and adapt them to new situations, where A.I is completely lost, a human can be largely on point within a small amount of time.

  • Damir Maatar
    Damir Maatar2 dni temu

    Fait les vidéos en français aussi

  • Funkyray87
    Funkyray872 dni temu

    Beautiful. Like it's alive. Finding it's way.

  • Funkyray87
    Funkyray872 dni temu

    Bro....This was amazing. The editing. The music. Good stuff!

  • NIB
    NIB2 dni temu

    You should make hitting a walk give negative fitness then the ai would start avoiding the wall and safe time

  • Pelayo González
    Pelayo González2 dni temu

    Ok, now do it with cars collitions phisics between them

  • Modo FL - Cod Bot
    Modo FL - Cod Bot2 dni temu

    J'aime ton accent français 🥲✨

  • GC Studios
    GC Studios2 dni temu

    you should delete all of the A.I. ecept the good ones then combine their KNOWLEGE!!!!

  • Mijc Osis
    Mijc Osis3 dni temu

    Im reaching in the dark but i suspect one reason the vehicles didnt end up faster was your initial selection criteria - outright speed selected for vehicles that were going too fast at the second checkpoint to make it round the hard right following, so it never learned to slow down rather than bounce off. If you try again i would love to see if initially selecting for going in the right direction and avoiding walls and then selecting for speed might lead to faster results form the genetic algorithm in the longer term?.

  • Papa Pill
    Papa Pill3 dni temu

    13:30 that was super trippy

  • Turbo
    Turbo4 dni temu

    Get a life

  • Samuel Dwyer
    Samuel Dwyer4 dni temu

    this is like the nature of competition

  • Guia Gaston
    Guia Gaston4 dni temu

    This ma chin learning seems pretty cool

  • Harsh Nemesis
    Harsh Nemesis4 dni temu

    Where are you from? lol

  • Harsh Nemesis

    Harsh Nemesis

    2 dni temu

    @Greeneetch Y. The thick accent would suggest that yes

  • Greeneetch Y.

    Greeneetch Y.

    3 dni temu

    Maybe India ?

  • cytroyd
    cytroyd4 dni temu

    Nice Hacknet OST. Do more of AI stuff. Super sick.

  • Dylan Riley
    Dylan Riley4 dni temu

    This guys using the same music as Sebastian Lague

  • Thomas GAUTHIER
    Thomas GAUTHIER4 dni temu

    l'accent anglais tmtc

  • JEsterCW
    JEsterCW4 dni temu

    I love to see those ants🦉

  • pfarabee
    pfarabee5 dni temu

    You should add a heavy cost to hitting the wall, if that is something that can be measured in the run. You also would get better times if you gave them more information about what is coming up ahead of them. Right now they are reacting blindly to what is right in front of them, which means they cannot position themselves for upcoming turns as effectively. In your friend's run, as an example, he knows there is a right turn coming up, so he positions himself accordingly on the straightaway before any actual indication of a turn is directly in front of him, because he's human and knows it is coming. Give them that knowledge somehow as well and they will do much better. For example, these inputs might help.. info for 2 turns, maybe 3 (On your map, 2 turns would be fine.. if the map is very bendy, 3 turns might be a good idea for input): Turn 1 is defined as the next turn ahead of this vehicle. Turn 2 is the one after that, etc. Distance until start of turn1 (from current position, measured along center line): 200m Degree of turn1 : 35/-35 (right vs left, degrees or radians) Arc distance of turn1: 100m (how long the turn is, measured along center line) Distance of straightaway1: 10m (how long is the straightaway after turn1, if there is one...possibly not needed.. it can perhaps consider this number based on the distance to turn2?) Distance until start of turn2 (from current position): 310m Degree of turn2 : 45/-45 (right vs left) Arc distance of turn2: 50m (how long the turn is, measured along whichever line.. outer, inner, center) Distance of straightaway2: 500m (how long is the straightaway after turn2, if there is one......possibly not needed.. it can perhaps consider this number based on the distance to turn3?)

  • Ronny Mühle
    Ronny Mühle5 dni temu

    This looks great! Do you also buffer one frame? I did some similar experiments and noticed it's beneficial to have 2 or 3 timesteps as inputs for the neural network. Then your AI will be able to predict trajectories based on the frames before. (it would have a perception of speed) This is not exactly a map memory, but at least a very short term knowledge. They will then brake and accelerate better on curve entries or exits.

  • Rémi
    Rémi6 dni temu

    You should have make the selection about trajectory and then with time/checkpoint It doesnt work well cause like evolution not the best strategy (trajectory) remains but the ones which survive (finish the race) You have to do something we did for dogs : choosing the best traits you need and select them

  • Oliver Helenius
    Oliver Helenius6 dni temu

    Now make them learn how to drive on ice!

  • Don Haul
    Don Haul6 dni temu

    How was it possible to measure wall distances, does trackmania have an sdk or something?

  • Simon Lorenz
    Simon Lorenz6 dni temu

    Google should start the project "AlphaMania"!

  • Txp 2.0
    Txp 2.07 dni temu

    Cet accent est incroyable 😂

  • Alvaro Learns Things
    Alvaro Learns Things7 dni temu

    Love this video and you are the frenchest man alive

  • Cliff Smith
    Cliff Smith7 dni temu

    It looks like what you're simulating there is fluid flow under constant pressure, not controlled driving. Perhaps if you included an output for braking it might work better?

  • Daniël Bot
    Daniël Bot7 dni temu

    I don’t know anything about this, but isn’t it possible that you do like ten pretty good runs and the the evolution thing on that that it improves your scores?

  • Hugo Belle
    Hugo Belle7 dni temu

    Frero fait des vidéos en français aussi

  • Greeneetch Y.

    Greeneetch Y.

    3 dni temu

    Y'a moins de visibilité sur ça.

  • Tathar
    Tathar8 dni temu

    Would supervised learning be able to work off of world-record replays of a track?

  • Evro Craft
    Evro Craft8 dni temu

    Now put it on a PF map

  • Shueb Abdullahi
    Shueb Abdullahi8 dni temu

    13:28 me after watching 🟧⬛

  • Dream Gang
    Dream Gang8 dni temu

    If you make another ai for this game you should try to get it to take a shortcut

  • David S. J. Meissner
    David S. J. Meissner9 dni temu

    Try that in real life and you need a lot of cars...

  • Ganster 123
    Ganster 1239 dni temu

    Hi Yosh, First of all, i love projects like this. Very interesting! I'd like to experiment myself and it would be awesome if you could answer some of my questions. 1. where did you get the data from? Like the distance to the walls or the velocity of the car. 2. What programm or programming language did you use to realise your project? 3. What does your NN look like? How many layers? How many inputs? How many neurons? Thank you:)

  • vicarioustube
    vicarioustube9 dni temu

    Was there one car who wasn't the lead at the start who managed to win the race?

  • Silly Stuntz
    Silly Stuntz10 dni temu

    13:30 it is so satisfying how the car "explodes" :D

  • Anthony Brown
    Anthony Brown10 dni temu

    Greetings, A message from the Gospel in The Christian Holy Bible. This is the message of forgiveness of sin through the sacrifice of Jesus Christ. In first Corinthians, chapter 15 verses 1 to 4, the apostle Paul states: “Moreover, brethren, I declare unto you the gospel which I have preached unto you, which also ye have received, and wherein ye stand; by which also ye are saved, if ye keep in memory what I preached unto you, unless ye have believed in vain. For I delivered unto you, first of all that which I also received, how that Christ died for our sins according to the scriptures; and that he was buried, and that he rose again the third day according to the scriptures”. Romans chapter 3 verse 23, informs us, “For all have sinned and fall short of the Glory of God”. Ultimately it is a redeeming plan set by God, and for anybody who will faithfully trust in his Son will be saved. Romans chapter 6 verse 23, says, “For the wages of sin is death; but the gift of God is eternal life through Jesus Christ our Lord”. A sinner must recognise the despairing of her or his guilt before God in order for forgiveness to take effect. Every believer must understand in order to inherit the kingdom of God as sons of the king, the reality and foundational truth of sin must be acknowledged, for all who approach the throne of God for salvation. God promises us eternal life, for anybody who departs from sin through the saving faith in Jesus Christ. Jesus lived a perfect and sinless life which no person could live. Jesus’s sacrifice on the cross ultimately paid the debt we owe to God for our sin. Sin against an infinite God requires an infinite sacrifice; and Jesus died a substitutionary death for the sinner. In short, the works of Jesus paid the penalty of sin through an infinite sacrifice. Only the creator of life has the power to resurrect life after death and is essentially the proof of the power of God. Jesus Christ offers his salvation as a free gift and only be received by faith, despite any works or worthiness on our part. The scripture in Romans informs us, “If you declare with your mouth, Jesus is Lord, and believe in your heart that God raised him from the dead, you will be saved”. In conclusion, the resurrection of Christ is to bring everlasting life and salvation to anybody who follows him. The relationship between God and man can be restored through his saving faith.

  • 1vanTheTerrible
    1vanTheTerrible10 dni temu

    Nobody : That one car at 13:17 : "You know, the 'return to monke' thing kinda makes sence..."

  • Divvy
    Divvy10 dni temu

    finally, ive found something thats slower than me in track mania!!!

  • Frazn
    Frazn10 dni temu

    Great Video. I'm not a programmer myself, but would it be possible to program reward and punishment parameters for your ai? Basically a punishment for bumping into Walls: If Speed reduces while accelerating the ai loses Points. If it Hits a Checkpoint once it gets a Lot of Points. If the ai has High Speed it gets some points. Something Like that.

  • LMWolfLord Gamer
    LMWolfLord Gamer11 dni temu

    [●]\-/[●] NOICE

  • Micah Nuckols
    Micah Nuckols11 dni temu

    Unexpected lesson about human reproduction.

  • Hat Boi
    Hat Boi11 dni temu

    “In a case like this I would turn right” Car proceeds to turn left

  • Pablo Boner
    Pablo Boner11 dni temu

    That french accent is thicc as a tree lmao

  • cluxter -
    cluxter -11 dni temu

    The only thing more French than this accent is a baguette smoking a cheese cigarette while eating a croissant covered by a berret dipped in a glass of red wine.

  • lucarne étrange

    lucarne étrange

    9 dni temu

    This kind of comment is what the French get for speaking english. Which prove that they should stop.

  • AurL b

    AurL b

    10 dni temu


  • Noju Kuramu
    Noju Kuramu11 dni temu

    what if ai that uses shortcuts?

  • Noah Faucher
    Noah Faucher11 dni temu

    Yo pourquoi tu parle pas français

  • GammΩ
    GammΩ11 dni temu

    I dont know if you have to break on that track, that could be the problem why the AI cant reach the best time

  • Steve M
    Steve M12 dni temu

    Serious question could an AI learn to run a course or play a level and beat it in TAS speedrun time?

  • Ortille


    9 dni temu

    Probably not or it would need a lot of generation and it would only work for 1 map each time

  • hover
    hover12 dni temu

    U know what? BAGUETTE (French team)

  • Nanqette Pierre
    Nanqette Pierre12 dni temu

    i've seen quite a few videos about using machine learning in games. My question is how the heck do you even make a program see in game? Can someone give any insight?

  • Lucas Ruffiner
    Lucas Ruffiner12 dni temu

    C'est incroyable, gg

  • Tai Driscoll
    Tai Driscoll12 dni temu

    this reminds me of marble runs or water running through pipes

  • David Mcbride
    David Mcbride13 dni temu

    Do you want skynet? Because this is how you get skynet.

  • Tony Ennis
    Tony Ennis13 dni temu

    I think your fitness criteria could have been better. For example, penalize cars each time they hit walls.

  • Jessie Blosser
    Jessie Blosser13 dni temu

    What if we put 26 wall distance inputs, with them facing both front, back, left, right, up, and down, then give the cars a brake and reverse output, as well have a reward/punishment system where the AI is rewarded for passing checkpoints, but punished for missing checkpoints or losing a significant amount of time. This will give them the ability to pull off more advanced maneuvers on the more advanced tracks and possibly even compete against the top players in the world.

  • Der Gunma Lappen
    Der Gunma Lappen13 dni temu

    this is looking so satisfying lol

  • fok
    fok13 dni temu

    A genetic algorithm is NOT a reinforcement learning algorithm. It is an Evolutionary Algorithm. NEAT is a genetic algorithm that tweaks its 'gene' which models a neural network. In order for it to be a proper reinforcement learning algorithm it will have to involve a history (or Markovian samples thereof) of observations, actions and rewards. A genetic algorithm like NEAT does not use direct reinforcement but only evaluates the whole performance of an 'episode', and evolutionarily optimizes the solutions (mutation, and objective-driven recombination & o-d termination): it does not involve tweaking a solution's parts directly using reinforcement.

  • fok


    13 dni temu

    If you start to dabble into reinforcement learning, then I recommend learning about Q-learning, (Expected) SARSA, and the difference between on-policy & off-policy. Then you can work towards more fancy state of the art stuff like PPO and A3C, etc.

  • Guido Haverkort
    Guido Haverkort13 dni temu

    Man those last clips are so interesting. They almost look like some sort of fluid simulation Edit: i see i wasnt the only one that came to that conclusion lol

  • Guido Haverkort
    Guido Haverkort13 dni temu

    11:20 i dont think it ever will, i think the problem is the limited input data. The 7 distances just arent enough to predict future corners and anticipate on them

  • Graxxor Anandro Vidhelssen
    Graxxor Anandro Vidhelssen13 dni temu

    13:32 nightmare fuel!!!! O_O

  • kunxv15
    kunxv1513 dni temu

    this is extremely interesting

  • Знайка Иванович
    Знайка Иванович13 dni temu

    Hi, break can help been faster

  • Change Gamer
    Change Gamer14 dni temu

    How did the computer drived driving (lol) work in the early video games such as Mario Kart?

  • A S
    A S14 dni temu

    Reminds me of blood cells in a vein.

  • sidrat2009
    sidrat200914 dni temu

    Great video - wish there was a way for you to simulate 100 AI cars at the same time.

  • Vladislav Korovine
    Vladislav Korovine14 dni temu

    And that is how Babies are made, son. XD

  • SKE TV Gaming
    SKE TV Gaming14 dni temu

    Superbe vidéo ! I never trying machine learning for now but you really good explain how that works etc. It's really interesting. Thanks you :)

  • Jake Thomas
    Jake Thomas15 dni temu

    I’d love to know the name of the “two three and” song! Couldn’t find it. New genre: Trackmania.

  • Aakoo7
    Aakoo715 dni temu

    Dat Hacknet OST doe

  • The келеш from хелл BG
    The келеш from хелл BG15 dni temu

    Shout out to the AIs that dont even start!

  • Dustin Lacewell
    Dustin Lacewell15 dni temu

    Where's the code?

  • AlkaVirus
    AlkaVirus15 dni temu

    nice video

  • No Toes Baker
    No Toes Baker15 dni temu

    Why could you not take the data from the best runs of a top level player and then repeat the experiment and only keep the 3 best air's or something and end up having an AI perform better then the best player?

  • y o
    y o15 dni temu

    14:24 these "edibles aint shi-"

  • Tanya Wildgoose-Thompson
    Tanya Wildgoose-Thompson15 dni temu

    What about decelerate

  • Player Science
    Player Science16 dni temu

    Bro, Please clear my confusion. 🙏🙏 My question is...... Do you need the entire program of a game or source code, in order to teach AI.🤔🤔

  • Liam Taylor
    Liam Taylor16 dni temu

    Engineers on the Titanic: "Hey do you guys hear th-" Water: 13:32

  • LuxJury Dreams
    LuxJury Dreams16 dni temu

    My poo when i come back from taco bell 13:32

  • O C E A N M A N
    O C E A N M A N16 dni temu

    Can we optimize the A.I learning if we combine supervised learning and genetic algorithm, I wonder.

  • StrongZhu
    StrongZhu16 dni temu

    hi, this video is so cool~~~ how can your program get the input (wall distance, speed, etc.) ??? how to send control command (left,right,up) to the game??? any API ? thanks.

  • Akhil Mohan
    Akhil Mohan16 dni temu

    What if you did a genetic algorithm with time as the main fitness function, but instead of an initial random generation, you start with a generation that has learnt by supervised learning?

  • E.Garceau Studios
    E.Garceau Studios16 dni temu

    The ai doesn't perform very much because it doesn't know all the course. If it had birdeye view, it would be much more intelligent