A question regarding Script AI behavior and ways to improve it

Discussion in 'World Editor' started by Prince Naim, Jul 4, 2023.

  1. Prince Naim

    Prince Naim
    Expand Collapse

    Joined:
    Jan 19, 2016
    Messages:
    13
    I don't want to waste anybody's time, but I don't see anyone else asking this question, so I'll ask it myself.
    Will there ever be a way to change Script AI's behavior to exactly replicate a control input/key pressed as opposed to simply following the route that you drove on? I ask this because through heavy use of the Script AI program, I noticed that it tends to be extremely inaccurate, and will sometimes completely fumble a turn, or collide with another script AI vehicle due to poor timing. An issue I had in regards to the timing of the AI often includes the AI's way of driving correcting too much of what I did, which in turn puts the vehicle out of sync with the timing I had in place with the other vehicles. Let's say I full throttle from 0-60 and get a bit of wheelspin in the process. The AI will perform a much slower launch to completely eliminate the wheelspin. Changing the start delay is too tedious of a process to resolve this, and start offset isn't that much better. I strongly believe that considering changing (or at the very least, allowing a way to set this kind of behavior for the AI) will make the AI drive more accurate and precisely, especially at higher speeds.

    To solve a possible problem of the AI being sent completely off-course; for example, during a police chase scenario--maybe give it the ability to still correct itself and pathfind back to the route it was on, and then resume traveling that path via key inputs. This way the AI won't just be aimlessly following a set of keys you pressed after getting rammed off the road.

    The end goal for this is to hopefully have it to where the AI will do what you want it to, exactly HOW you did it, and exactly WHEN you did it.
    ...here's hoping that a dev/mod will see this and give some insight.
     
    #1 Prince Naim, Jul 4, 2023
    Last edited: Jul 5, 2023
    • Agree Agree x 1
  2. Dave_

    Dave_
    Expand Collapse
    Research
    BeamNG Team

    Joined:
    Sep 21, 2023
    Messages:
    32
    Hi,

    The ScriptAI playback behaviour is smoothed somewhat when compared to what was actually driven, so every nuance of the vehicle performance can not always be recorded. This is mainly due to the fact the 'sample rate' is not as fast as the rate at which the car was driven, but will also be due to both smoothing and maybe even a lack of determinism, etc. You might find better results with more editing capablities however, so you could perhaps take a look at the new ScriptAI Editor tool in the world editor (documentation: https://documentation.beamng.com/world_editor/tools/scriptai_editor/)

    Hope this helps.

    Dave
     
    #2 Dave_, Sep 22, 2023
    Last edited: Nov 25, 2023
  3. VectriciXY

    VectriciXY
    Expand Collapse

    Joined:
    Nov 6, 2022
    Messages:
    97
    Sorry for the bump and my poor English, but I really agrees with this solution of recording the key inputs and I think this have huge potential.

    We have seen many threads asking questions like "Can AI perform drifts/J-turns, etc" and "How to let AI drive a plane/locomotive/helicopter, etc". If we can set a timeline, record controller inputs or keys pressed at every second for every vehicle and let vehicles executes the recorded inputs according to the timeline, everything that can be controlled by the player can just be controlled by AI precisely too.

    As long as the inputs are correctly executed, AI can reproduce what you did, like drifts, reversing into a narrow alley or something like this. Moreover, with the inputs, AI can fly a plane, fire a cannon, flash high beams and use sirens or horns. This will bring huge convenience to video recording, scenario creation, and more. I truly hope this function can be realized in an update or by a mod.
     
  4. DeWorD

    DeWorD
    Expand Collapse

    Joined:
    Jan 20, 2017
    Messages:
    147
    I just want to make a path and determine some values for example speed and accuracy needed etc... to make traffic to TRY to do some obstacles and fun things. Now it's not good. With decal road it rounds the corners and hits everything. There's traffic jams always coz they think if car is next to them they need to stop and act like 85-year old granny who's deaf and blind lol

    I want them to just go and if there's car front then so be it.

    Really love the game, cars, physics, ai when it works, but for a noob like me i don't need recordings or stuff i just need a path what traffic ai would use and TRY to drive it exactly what the values are in the 'dot' I bet system like this would help many many people. In earlier version you almost had one what ive always wished in the game, but sadly u removed it. I noticed some bugs, but still would love to have it even in buggish state if it works with traffic.
     
  5. Dave_

    Dave_
    Expand Collapse
    Research
    BeamNG Team

    Joined:
    Sep 21, 2023
    Messages:
    32
    What you are talking about does sound possible, but we do not have any immediate plans for it unfortunately. I expect this could be done as a mod, however. You would record the input state on the vehicle (at up to 2000 times per second for maximum accuracy) then combine this with some UI. When 'playing it back', you would simply feed the recorded data to the vehicle, in time. That's how I would try and do it, at least. At this resolution (2000 times per second), you should be able to recover things like drifting. There could be very slight difference to what was actually performed, due to non-determinism, but i wouldn't expect this to be very large, if at all noticeable to anyone viewing it.

    If you haven't done so already, or you don't want to do this yourself, it might be worth checking other posts in case anyone has tried something similar to this before.

    Best,
    Dave
     
    • Like Like x 2
    • 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