AI Learns to Drive a Car! (ML-Agents in Unity)

Поделиться
HTML-код
  • Опубликовано: 24 дек 2024

Комментарии • 232

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  4 года назад +10

    🌐 Have you found the videos Helpful and Valuable?
    ❤️ Get my Courses unitycodemonkey.com/courses or Support on Patreon www.patreon.com/unitycodemonkey

    • @noebryce3386
      @noebryce3386 3 года назад

      i guess im randomly asking but does anyone know a way to log back into an instagram account..?
      I was stupid forgot the password. I would appreciate any tips you can offer me.

    • @lukekobe2343
      @lukekobe2343 3 года назад

      @Noe Bryce Instablaster ;)

    • @noebryce3386
      @noebryce3386 3 года назад

      @Luke Kobe Thanks for your reply. I found the site on google and Im in the hacking process now.
      Seems to take a while so I will reply here later when my account password hopefully is recovered.

    • @noebryce3386
      @noebryce3386 3 года назад

      @Luke Kobe it worked and I actually got access to my account again. I am so happy:D
      Thanks so much, you saved my account :D

    • @lukekobe2343
      @lukekobe2343 3 года назад

      @Noe Bryce you are welcome xD

  • @moheyaldeenalmardiny82
    @moheyaldeenalmardiny82 2 года назад +4

    This series is so underrated it's so amazing thank you very much for the quality content

  • @gamblingguy6879
    @gamblingguy6879 3 года назад +12

    Nice Job, and as usual, well made video. I've made a similar project, and i've always found that by just using raycasts, the agent is unable to effectively choose a trajectory to handle sudden sharp turns or weird shaped paths. I gave it a sort of gps so it could plan ahead. Empty game objects placed at the center of the path, spaced just like your checkpoint walls. Every "checkpoint" is oriented toward the next one, forming a loop, the agents receives an array containing the angle delta between the checkpoints orientation. Depending on how many deltas you allow it to perceive, it will have a precise idea about the shape of the road ahead, and will plan speed, steer and trajectory accordingly.

    • @gamblingguy6879
      @gamblingguy6879 2 года назад

      @Leo Zhang the code is kinda messy, i'm not a programmer. But if you need, i can try to explain the idea with more details

    • @gamblingguy6879
      @gamblingguy6879 2 года назад +1

      @Leo Zhang It's an old project, i'll try to recall as many details as possible. To make it recognize the road boundaries, i've made invisible walls along the road (blender model), a basic array of raycast will always tell how close you are from getting offroad. My punishment was quite harsh, for every wheel offroad, say goodbye to 25% reward. As for planning ahead, it needs a way to know the general shape of the road. I think my system is quite inefficient, and could be developed way better. Anyway, as i said, just a bunch of empty gameobject along the center of the entire path. first thing they do, is to align Z axis toward the next one, calculate difference between Z rotations, feed normalized angles to the agent. You can choose how many "checkpoints" it can perceive from it's position on, but you will ave to add/remove inputs every time you change the array length. Hope it makes some sense 😅

    • @JamesPound
      @JamesPound Год назад

      @@gamblingguy6879 Wouldn't that hard-code the training to those specific tracks? I'm wondering if the AI would be able to adapt to a new track without additional training?

    • @gamblingguy6879
      @gamblingguy6879 Год назад

      @@JamesPound the model was trained on different tracks at the same time to avoid the overfitting problem.

  • @DudeFrom1972
    @DudeFrom1972 4 года назад +7

    Yet another great video, if only I was able to comprehend the coding part then I'm sure a similar project would be really fun to do during the holidays.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      The code part is pretty simple, just watch the intro video and you'll understand everything ruclips.net/video/zPFU30tbyKs/видео.html

  • @patmw
    @patmw 3 года назад +3

    Keep it up mate:) ur videos are a gold mine

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  4 года назад +8

    💬 Teaching AI how to Drive!
    What other common actions should I train the AI to do?
    Stay tuned for a video teaching the AI how to SEE!

    • @ahmedmorgan2328
      @ahmedmorgan2328 4 года назад +2

      how about training AI to fly

    • @shikhermyv
      @shikhermyv 4 года назад +1

      What about car to car collision avoidance?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад +3

      @@shikhermyv If you needed that then you would also add the cars as detectable to the tags and layer

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад +2

      @@ahmedmorgan2328 Doing some Plane controls could be an interesting challenge!

    • @darshgupta6276
      @darshgupta6276 4 года назад +1

      What about an FPS with AI enemies?

  • @sublajz8432
    @sublajz8432 2 года назад

    You are amazing! Will certainly buy some of your courses to support you.

  • @kamillatocha
    @kamillatocha 4 года назад +9

    i would still add other cars as detectable tags so they could learn to bypass them

    • @pytchoun140
      @pytchoun140 3 года назад

      what you mean by bypass them ?

    • @WowPlusWow
      @WowPlusWow 3 года назад

      @@pytchoun140 So that the other cars avoid each other and don't drive through eachother

    • @pytchoun140
      @pytchoun140 3 года назад

      @@WowPlusWow you need add collider

  • @synergystudios4321
    @synergystudios4321 3 года назад +2

    And here I used a car with real physics, no wonder why it took DAYS to train !

    • @xpBlackpepper
      @xpBlackpepper 3 месяца назад

      Ey, I am currently in the same situation. Is there any suggestion?

  • @bakartu
    @bakartu Год назад +3

    The Checkpoint system you created on the other video is different than the one you are using in this video and it doesn't work for me. Where can i find the script for the checkpoint system you used here?

  • @orfstudiosink3585
    @orfstudiosink3585 Год назад +1

    Awesome! :D

  • @ahmedmorgan2328
    @ahmedmorgan2328 4 года назад +4

    thank you for your amazing work , can you please make a video about multiplyer games

  • @leonardo6631
    @leonardo6631 3 года назад

    Great video!!

  • @amegatron07
    @amegatron07 Год назад

    Thanks for the video! Though it's not the main topic of this video, but I noticed that you actually made your agents almost "blind" buy not inputing all the rays, but by just giving the deviation from the next checkpoint. I believe, the agent could perform better, given all the sensors (including distance to walls).

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Год назад +1

      It's been a while since I made this video but I remember I had to try tons of things. If I add too many observations then it takes ages to learn everything

    • @ДанилПавлов-ж4ф
      @ДанилПавлов-ж4ф Год назад

      The RayPerceptionSensor component automatically adds observations

  • @kheelansarathee6386
    @kheelansarathee6386 3 года назад +7

    You never wrote a GetNextCheckpoint function in the checkpoint video

  • @roshanthapa1297
    @roshanthapa1297 4 года назад

    Definitely helpful, 👍

  • @belkacemF
    @belkacemF 4 года назад +1

    so you started 3d...in other word the you started the road to 1 million ....just saying i am not gay but i love you like really thank you for helping me and many many others ...your hard work is really goof and so so so helpful

  • @wavey8324
    @wavey8324 2 года назад +1

    I love you bro

  • @a_abubakr
    @a_abubakr 4 года назад

    Thank you so much

  • @zx.hash.r
    @zx.hash.r 4 года назад

    super cool video :D

  • @tiagogb
    @tiagogb 3 года назад +4

    The TrackCheckpoints.cs from last episode is not completed so this will have a few errors!

    • @DexMaar
      @DexMaar 2 года назад +5

      if youre having an issue with TrackCheckpoints.CarCheckPointEventArgs e line you have to add another class inside of the TrackCheckpoints class. As follows
      public class TrackCheckpoints : MonoBehaviour
      {
      ...
      public class CarCheckPointEventArgs : EventArgs
      {
      public Transform carTransform { get; set; }
      }
      ...
      }
      additionally the eventhandlers need to be changed to as follows
      public event EventHandler OnPlayerCorrectCheckpoint;
      public event EventHandler OnPlayerWrongCheckpoint;

    • @bakartu
      @bakartu Год назад +1

      @@DexMaar My friend you are a hero you saved me ! thanks!

  • @moritz2666
    @moritz2666 Год назад +1

    Is it necessary to increase space size for the sensor? curreclty i have 6 for two transforms, and is it necessary to add the Sensor in CollectObservations?

  • @NAME494
    @NAME494 4 года назад

    I love this ai tutorials

  • @eliaswazen771
    @eliaswazen771 Год назад +1

    hello can i get the trackcheckpoints code because it's a diffrent one from the checkpoints tutorials in this on there's many missing functions

  • @araldjean-charles3924
    @araldjean-charles3924 2 года назад

    I am surprised that you have not tried your grid path algorithms . You could use it to decide where to put waypoints on the track dynamically. Each car could have its own graph of way points

  • @aa-xn5hc
    @aa-xn5hc 4 года назад

    Fantastically interesting

  • @MacHungo
    @MacHungo Год назад

    Nice one

  • @mobeen360
    @mobeen360 3 года назад +2

    I got Code Monkey AD on a Code Monkey video!
    Seems Legit!

  • @robosergTV
    @robosergTV 4 года назад +1

    great video! Did you place the invisible walls manually? The holy grail of such projects is to have the walls follow the road automatically for a later procedural generation of tracks

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад +1

      Yes but the track pieces are all modular so if I used this in a final game I would add the invisible walls and checkpoints directly onto each track piece prefab.

    • @robosergTV
      @robosergTV 4 года назад

      @@CodeMonkeyUnity sounds like a good idea, the only part left would be programming the procedural generation part. Do you have any ideas? Maybe a good topic for a video?

    • @revimfadli4666
      @revimfadli4666 2 года назад

      The bezier road tool that John Sorrentino uses does allow automatic spacing of things including those reward walls

  • @nocultist7050
    @nocultist7050 4 года назад +3

    hmmm wonder how it would work with combat AI that gets reward for shooting player and gets punished for getting shot.
    And how about squad AI that controlls multiple combatants

  • @keyhaven8151
    @keyhaven8151 6 месяцев назад

    Why can you train with multiple vehicles simultaneously during training? How is this achieved? What should we set up?

  • @pixalz79
    @pixalz79 3 года назад

    C# has been a struggling journey and I'm glad that I purchased your Bolt Scripting course, which I love by the way. Would you consider following up on these ML-Agents videos with Bolt?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 года назад +1

      I'm glad you liked the course!
      ML-Agents + Bolt would be a bit of a weird combination, but Bolt works on reflection so it should be doable.

    • @pixalz79
      @pixalz79 3 года назад

      @@CodeMonkeyUnity That's interesting. Maybe when I get better I'll look into ML-Agents with Bolt further. Question, do you plan on making more courses with Bolt?

  • @graceli4004
    @graceli4004 3 года назад +1

    Another very good video, I would like to ask whether it is possible to avoid collisions between cars? How is it achieved?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 года назад +2

      If you make the sensors detect other cars and you train it while other cars are also on the track then it should work. Although it will take much longer to train since its much more complex.

  • @JotaaPlays
    @JotaaPlays 11 месяцев назад +1

    The codes that you provide on your website are full of errors, and from the last tutorial you changed the script TrackHeckpoint and didn't tell, that way i cant finish my school project.
    Thank you very much.

  •  4 года назад

    Hypothetically, could you make the perfect AI for one track? For example - you have a game similar to Dirt Rally, people send the replay data with all values from their inputs (accel, brake, steering, what gear they're using, handbrake), and with all that information, could you train the AI to have a perfect sprint?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      Yes, the only limit is how much you train. You don't need more player input after a certain point, right now if I just let the AI in the video train for 50M more steps it would become super human. Just needs some rewards to complete the laps faster and faster.

  • @tomasfernandezvaldes9583
    @tomasfernandezvaldes9583 11 месяцев назад

    Great video!!! thanks a lot. Where can I find the full code to understand it better?

  • @pytchoun140
    @pytchoun140 3 года назад +1

    When i edit the config file can i resume the brain training or i need to init a new one with initialize-from ?

  • @pytchoun140
    @pytchoun140 3 года назад +1

    Can you provide full script of TrackCheckpoints please you add a lot of things from the checkpoint system video

    • @DexMaar
      @DexMaar 2 года назад

      if youre having an issue with TrackCheckpoints.CarCheckPointEventArgs e line you have to add another class inside of the TrackCheckpoints class. As follows
      public class TrackCheckpoints : MonoBehaviour
      {
      ...
      public class CarCheckPointEventArgs : EventArgs
      {
      public Transform carTransform { get; set; }
      }
      ...
      }

    • @DexMaar
      @DexMaar 2 года назад

      additionally the eventhandlers need to be changed to as follows
      public event EventHandler OnPlayerCorrectCheckpoint;
      public event EventHandler OnPlayerWrongCheckpoint;

  • @kheelansarathee6386
    @kheelansarathee6386 3 года назад +1

    Did you change the code you did to the track checkpoints as nothing works for me

    • @DexMaar
      @DexMaar 2 года назад

      if youre having an issue with TrackCheckpoints.CarCheckPointEventArgs e line you have to add another class inside of the TrackCheckpoints class. As follows
      public class TrackCheckpoints : MonoBehaviour
      {
      ...
      public class CarCheckPointEventArgs : EventArgs
      {
      public Transform carTransform { get; set; }
      }
      ...
      }

    • @DexMaar
      @DexMaar 2 года назад

      additionally the eventhandlers need to be changed to as follows
      public event EventHandler OnPlayerCorrectCheckpoint;
      public event EventHandler OnPlayerWrongCheckpoint;

  • @patrickmihalcea6480
    @patrickmihalcea6480 2 года назад +2

    Is the code available anywhere?

  • @iamabot699
    @iamabot699 4 года назад +1

    If we train the ai on one track, will it be able to drive on any track?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      If your train for long enough on tracks that have enough variation, like the third track in the video, then yes

  • @asakumaris5062
    @asakumaris5062 4 года назад +2

    Can you make a free beginner tutorial on making a complete game

    • @anilkumarukl2965
      @anilkumarukl2965 4 года назад +1

      can you please make one

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад +1

      I've made Snake and Flappy Bird as complete free tutorials ruclips.net/video/b5Wpni9KPik/видео.html
      And I've got my complete step-by-step courses unitycodemonkey.com/courses.php

    • @asakumaris5062
      @asakumaris5062 4 года назад

      Thankyou

  • @Xeratas
    @Xeratas 4 года назад +3

    if you want the cars to drive the fastest way, how would you archvie that? would it simply be enough to increase the rewards from checkpoints when the time between checkoints went down or doesn't it work like that?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад +1

      Yes, after the cars have trained to successfully complete laps then you could start training them to be faster by adding rewards based on the time to complete a lap or each segment.

    • @isolatedsushi5996
      @isolatedsushi5996 2 года назад

      @@CodeMonkeyUnity Wouldnt the AI learn this itself if you use a gamma value of less than 1?

  • @arcday4281
    @arcday4281 4 года назад

    Very useful ! Will there ever be a video about the localization system ? Or did I miss it ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад +1

      It's an interesting topic but not sure. I think Unity recently made an official localization tool so I might look into that one

    • @arcday4281
      @arcday4281 4 года назад +1

      ​@@CodeMonkeyUnity Do you think it's a bad idea to store and load various translations of texts into other languages in a "ScriptableObject"? Or use the classic dictionary-key approach, which is more reliable ? In both cases, you need to go through a loop. For example, in the classic case, this is an iteration over an array from the "json" file. Well, in the case of "ScriptableObject" - this is also an array in the file itself. I do not know how this will affect performance, or are there any other "pitfalls" with this approach ? Do I need to reinvent the wheel ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад +1

      ​@@arcday4281 Probably better to have an external file, like a .csv that you can edit with a custom tool. Using ScriptableObjects can work but if you have tons of strings you're going to end up with tons and tons of fields which will be very difficult to manage. Or I suppose you can use them and build a tool to manage all those ScriptableObjects

    • @arcday4281
      @arcday4281 4 года назад +1

      @@CodeMonkeyUnity Thank you very much!

  • @ciprian-georgeilie2979
    @ciprian-georgeilie2979 2 года назад

    Also what is in the Nofriction Material ? is it applied only on the car or on the walls also ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 года назад

      It's a physics material with 0 friction so it doesn't get stuck on the walls, you can apply it to either

    • @ciprian-georgeilie2979
      @ciprian-georgeilie2979 2 года назад

      @@CodeMonkeyUnity So to any of them, but not on both in the same time, also at the paramethers should they go like :
      Dinamic Friction : 0
      Static Friction : 0
      Friction combine : average
      Bounce combine average
      ?

  • @sheikhmustafeedhahmed4951
    @sheikhmustafeedhahmed4951 Год назад +1

    I am using wheel collider for my project. At 50M steps and with a recorded demo, the cars still dont learn to complete the track. I dont know why.
    Can someone help me?

    • @xpBlackpepper
      @xpBlackpepper 3 месяца назад

      Ey, I am stucked in the same situation. Is there any update?

    • @sheikhmustafeedhahmed4951
      @sheikhmustafeedhahmed4951 3 месяца назад

      @@xpBlackpepper I removed wheel Collider and made a simple script for vehicle movement and wheel rotation as well as turning. Learning had increased exponentially.

    • @xpBlackpepper
      @xpBlackpepper 3 месяца назад

      @@sheikhmustafeedhahmed4951 [Update] Thank you for the answer, I solved adding into obseravation vector the steer angle and in 3M steps it learn how to do the track with a good SR(less then 10).
      My current problem is that at a certain point some veichles just "stop to learn", they just don't move or keep repeat the same trajectory against a wall, any suggestion?

  • @lercon9875
    @lercon9875 3 года назад

    May I ask a question how to ai drive my car more fast?
    I found the ml agent car will brake some in straight line so its speed is not top speed, how do I fix it?
    By the way I add reward (car speed * velocity reward ) in OnActionReceived and add observation (car speed) in CollectObservations
    But the car speed is not top speed,it will brake in weird place (like straight line)

  • @hehe7793
    @hehe7793 3 года назад

    Hi Code Monkey, I love your video! Could you tell me your computer specification? because currently I am trying ml agents and end up having heavy lag. hehe

  • @NahFam13
    @NahFam13 2 года назад

    Is there a way to tell the AI which texture or material to stay on, and which to avoid via raycast?
    I want to dive deeper into machine learning and your videos have helped explain a lot of the setup but nobody really explains the raycasting and what it's limitations are. I would love to know if this is possible.
    I know procedural world's has a Machine Learning add-on for Gaia but I don't know if it will recognize anything other than GameObjects since I don't have the knowledge to break it down.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 года назад +1

      ML is all about numbers, so you can define that if a raycast hits a certain material you record a 1, if a different material a 2, etc.
      Then the agent will over time learn what 1, 2, etc means

    • @NahFam13
      @NahFam13 2 года назад

      @@CodeMonkeyUnity thank you! I will try to implement that.

  • @la_treta
    @la_treta 4 года назад

    any chance of creating some content about character creation? like blendshapes with unity?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      That would be an interesting topic but no idea when I'll have the time for it

  • @reubenxuereb9826
    @reubenxuereb9826 2 года назад

    Great video really helped me get an idea for my own project that I'm doing. Just wondering, in the Agent script where you have the observations method, you're giving the transform of the next checkpoint ( trackChecpoints.GetNextCheckpoint(transform).transform.forward ). Can you please show me how to get the transform for the next checkpoint as I cannot find a way how to do it. Also i downloaded the assets of the Checkpoint System to have an idea of your code but i cannot find that particular method(GetNextCheckpoint) where you have the transform for the next checkpoint. Thanks !

    • @reubenxuereb9826
      @reubenxuereb9826 2 года назад

      Sorry forgot to add, ResetCheckpoint() method under the OnEpisodeBegin() method i also cannot find a way how to do it. Can you help me ? thanks

    • @karuppasamyn7364
      @karuppasamyn7364 2 года назад +1

      @@reubenxuereb9826 Did you find the solution?

    • @patrickmihalcea6480
      @patrickmihalcea6480 2 года назад

      Did you find the solution?

    • @LETHALCRAYONZ
      @LETHALCRAYONZ Год назад

      @Code Monkey did this ever get solved? been trying for days to suss it .

    • @hugoeitel1764
      @hugoeitel1764 Год назад +2

      @@LETHALCRAYONZ Hello, actually i try with this :
      public CheckpointSingle GetNextCheckpointPosition(Transform carTransform)
      {
      int nextCheckpointSingleIndex = nextCheckpointSingleIndexList[carTransformList.IndexOf(carTransform)];
      return checkpointSingleList[nextCheckpointSingleIndex];
      }

  • @Diego0wnz
    @Diego0wnz 3 года назад

    Im unable to save my model when I use an extra observation with Ray perception Sensor 3d, it gives an OmnxImportException (brain) error 'unexpected error while parsing layer 18 of type gemm'

  • @uso2484
    @uso2484 4 года назад

    Can you make tutorial about Multiplayer in Unity using Mirror

  • @zhwa4004
    @zhwa4004 3 года назад

    I'm trying to let my AI to get to a target, like your first video in the ml-agents.
    But in diffrent, i build some obstacle to increase the difficulty.
    At first I tried to use old method, observation the obstacle's position and scale.
    However, that isn't work. AI cann't distinquish the obstacle, only to go to the target.
    So, I come to watch this video and change my method. Now it is work!
    But, I hope you can give me advice.
    When the target is behind the obstacle, AI just wait before the obstacle for every training.
    I come out two ideas, one is give "touch the wall" a extremely small rewards, another is punish AI every step.
    The first one is used now.
    And both my ideas are good, or is there any hidden threat?
    My English is not very good, it may be difficult to read. So thank you very much for your willingness to help me=)

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 года назад

      Yup, if you want the AI to do something quickly then adding a negative reward on every step is a good idea.
      Object avoidance is always tricky, give it a position/direction for the obstacle and the target, over time it should learn.

    • @zhwa4004
      @zhwa4004 3 года назад

      @@CodeMonkeyUnity It is nice.
      But, I find a serious situation in my Unity.
      When I finished my first trainning in Unity and try to use the AI model.
      When I drag my .onnx file in Unity.
      It returned error like this:
      "OnnxImportException: Unexpected error while parsing layer 25 of type Gemm."
      "Assertion failure. Values are not equal."
      "Asset import failed, "Assets/AI/MoveToGoal.onnx" > OnnxImportException: Unexpected error while parsing layer 25 of type Gemm"
      I find it occur because I use Ray Persection sensor3D in my agents to train.
      When I remove this component and train, the .onnm file is ok, and I can drag it in my Unity.
      But, I need the component. Please help me. thank.

    • @zhwa4004
      @zhwa4004 3 года назад

      @@CodeMonkeyUnity Likely, when I use old version Unity 2018 to try.
      It could drag .onnx file in Unity now.
      The unity 2018 project is download from github, which is Unity's office sample project.
      I put my project in it. and everything is perfect.
      I guess the reason about the error is my new project'enviroument is not complete or Unity2020 version has some problem on Ray sensor.
      I am not sure which one it is. But this is my current solution. Trainning in Unity2020, operation model in 2018.

  • @pytchoun140
    @pytchoun140 3 года назад

    You used Imitation Learning for this ? So you take the controll of a car and make the course multiple time ?

  • @pytchoun140
    @pytchoun140 3 года назад

    When do you EndEpisode ?

  • @mt03adventures
    @mt03adventures 3 года назад

    Lol if I put decision period to 1, my computer dies :D btw thx for the vid

  • @rocsalt5617
    @rocsalt5617 3 года назад

    I have one of your courses and have been watching your series on ML-Agents and I wonder... Can you have multiple levels of trained agents in a single game? I am suspecting that maybe you can set difficulty levels for players to compete against various levels of AI that have differing levels of training. I might suspect that you would train your AI to a certain point then use that as a starting place and save the further progress in a different file, then repeat. Does this sound appropriate?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 года назад +4

      Yup exactly, the training process saves various checkpoints as its training the agent.
      So you would train it to the max until the agent is superhuman, then grab the model from a few checkpoints back for an easier one.

    • @begbarros
      @begbarros Год назад

      ​@@CodeMonkeyUnityman..you are the best of the best..I have no doubt about it..tks for sharing your knowledge with all of us

  • @seemapahwa6180
    @seemapahwa6180 4 года назад +1

    Hello I have also brought your course on udemy I love it but I want help because I have participated in game jam and I need to learn unity PROFESSIONALLY can u please help me?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      Use the Q&A section for each lecture to post any questions you have

    • @seemapahwa6180
      @seemapahwa6180 4 года назад

      @@CodeMonkeyUnity THANKS

  • @calitase1
    @calitase1 4 года назад

    If i try to make the code same as you i get "The type name 'CarCheckpointEventArgs' does not exist in the type 'TrackCheckpoints'" error, i followed your Simple Checkpoint System from start to finish and even downloaded the code from your patreon so i have the exact same code as you, why i get this error?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      It seems you didn't define that class for the event.

    • @kacpergasior2748
      @kacpergasior2748 3 года назад +1

      @@Fiiloret It doesn't fix the error for me :(

    • @DexMaar
      @DexMaar 2 года назад +2

      if youre having an issue with TrackCheckpoints.CarCheckPointEventArgs e line you have to add another class inside of the TrackCheckpoints class. As follows
      public class TrackCheckpoints : MonoBehaviour
      {
      ...
      public class CarCheckPointEventArgs : EventArgs
      {
      public Transform carTransform { get; set; }
      }
      ...
      }

    • @DexMaar
      @DexMaar 2 года назад +2

      additionally the eventhandlers need to be changed to as follows
      public event EventHandler OnPlayerCorrectCheckpoint;
      public event EventHandler OnPlayerWrongCheckpoint;

  • @makschojniak4083
    @makschojniak4083 2 года назад +1

    I did everything you did in the video, my agents only learn after 5 million steps, they only learned 20 checkpoints and I have 200 checkpoints for the whole map and they don't eat as smoothly as you do. Do you know how to speed it up ?? it is definitely not hardware fault.

    • @Kerupie
      @Kerupie Год назад +1

      Hello, have you figured it out?
      i have around 20 checkpoints and it goes through half of it in 500k steps, idk if it will do it in 5mil steps
      may be you can, since you had same problem, and maybe you've solved it?

    • @Andrea_Cavallo98
      @Andrea_Cavallo98 Год назад

      @@Kerupieman I’m working on it as well in these days, just started working on creating the environment reward walls…could I ask you something?

    • @Kerupie
      @Kerupie Год назад

      @@Andrea_Cavallo98 yeah, you can

    • @Andrea_Cavallo98
      @Andrea_Cavallo98 Год назад

      @@Kerupie can I write you somewhere else? WhatsApp or Instagram?

  • @IndeptStudios
    @IndeptStudios 3 года назад

    first im sorry for my english :)
    Is it possible to train the AI that the inner way truh a curve is rewarding more than on the outside?
    On the first stretch, this would mean the closer the AI ​​drives to the left through the curve, the faster it would be, i.e. more efficient.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 года назад +1

      As long as you give it a reward based on being the fastest possible then it should learn that behaviour.

  • @ciprian-georgeilie2979
    @ciprian-georgeilie2979 2 года назад

    Is the code for this put somehwere ? On patreon or anywhere ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 года назад

      Not really, the project is really complex so it would be really difficult to clean it up and make a nice package

  • @bakartu
    @bakartu Год назад +1

    If there is someone that has the complete code of the trackCheckpoints please help me!

  • @daryladhityahenry
    @daryladhityahenry 2 года назад

    Hi. I have question about this. When you create new track, is it still works even though you're not creating the checkpoint and wall? or is it still needed? Thanks.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 года назад

      If you train on various tracks with enough variety it should get to a point where it learns to drive on any track

    • @daryladhityahenry
      @daryladhityahenry 2 года назад

      @@CodeMonkeyUnity So, no need to add checkpoint and wall for the AI?

  • @benbechia3582
    @benbechia3582 3 года назад

    Can you please help I gat an error with CarDriver

  • @pytchoun140
    @pytchoun140 3 года назад

    It is normal to have massive lag ?

  • @bsdrago
    @bsdrago 4 года назад +2

    This could be a course. Just saying... =) Maybe an ideia..... :)

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад +1

      I have thought about doing a complete course on Machine Learning, could be interesting to put all these topics into one nice course, just need to find the time!

  • @saiki072
    @saiki072 4 года назад

    We don't care too much about ai learning how to play. if you make more games using bolt will be awesome

    • @r1pfake521
      @r1pfake521 4 года назад

      You don't care too much about ai learning how to play* but other people do, fixed that for you. He already has bolt videos and even a whole bolt course which will get a free fps update soon, they teach you enough to get going.

  • @lercon9875
    @lercon9875 4 года назад

    After add Demonstration Recorder,
    while I got EndEpisode(), I got warming message "Fewer observations (0) made than vector observation size(1) . The observations will be padded."
    Have anyone got the same warming message?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      Sounds like you're not making any observations, set the Observation Space size to 0

    • @lercon9875
      @lercon9875 4 года назад

      @@CodeMonkeyUnity I have sensor.AddObservation(rigidbody.velocity) at CollectObservations function and Inspector I have set Space size to 3,it's right ? And I run Official Example I got the same warning message.(Only if I add Demonstration Recorder Component)

    • @gamblingguy6879
      @gamblingguy6879 3 года назад +1

      it's probably due to an observation requested after the end of the episode, and before the start of the next one. It happened to me sometime, but as far as i understand, if it only happens after the "endEpisode" and it's just a single call, it should not affect the training process.

    • @lercon9875
      @lercon9875 3 года назад

      @@gamblingguy6879 thank you very much

  • @iam_the_legend
    @iam_the_legend Год назад

    Please leave the code link

  • @TurkiKAlqou
    @TurkiKAlqou Год назад

    Hello! I'd like someone to help me. I'm working on a project for my AI course in university. The premise of the project is basically a traffic simulation to test if the road infrastructure causes taffic congestion. So we have a self-driving car that knows the basic rules/laws of the road and follows them to randomly navigate through the roads. Spawn many of these agents on this road and see if they can navigate smoothly or a congestion will occur even though they follow the laws. If a congestion happens even though they followed the laws of the road, that means there's a problem in the road infrastructure itself! (Perhaps)
    I've been trying to make this self-driving cars but I can't seems to get it to work. I tried to do it in the same way as this video where it worked but the idea of the checkpoints doesn't since these are preplaced paths. In the game I'm making, the user will build the roads and place signs, which means the environment is not static but dynamic.
    I hope someone reads this and can help, I would really appreciate it :)

  • @makschojniak4083
    @makschojniak4083 2 года назад

    @Code Monkey anyone know how i return to givent step (i want return to 2mln step)??? How

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 года назад

      Look in the training folder, it saves various checkpoints. Although that depends on your settings, it saves every certain number of steps so you can only go back to a saved checkpoint and not a specific step number

  • @pytchoun140
    @pytchoun140 3 года назад

    Where can I have car controller?

    • @Bailey-kc1jm
      @Bailey-kc1jm 3 года назад

      Did you ever find the car controller?

  • @sagar-patel404
    @sagar-patel404 3 года назад

    How you reset the checkpoint system?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 года назад +1

      Just set the index back to 0, happens automatically after a lap

    • @sagar-patel404
      @sagar-patel404 3 года назад

      @@CodeMonkeyUnity Thanks its work and I am already do it before your reply. But I am facing new problem to Getnextposition of checkpoint.(FIXED)

    • @MZXD
      @MZXD 3 года назад

      @@sagar-patel404 did you have any luck with this function?

    • @reubenxuereb9826
      @reubenxuereb9826 2 года назад +1

      @Sagar Patel can you show us how you reset the checkpoints and how to get the transform of the next checkpoint ?

  • @In-N-Out333
    @In-N-Out333 4 года назад

    How come all of these AI videos are using 3d models? Don't you usually work in 2D?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      The AI Flappy Bird video was in 2D ruclips.net/video/fz8D0OZkQGQ/видео.html
      It all depends on what assets I already have, I don't have any 2D Cars but I have this asset pack I bought a while ago

  • @liminalvoyd379
    @liminalvoyd379 4 года назад

    good video
    Sorry if the grammar in my comment above isn't the best, since I live in Europe, it's difficult for me to speak other languaged than my native one. I am so sorry that I'm not english-speaking and my brain couldn't develop a better solution to execute the form of my comment. I will try to fix this issue as soon as possible, since this is a huge shame concidering that I came here to compliment your video and I couldn't even do that respectfully. I want you to pardon me, and let's hope I won't make similar errors in the future. I am hoping that my english can improve in the future, and I will try to remake this comment when I'm done. The video that I saw above really inspired me and I just want to thank you for making it. It changed my life for the better, and I can't thank you enough for being this kind. I am actually sorry for the sins I made before. I hope it's not a problem for you.

  • @denisgoodman4492
    @denisgoodman4492 4 года назад

    AI style driver very similar to professional style drive of Formula 1 drivers - section of side road before turning and so on.

  • @Satrumt
    @Satrumt 4 года назад

    You look pretty professional at this and I would like to ask you, will my computer run Unity and make a game like SAS Zombie Assault 4?
    -intel core i3 6006u
    -1tb memory
    -4gb RAM
    -Intel HD Graphics 520

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад +1

      Unity is free so just download and try it out.

    • @Satrumt
      @Satrumt 4 года назад

      @@CodeMonkeyUnity mmkay ty

  • @refiakarsista
    @refiakarsista 2 года назад

    can you help me to solve the problem with my game project which using ml-agent to enemy character??

  • @pytchoun140
    @pytchoun140 3 года назад

    How to you choose strength value ? It is random ?

  • @Bailey-kc1jm
    @Bailey-kc1jm 3 года назад

    is the a place where I can find the cardriver script or something similar to it

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 года назад

      It's a very very simple script, just moves the transform forward
      ruclips.net/video/xuCtxIcfboM/видео.html
      ruclips.net/video/IOYNg6v9sfc/видео.html

  • @DenizBoz
    @DenizBoz 4 года назад

    Man please put the first curly bracket in the next line for functions etc. My OCD eyes can't stand it!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      My OCD eyes can't stand seeing the brace on a new line!

  • @krzysztofwierzbowski5812
    @krzysztofwierzbowski5812 2 года назад

    How did you managed to have multiple cars in one scene and still have box colliders and rigidbodies on them? Training with just one car on one race track is an impossible task :/

  • @orfstudiosink3585
    @orfstudiosink3585 2 года назад

    Can I get the project?

  • @harshpal7097
    @harshpal7097 2 года назад +2

    I seem to be having an error with "private void TrackCheckpoint_OnCorrectCheckpoint(object sender, TrackCheckPoint.TrackCheckPointEventArgs e)" . At first it said that "TrackCheckPointEventArgs doesnt exist" so i made a delegate function in TrackCheckpoint.cs but i dont know how can i add "cartransform" to it.
    Also there is another error with "trackCheckPoint.OnPlayerCorrectCheckpoint += TrackCheckpoint_OnCorrectCheckpoint;" which says that "No overload for 'TrackCheckpoint_OnCorrectCheckpoint' matches delegate 'EventHandler'" and i dont know what that means.

    • @DexMaar
      @DexMaar 2 года назад +2

      if youre having an issue with TrackCheckpoints.CarCheckPointEventArgs e line you have to add another class inside of the TrackCheckpoints class. As follows
      public class TrackCheckpoints : MonoBehaviour
      {
      ...
      public class CarCheckPointEventArgs : EventArgs
      {
      public Transform carTransform { get; set; }
      }
      ...
      }

    • @DexMaar
      @DexMaar 2 года назад +2

      additionally the eventhandlers need to be changed to as follows
      public event EventHandler OnPlayerCorrectCheckpoint;
      public event EventHandler OnPlayerWrongCheckpoint;

    • @harshpal7097
      @harshpal7097 2 года назад +2

      @@DexMaar Thanks that works nicely now

  • @ping4k513
    @ping4k513 4 года назад +1

    Elon Musk left the chat

  • @conordempsey6889
    @conordempsey6889 2 года назад

    Hi I was trying to recreate this tutorial using custom models and I am getting errors in my CarDriverAgent file for OnCarCorrectCheckpoint, CarCheckpointEventArgs, ResetCheckpoint, GetNextCheckpoint. I think there may be code I am missing that I couldn't find in any of your tutorials could you help. Current errors read " Assets\Scripts\CarDriverAgent.cs(34,89): error CS0426: The type name 'CarCheckpointEventArgs' does not exist in the type 'TrackCheckpoint'"

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 года назад +1

      You just don't have any definition named "CharCheckpointEventArgs"

    • @conordempsey6889
      @conordempsey6889 2 года назад

      @@CodeMonkeyUnity And the get checkpoint and reset checkpoint? Is there anywhere I can find those functions I’m having trouble writing code myself for that

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 года назад

      @@conordempsey6889 I made a checkpoint system here unitycodemonkey.com/video.php?v=IOYNg6v9sfc
      But the specifics don't matter, all that matters is that your implementation of whatever car driver you have can feed enough information into ML.
      The goal is to teach any car to drive not one specific car implementation

    • @DexMaar
      @DexMaar 2 года назад +2

      if youre having an issue with TrackCheckpoints.CarCheckPointEventArgs e line you have to add another class inside of the TrackCheckpoints class. As follows
      public class TrackCheckpoints : MonoBehaviour
      {
      ...
      public class CarCheckPointEventArgs : EventArgs
      {
      public Transform carTransform { get; set; }
      }
      ...
      }

    • @DexMaar
      @DexMaar 2 года назад +3

      @@CodeMonkeyUnity this doesnt help since you didn't show what that is or where it came from, your original tutorial did not include this part

  • @maldonadousqc
    @maldonadousqc 3 года назад

    I need the car controller :( pleas :(

    • @Bailey-kc1jm
      @Bailey-kc1jm 3 года назад

      Did you ever find the car controller?

  • @omiorahman6283
    @omiorahman6283 4 года назад

    initial D

  • @너구리12
    @너구리12 3 года назад

    Can you know the contents of the carDriver.cs file?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 года назад +1

      I covered it here ruclips.net/video/xuCtxIcfboM/видео.html

    • @너구리12
      @너구리12 3 года назад

      @@CodeMonkeyUnity I don't know the details of the method, is there any other way?

    • @Bailey-kc1jm
      @Bailey-kc1jm 3 года назад

      @@너구리12 Did you ever find and a solution to this issue

  • @erdemzengin1233
    @erdemzengin1233 7 месяцев назад

    Very bad video because The Checkpoint system you created on the other video is different than the one you are using in this video and it doesn't work please fix it

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  7 месяцев назад

      Yes those are two completely separate videos with really no relation between them

    • @KurayTunc
      @KurayTunc 7 месяцев назад +1

      @@CodeMonkeyUnity But you're saying it's related with that, maybe this serie needs an update

  • @CJ-mr8dn
    @CJ-mr8dn 4 года назад

    Coding is a million times easier than you think....

    |>|>Skip Ad

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 года назад

      You saw that ad? Haven't seen that one in ages!

    • @CJ-mr8dn
      @CJ-mr8dn 4 года назад

      @@CodeMonkeyUnity hehe

    • @CJ-mr8dn
      @CJ-mr8dn 4 года назад

      @@CodeMonkeyUnity this is the 5th time you have replied to my comment 😁😁

  • @Killits_Gaming
    @Killits_Gaming 4 дня назад

    hi im getting a NullReferenceException: Object reference not set to an instance of an object. after some testing e is null in the CarDriverAganet. i already added the changes to TrackCheckpoints down blow but i get a new one
    public class TrackCheckPoiints : MonoBehaviour
    {
    public class CarCheckPointEventArgs : EventArgs
    {
    public Transform carTransform { get; set; }
    }
    public event EventHandler OnCarCorrrctCheckpoint;
    public event EventHandler OnCarWrongCheckpoint;
    I get a new eorro here
    OnCarCorrrctCheckpoint?.Invoke(this, EventArgs.Empty);
    so i changed it to this
    OnCarCorrrctCheckpoint?.Invoke(this, EventArgs.Empty as CarCheckPointEventArgs);
    void TrackCheckPoints_OnCarCorrectCheckPoint(object sender, TrackCheckPoiints.CarCheckPointEventArgs e)
    {
    if (e.carTransform == transform) e is null
    {
    Debug.Log("correct check point");
    SetReward(1f);
    }
    }

  • @pytchoun140
    @pytchoun140 3 года назад

    You used Imitation Learning for this ? So you take the controll of a car and make the course multiple time ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 года назад

      Yes, I drove the car manually for a bit to record the demo then used it in the ML AI

    • @pytchoun140
      @pytchoun140 3 года назад

      @@CodeMonkeyUnity ok thanks