AI traffic possible improvement

Discussion in 'Ideas and Suggestions' started by ericmarciano, Sep 26, 2022.

  1. ericmarciano

    ericmarciano
    Expand Collapse

    Joined:
    Sep 1, 2021
    Messages:
    66
    Hello,

    I have been a video game developer a long time ago, so I know how difficult it is to implement an AI that acts as a real human, so I don't blame the developers if the AI is not perfect, it is good and I my idea here is to suggest changes that "look" simple and that could improve the driving experience:
    - When an AI vehicle sees another vehicle coming the opposite way, it slows down and often brakes as if a collision was about to happen. Nevertheless, there is no risk of collision because each vehicle is its own lane. So why does this happen? Can it be fixed?
    - The AI vehicles have a correct speed on straight roads, very similar to real life. But when there is a turn, they slow down way too much. I often pass sport cars such as Civetta with a Pigeon, isn't it strange? I don't know how the AI vehicle speed is computed, but I think it can be increase even in curves.

    I think other users have thought about this. Any feedback is greatly welcome.

    Thanks.
     
    • Like Like x 2
    • Agree Agree x 1
  2. Gamergull

    Gamergull
    Expand Collapse
    BeamNG Team

    Joined:
    Jun 3, 2018
    Messages:
    460
    Hi there!
    • The first issue happens because when checking for possible collisions, each AI will assume that the other cars' trajectories are a straight line. It was done this way so that awareness could work in all situations, not just roads. So yes, this has the nasty side effect of too much caution on even very gentle curves. A solution is possible, but it might be tricky to implement, due to the fact that each AI vehicle runs its own Lua environment (with limited physical data being shared between them; length, width, position, rotation, and velocity are currently being used).
    • The traffic AI is programmed to not exceed a certain level of lateral g-forces for turns, but yeah, it is a little bit too far from the limit. I'll forward this.
     
    • Like Like x 3
  3. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,060
    The first point here actually explains why the AI will sometimes just randomly turn into you when you are driving fast on the wrong side of the road. You are trying to swerve around it but it thinks you are still going in a straight line and turns in the same direction and crashes into you. Would be cool if it was fixed, but I had no idea it was so tricky.
     
  4. ericmarciano

    ericmarciano
    Expand Collapse

    Joined:
    Sep 1, 2021
    Messages:
    66
    Thank you for your explanations, now I understand the constraints you are facing with AI. I thought each AI vehicle was aware of the position and speed for all the other traffic vehicles but I understand it is not the case, which makes their interaction harder to manage.
    Regarding the second point, I hope you can improve this, I am sure the AI vehicles can handle some more Gs :D
     
  5. DeWorD

    DeWorD
    Expand Collapse

    Joined:
    Jan 20, 2017
    Messages:
    144
    plz make an option in decal road editor what would force ai just to press gas and try to steer? :D Could use that in many ways as now ai is stuck in many hills coz they don't know to press gas when stuck. Would be awesome to them to read heightmap too around, but that's probably a bit too much :D
     
  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