The Future Of: AI

Discussion in 'General Discussion' started by burgesjl, Dec 15, 2018.

  1. burgesjl

    burgesjl Registered

    Joined:
    Feb 2, 2013
    Messages:
    157
    Likes Received:
    296
    This thread is going to discuss the future for AI.

    In general, I'd say I have two issues with AI. First, is how they conduct basic on track driving, how the AI cars appear to behave on track with respect to the physics. Second is how they perform whilst in competition with either other AI cars or human opponents.

    When I review an AI car driving around the track in front of me, I see several concerning issues in rF2. First is the apparent application of braking and acceleration. For the former, you often see the cars lock up wheels and leave black tire marks on the road, even at relatively low 'strength' levels. The brake application seems very abrupt and digital, and not at all smooth. They don't seem to have a great concept of things like threshold braking and trail braking. For the latter, throttle application is also very digital, on-off, and not smooth. You can hear this in the engine notes. I've never seen a human be quite so reactive/jumpy in inputs, and review of telemetry shows that people do spike and have quite large fluctuations on inputs quite rapidly, but not to the same extent as the AI cars do. Possibly it's down to the physics 'tick' rate and not having sufficient chances to modulate inputs. But the net result is the car doesn't seem to be operated in the same fashion as a human would.

    Further, the behavior of the car under AI control is also different to a human-driven car. My understanding is they run a simplified physics model. And at times, this clearly shows especially as the car say rides curbs or comes off curbs, where there are very noticeable jumps. The cars also seem to have almost infinite grip, or at least, very different grip characteristics to the non-AI cars. Whilst they can make mistakes, often hilariously overshooting corners/apexes if the AI "line" isn't well constructed, they don't seem to make the same mistakes as humans make, and often we end up in "lazy spins" into and out of corners as we try to regain control and fail, where the AI most usually makes immediate corrections and continues on.

    Finally there is competition strength, and under what circumstances they try to take a different line, overtake, or defend an overtake. Far too often the cars seem to run in a "train" and not try alternate lines/looks, or run into the back of you as they intend to hit their pre-programmed brake markers whilst sticking to that ideal line. They do a good job generally of avoiding side-to-side contact and sticking to a line once selected within a corner. We all appreciate how a human will "fake" a move one way with full intent to make the move a different way: the "over-under" and similar as opposed to just making a pass due to superior traction into or out of a corner.

    I have to figure part of these limitations are based on the fact that the AI physics are in the same physics thread as the calculations done for the human player. In other words, that one processor thread has to do all the work. Not sure if programming wise the AI 'logic' can be separated out into separate threads, but it seems a bit silly that many of us have machines with 4/8/16 threads possible and only 1 or 2 being used, CPU being completely under-utilized in total as a result.

    Discuss!
     
    pas74 likes this.
  2. LokiD

    LokiD Registered

    Joined:
    May 3, 2017
    Messages:
    1,270
    Likes Received:
    1,192
    not to mention they cant overtake under a draft when there speed and space to do so. AMS ai is actually as good minus the defend move. Try raceroom ai, they defend and block.. but have issues also with collision physics
     
    Last edited: Dec 15, 2018
    M D Gourley likes this.
  3. Emery

    Emery Registered

    Joined:
    Oct 24, 2010
    Messages:
    2,652
    Likes Received:
    1,295
    Let's get some things clear here. The braking zones are not "pre-programmed" (except for special slow-down zones, like entering pit lane). Rather the AI is looking ahead some number of waypoints (AIW=AI Waypoints) and applying the brakes (or coasting) if the curve looks too sharp from their current position.

    The number of waypoints the AI look ahead varies with speed and the car mod-maker has control over how far they do so. There is a tradeoff between good performance and cpu-time for which ISI & S397 provide guidelines (see the physics blog).

    Braking and accelerating are indeed trinary for rF2's AI (throttle on, coast, brake). Average the digital out and you have analog. Automobilista is a good example of where we'd like to be in this regard. Since it's highly likely Luminis wrote the improved AI code for Automobilista, then we know S397 has access to that talent. There are still shortcomings in AMS's AI that have been answered in rF2, particularly when it comes to oval tracks (or tracks that are similar to ovals, like Goiania's outer ring).

    Should players and AI use the same physics? Probably not. Here's my list of reasons why:
    1. As Assetto Corsa has demonstrated, if 100% difficulty is as high as your AI can go, then the AI code has to be perfect or else humans that can beat it are numerous enough that the AI becomes ineffective. Never underestimate human capacity to perform!
    2. Observed behavior is more important than how that behavior is generated. AC is again my poster child for where we do not want to be, as the AI behave far too similar to a room of drunk rookies weaving about despite using player physics.
    3. AI don't 4-wheel drift unless the AI physics are tuned for it. No sims have AI that are happy with small slides. For instance, you will never see an AI chase their traction, they will always check up a bit if they lose traction and start over. Given the amount of CPU time that can be devoted to AI, I honestly doubt it is possible to write a program that will keep an AI on the edge as it has no way of knowing "this amount of slip is okay, just ride it out". Thus to get the right effect, it is simpler to tune the AI physics (dynamic balance or slip angle) than to write the program.

    Not infinite grip, LOL! For instance, the Eve & Spark F3 are slower in corners by about 8% compared to a player's tuned set-up.

    There is are AI grip multipliers (front tires, rear tires) in the tire file which can be used by the mod-maker to tune the AI's cornering capability, both in balance & speed. I believe this is partially in lieu of having to create AI setups for every track. If a mod-maker tunes the grip for this purpose, my recommendation derived from experiments is to not go above 110% otherwise the AI becomes the windshield to our bug (or the baseball bat to our ball)… in the rF1 days, I saw values as high as 132%!
     
    M D Gourley and pas74 like this.
  4. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    7,621
    Likes Received:
    3,222
    S397 have said they won't rewrite the AI, so I wouldn't expect fundamental fixes. I agree the throttle application isn't great, doesn't look great, certainly doesn't sound great, but AI isn't an easy thing to do so unfortunately we probably won't see that changed.

    Splitting AI physics onto a separate core would make sense, but I doubt we'll see that in the short or even medium term.
     
  5. ECAR_Tracks

    ECAR_Tracks Registered

    Joined:
    May 1, 2016
    Messages:
    456
    Likes Received:
    464
    IMHO a good quality AIW file provides excellent races against AI despite the points refereed by @burgesjl. If there are proper corridors, AI lines, block lines and patches well took cared off by the track creator, the AI cars will run better than any simulator I ever tried. Not perfect, of course, but pretty decent fun factor.

    My main problem with AI is when it's raining. They become completely inconsistent in terms of speed and race strategy. It actually destroys the offline wet racing fun for me.
     
    TJones, RoboCAT10 and jayarrbee36 like this.
  6. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    785
    Likes Received:
    850
    I've always wondered why they don't provide an API for the AI drivers so that we could write our own. There's a load of software already available such as TORCS.
     
  7. AMillward

    AMillward Registered

    Joined:
    Apr 4, 2017
    Messages:
    1,680
    Likes Received:
    1,596
    The don't like behaving themselves on formation laps or behind safety cars either. But I think some of it may be mod/track related.
     
  8. Emery

    Emery Registered

    Joined:
    Oct 24, 2010
    Messages:
    2,652
    Likes Received:
    1,295
    That was working fine, but around the time S397 appeared, it became broken code. Probably like 6 months before?

    The way I remember it going is that AI couldn't sort themselves into the proper order on ovals during FCY when ISI moved the rules into a configurable plugin, then it was eventually fixed. Back then, there was never a problem with the AI keeping up with the pace car during formation laps. The fix lasted until the code got broken and the current behavior of AI not being able to keep up with the pace car started happening. I haven't checked if they have troubles again sorting out the proper order, mainly just been annoyed with formation laps.
     
    Last edited: Dec 17, 2018
  9. AMillward

    AMillward Registered

    Joined:
    Apr 4, 2017
    Messages:
    1,680
    Likes Received:
    1,596
    They have issues where at some tracks they'll randomly pull to the side of the track and at others they'll pull away from the pack, then slam on the brakes and you either go past them (and get a penalty), smash into the back of them or just pull up in time with tyres that look like a 50 pence piece.
     
    Emery likes this.
  10. marvelharvey

    marvelharvey Registered

    Joined:
    Apr 25, 2013
    Messages:
    402
    Likes Received:
    268
    The default FCY AI has been broken for ages (cars driving at 30-50km whilst others speed off behind the safety car) and I've made multiple threads complaining about it. However, I fixed it somehow by changing some values, but I can't exactly remember which change was the one. Anyway, try changing the following. It was probable one of these...

    In CustomPluginVariables.json's StockCarRules section:

    " Enabled":0,
    "AdjustFrozenOrder":25,
    "AdjustUntilYellowFlagState":4,
    "AllowFrozenAdjustments":1,
    "WaveArounds":1,

    And in Player.json's Race Condition section:

    "Adjust Frozen Order":0.5,
     
  11. AMillward

    AMillward Registered

    Joined:
    Apr 4, 2017
    Messages:
    1,680
    Likes Received:
    1,596
    Is that an oval only thing or does it work for road courses?
     
  12. marvelharvey

    marvelharvey Registered

    Joined:
    Apr 25, 2013
    Messages:
    402
    Likes Received:
    268
    Works fine on road for me.

    It's probably the Enabled":0" line or the Frozen Order one.
     
  13. AMillward

    AMillward Registered

    Joined:
    Apr 4, 2017
    Messages:
    1,680
    Likes Received:
    1,596
    I'll have a look and see if it works for me. Hopefully I can turn all the settings back up after!
     
  14. daredbarn

    daredbarn Registered

    Joined:
    Dec 30, 2011
    Messages:
    42
    Likes Received:
    10

    Sounds like you have never tried to run ovals, use stock car rules, have full track cautions turned on, or run past a fuel window.

    The AI, in the condition they are in, make races with most of the above enabled impossible, don’t care what track you are on or who built the lines in the AIW file.
     
    ECAR_Tracks likes this.
  15. marvelharvey

    marvelharvey Registered

    Joined:
    Apr 25, 2013
    Messages:
    402
    Likes Received:
    268
    Indeed. In a single class, road course, sprint race, with green flags from start to finish and dry weather, rF2 has by far the best AI in the business. But outside of those perfect conditions...
     
  16. OzzyNeil

    OzzyNeil Registered

    Joined:
    Jul 6, 2011
    Messages:
    67
    Likes Received:
    11
    They really need to address these issues, I was looking at the GT bundle 35% off pack in the winter sale, but i'll give it a miss this time round.
     
  17. jonrarit

    jonrarit Registered

    Joined:
    Jan 17, 2012
    Messages:
    80
    Likes Received:
    22
    The best AI I have found so far is the enduracers ones used in both the flat6 mod and their endurance mod. They defend, block & undercut as well as make more realistic mistakes.

    Ok it's not perfect but they can (sometimes) draft and overtake too.

    Worth taking a look at if you race off line imho

    JR
     
  18. ECAR_Tracks

    ECAR_Tracks Registered

    Joined:
    May 1, 2016
    Messages:
    456
    Likes Received:
    464
    Yeah, I hate ovals. But I can fell your pain, moreover it seems to will never be fixed.
     
  19. marvelharvey

    marvelharvey Registered

    Joined:
    Apr 25, 2013
    Messages:
    402
    Likes Received:
    268
    So what are the problems with the current AI? Perhaps keeping a list in this thread will help.

    Race ruining issues:
    1. Under FCY, the pack may split into two. One following the safety car as normal and the other drives at varying speeds (20km to 120km). I think this issue is only present when using Stock Car rules?
    2. When a car is preparing to come into the pits, cars behind will not overtake for the duration of the preceding lap. Even if they're different classes.
    3. Poor fuel estimations
    Other issues:
    1. AIs can sometimes find themselves in a pack of drafting cars, but refuse to overtake. Instead of pulling out of the draft to pass, they brake. This is until the player is detected behind, at which point they move to the defensive line and now with no cars ahead, promptly overtaking the cars they've been stuck behind for 5 laps.
    2. Under FCY, the AI can occasionally ignore the no-overtaking rule for the player car and will push their way passed. They continue to obey the no-overtaking rule for other AIs though.
    3. This one is more subjective, but I feel they give up corners way to easy. Even if I'm on the outside and my front wheels are aligned with their rears, they yield. Perhaps I need to test this with more aggressive AI.
    4. The digital throttle on/off through corners.
    All of the above is with stock content.

    Am I missing any?
     
    mantazzo and LokiD like this.
  20. Pales

    Pales Registered

    Joined:
    May 9, 2017
    Messages:
    307
    Likes Received:
    290
    This is a perfect summary, one which Studio 397 should acknowledge. When I raised these points on the Race Department forum, they addressed these in my post and politely said, “we may get round to it”. So yeah, we’re very unlikely to see anything for at least a few more years (if ever)..

    One other thing to note is putting. If the AI pit for fuel, they will also replace tires regardless. It is also the same vice-versa.

    It’s unfortunate really, RF2 is my most desired game; but the lacking AI in the aspects we have outlined really kill off the immersion. Partly why I am now looking into Raceroom following the recent multi class update.
     

Share This Page