1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.30 Bug Reporting thread
    Solutions and more information may already be available.

Figured out why AI is driving drunk - sometimes - BUG

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by krallopian, Jan 15, 2019.

  1. krallopian

    krallopian
    Expand Collapse
    NC114-85EKLS
    BeamNG Team

    Joined:
    Dec 5, 2013
    Messages:
    789
    So I've noticed in the few weeks that I've been messing around that SOMETIMES the cars take my corners no problem, and other times smash in to them. I figured it was some randomized thing, "Make each AI slightly different to add variety" and thought, "okay cool.. I can deal with this."

    But then I started noticing cars will wipe out and ALWAYS hit the same spot, but then later on they don't and they've mastered my track! So I realized what it is:

    The first time you spawn a car in, and it runs it's ai path, it's running differently than if you hit R to reset the car. So now I spawn in cars, hit r, then run the track and it works.

    Here's a video I put together showing THREE complete car reloads (hitting CTRL+R) and with each one, running the car three times resetting the car (hitting R.)



    You can see, after reloading the car, it hits the barrier wall. Then hitting R to RESET the car, it no longer hits the wall AND continues to do drive that path each time I reset it. So then I reload it (again CTRL+R) and sure enough it hits the wall! Yet, hit R to reset the car annnd yup, it won't hit the barrier!

    This is good news to me as I was getting sick of thinking the ai had to LEARN how to drive each time i.e. Load in, wipe out, then reset and learn NOT to wipe out the second time. But it seems like more of a bug than anything, as it clearly does not NEED to learn the first reload, and simply hitting R upon loading the car, seems to make it drive just fine. I was getting sick of making an adjustment and then seeing the AI fail, but then later on making it again, so I with such a conjugate variable I was lost in a mess of, "I don't know what the heck is going on, but. . SOMETHING IS!"

    Hope this helps, and even more so - hope the dev's find the problem with this! =)

    (after all this has taken over an hour to upload! haha)
     
    • Informative Informative x 1
  2. Kueso

    Kueso
    Expand Collapse

    Joined:
    Oct 14, 2016
    Messages:
    4,463
    interesting
    i think the AI is trying to path its way around without killing itself.
    IDK tho.
     
  3. krallopian

    krallopian
    Expand Collapse
    NC114-85EKLS
    BeamNG Team

    Joined:
    Dec 5, 2013
    Messages:
    789
    So the first time it's loaded in, it drives into the wall. After I hit R to reset, it no longer drives into the wall.

    I hit CTRL+R again, and blamo, drives into the wall, until I hit R, annnnd drives fine.
     
  4. estama

    estama
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 7, 2012
    Messages:
    267
    The AI has some internal parameters that it adapts as it goes. For example it has an internal adaptive aggression level that changes depending on the friction/grip conditions. The changes of these internal parameters is what most probably creates this variability.

    An additional variability cause is that the physics/conditions are never the same due to the simulation being non-deterministic. This is why you can drop a simulated dice on its edge and you'll get different results even tho the initial conditions are the same. This is not due to some induced randomization but due to the inherent differences of the computational environment on each run (different timings and so on).

    AI is at the top of my todo list right now so a lot of things are expected to change.
     
    • Like Like x 7
    • Informative Informative x 4
  5. atv_123

    atv_123
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,710
    Wait... so what we are seeing here (in his little video) is basically when your hard reset the car (and thus all the AI parameters) the car basically doesn't know how much traction it has, but then when he just does a regular reset after the crash (thus keeping all the AI adjusted parameters) the AI now knows how much traction it has available and thus is more capable of making the corner? That is actually really really cool if that is the case.
     
    • Informative Informative x 2
  6. krallopian

    krallopian
    Expand Collapse
    NC114-85EKLS
    BeamNG Team

    Joined:
    Dec 5, 2013
    Messages:
    789
    That' what the video shows =)
    --- Post updated ---
    Huge fan of this post!!

    I've always bragged to friends who I show the game off to, "But the best part is, it'll be different every time! None of this, "On rails" crap, it's properly simulated!"" To hear it from the horse's mouth so-to-speak is fantastic. I've actually explained it as, "Each time the ai spawns, it will need specific clocks to do things, if I even open a new chrome tab while it's starting out, it'll run differently!" Which I've seen proof of by running while FOCUSED on a car, vs running while staring at the sky getting 400fps.

    I just said in another post that I'm both excited and frightened for the future of the AI dev work!

    To be clear though, what I gather is that the first time a car loads in it actually has internal adaptive aggression which means it WILL drive differently after wiping out, so the RESET doesn't so much change anything, as much as show how the car has adapted or in this case, "learned." It's been a heck of a ride bouncing between, "No it DID LEARN!" vs "Wait no it just needed to be reset." So basically if the car slides off the road on CTRL+R but doesn't crash, it wouldn't slide off the road again, but because in my example it slides off and damages itself thus driving wonky, when I hit R to RESET it turns out it's already learned to pull back a bit and has nothing to do with resetting. Fascinating!

    *Cheers
    --- Post updated ---
    Diving further into this I'm thinking it would make sense then to set the risk factor lower at the start of my run. That way it won't crash on the first turn, BUT as it drives along, I can raise it up as it goes. I've done this in a sense already, without methodically doing so. So, I guess it's case closed on this!

    If you find your cars crashing at your first turn or second etc.. start them off with a lower risk (I always put '83 as it's my YOB) and after a bunch of acceleration/braking raise it up as you so desire. I've had cars not make it at 70% and then the same car make it at 200% so that says a lot.
     
    • Agree Agree x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice