Question for Devs: Automatic Performance-based AI Difficulty

Discussion in 'General Discussion' started by shovas, Oct 29, 2019.

  1. shovas

    shovas Member

    Joined:
    May 17, 2015
    Ratings:
    +19 / 0 / -0
    Have you considered a system that would intelligently set AI difficulty based on actual performance data from practice and/or qualifying sessions and instantly set that for the next session, whether that is qualifying or the race?

    My experience with RaceRoom Racing Experience Auto AI has always been frustrating. I want it to adjust every single lap I run, or at least for the next prac/qual/race session, but the current system only adjusts for the next race, if I'm not mistaken. That's a lot of junk races to get the right AI level and it still won't be right for the next track because AI level for one track doesn't mean much for another track.

    The main technical problem with AI Difficulty levels is that they are not granular enough to ensure close driving. AI are either getting ahead of you more and more or falling behind more and more.

    I've been investigating a simple idea for a straightforward laptime-based calculation that would adjust AI difficulty instantly to a given laptime, your best practice or qualifying laptime, for example.

    You can see some discussion, details, notes, spreadsheets, etc. over here:

    https://www.racedepartment.com/thre...ight-ai-level-without-trying-them-all.160599/

    https://www.racedepartment.com/thre...ut-trying-them-all.160599/page-5#post-3030917

    It's basic and my investigation is sophomore at best but I don't think I'm wrong that a simple formula based on actual performance could provide competitive, hard-fighting, clean-driving AI (I know it can from experience when I get the numbers just right).

    The formula simply adjusts AI laptimes to suit a given grid position. Do you want to compete for top spot then plug in the #1 Practice AI's laptime and adjust is up or down to meet your own best laptime. Do you want a good top 5 battle? Adjust to AI #5's laptime. And so on. You could even plug in a fuzziness to it to avoid always ending up in a certain grid position.

    My work has been with GTR2 and playing with low-level config file AI params that have more granularity than AI Difficulty levels. Those params follow a logarithmic or similar curve, unfortunately, that I need to map out for different AIs across different cars across different tracks. It's super tedious but I'm confident such a system could be automated if implemented in-game with all the data at hand in the code as you are running a race day.

    I've been trying this on and off for a year or two and when the numbers work out the AI are incredible to drive against, even in a 2006 game like GTR2, but so far it has been relative guess-work due to the unknowns in the AI performance curves.

    Thanks for taking a look. I'd love to hear your input.
     
    Last edited: Oct 29, 2019
  2. Goffik

    Goffik Well-Known Member

    Joined:
    Jun 30, 2017
    Ratings:
    +170 / 0 / -0
    Do you watch any racing? Practice sessions are used for testing purposes, trying different setups, different lines, etc. The times set there are not indicative of race pace. The same is true of qualifying. Hotlapping is in no way the same as actually racing with other cars around you, hence the reason qualy times are nearly always faster than the fastest lap set in race conditions. Who wants AI based on a lap 1-2 seconds faster than actual race pace? Hence why the current AI only uses race data.

    Again, not really workable. If the AI is speeding up and slowing down after every lap of every session, how would you ever make any progress? Find a new, faster line and the AI in front instantly adapts so you can't ever overtake or get pole position. Start making mistakes and the AI instantly adapts so you never get overtaken. Sounds boring as hell to me, and would give no sense of advancement as you improve as a driver.

    Ever check the Community Workshop? There's an AI priming tool which greatly reduces the time and effort required to "train" the AI.

    Maybe I'm misunderstanding this part, but are you seriously suggesting a system that allows the player to set what position they want to be battling for during the race?

    Sorry if I'm sounding overly critical but this is just my thoughts on the system you're proposing. I think the current system does a good job, and with the primer tool I've had plenty of hard-fought, close races with the AI without any issues.
     
    • Like Like x 1
    • Agree Agree x 1
  3. shovas

    shovas Member

    Joined:
    May 17, 2015
    Ratings:
    +19 / 0 / -0
    Thanks for your interest in my post.

    I'm only suggesting the idea that AI difficulty could be automatically calculated based on actual player performance in a pre-race session, whether that be practice or qualifying, and then the race would have the correct AI difficulty for a competitive, hard driving race.

    I'm probably being unhelpfully helpful by all the examples and details I'm giving.

    I'm specifically referring to either practice or qualifying here. Ideally, practice, and less ideally, qualifying. In those sessions, since you're only racing against the clock, I could go for either (A) update AI difficulty every lap to match your current performance or (B) update AI difficulty for the next session.

    Once practice and qualifying are done the AI difficulty is fixed and should reflect your most recent, realistic performance level.

    The idea with practice is that you'll have much more consistency by the end of the session than you had at the beginning.

    To address your concerns of 'instantly adapting' you could have a time-based averaging formula where AI adapt quickly earlier on and then more slowly the more laps you've put in.

    I haven't. Just checked. That's a good idea although we all know that's more involved than most are going to want to go through. Perhaps if it gained mass adoption and was as smooth as possible to walk through it could be a good solution.

    I'm sure most would prefer an in-game, transparent solution if they could get it, and based on my experience, I think it is closer to reality than we might think. It's just on the end of my fingertips in my own work.

    No, or not exactly. I knew that part would be unclear. Yes, actually, you might have an arcade-style choice of easy/medium/hard that might place you in the top 3, or top 6, or top 10, etc. Or you might do something a little more involved (in the code, I mean) to spread out the field around the player based on some fuzziness (randomness), like for example, some driver just happens to have an amazing day, or say a top seed like a Hamilton has a terrible day. But for the most part you would be gridded amongst AI that are very, very close to your performance to ensure a competitive, close driving race.

    These are good, honest, and tough questions, and I appreciate that as that's what's needed to iron out the problems in any given idea.
     
    Last edited: Oct 29, 2019