Question about AI primer tool

Discussion in 'General Discussion' started by Alexander Asner, Feb 16, 2018.

  1. Alexander Asner

    Alexander Asner Active Member

    Joined:
    Jan 30, 2018
    Ratings:
    +39 / 0 / -0
    Hi,

    I am using that tool to race the 2015 Audi TT cup with AI laptimes from the real races in 2015. I understand that the changes I make with the tool are not permanent because the AI adapts after every race is that true?
    Now each round consists of a Qualifying Session and two races. How often and how would I have to tweak the AI. After each session including qualifying? Do I have to quit Raceroom every time or can I write the file during runtime?

    Help would be much appreciated.
     
    • Like Like x 1
  2. Stef van Remy

    Stef van Remy Guest

    Ratings:
    +0 / 0 / -0
    The adaptive AI is collecting the LAST ten laps during a race for carclass/track combination. Quali and practice sessions data are not effecting the AAI.
    I think regarding setting of AI you will need to restart R3E.

    But what kinda tool are you talking about ? If it is what I am thinking I am very very interested in this.

    Edit : ah now I know...will check it out
     
  3. Christian G

    Christian G Topological Agitator Beta tester

    Joined:
    Apr 8, 2015
    Ratings:
    +2,411 / 0 / -0
    He's talking about this tool, that lets you inject the aiadaptation file: https://forum.sector3studios.com/index.php?threads/adaptive-ai-primer-database-tool.5632/

    @Alexander Asner
    So you want to inject the adaptation file with the real times and then stop the game from adding new entries so it doesn't adapt anymore and keeps those injected values?

    I'm not sure if the following works or if it might have any negative effects on the game or its performance, but you could try injecting the file and then setting it to 'read only' (schreibgeschützt). In theory this should prevent the game from writing new entries and preserve the level you primed the AI with. However, again, I take no responsibility for any negative outcomes of doing that, so at least back up everything that's important before trying this. I don't think it should do any harm, but who knows. ;)
    Good luck
     
    • Like Like x 1
    Last edited: Feb 16, 2018
  4. Alexander Asner

    Alexander Asner Active Member

    Joined:
    Jan 30, 2018
    Ratings:
    +39 / 0 / -0
    Too bad I cannot post links as these are my first posts here. You can find a thread here in this forum and download the little tool from GitHub. Just google for "AI primer Raceroom".
     
  5. Alexander Asner

    Alexander Asner Active Member

    Joined:
    Jan 30, 2018
    Ratings:
    +39 / 0 / -0
    >I'm not sure if the following works or if might have any negative effects on the game or its performance, but you could try injecting the file and then setting it to 'read only' (schreibgeschützt).<

    Excellent idea and I think it can worst case crash the game, so what.
     
  6. Christian G

    Christian G Topological Agitator Beta tester

    Joined:
    Apr 8, 2015
    Ratings:
    +2,411 / 0 / -0
    Yep, I don't think it should have any lasting negative effects, but I don't know what happens when the game tries to write to that file and fails. But give it a shot if you want and let us know if it worked.

    And sorry about those newcomer restrictions on the forum, but spam was getting a bit out of hand, so the devs had to raise the security settings. I think after 10 posts you should have full functionality.
     
    Last edited: Feb 16, 2018
  7. Peter Koch

    Peter Koch Well-Known Member Beta tester

    Joined:
    Jan 15, 2015
    Ratings:
    +191 / 0 / -0
    But not if you do 3 lap races
     
  8. Alexander Asner

    Alexander Asner Active Member

    Joined:
    Jan 30, 2018
    Ratings:
    +39 / 0 / -0
    Ok. Tried it and the game crashes at the end of the race as expected not able to access the file. Guess I have to quit RR between races to achieve what I intended. Also RR AI logic does not care for the fact that there is no PTP available during qualifiying. In reality fastest qualifying times are slower than race lap times as during races PTP is available leading to faster lap times. So I would need to patch differently for qualifying and race....Guess I am over engineering it. A German disease. :)
     
  9. CheerfullyInsane

    CheerfullyInsane Well-Known Member

    Joined:
    Oct 24, 2015
    Ratings:
    +402 / 0 / -0
    Nope. The AAI only takes samples during races.
    It couldn't care less what happens in qualifying.

    And yes, the index-file only gets read once upon starting R3E.
    Any data added to it while R3E is running is simply going to get over-written.
    So for any manual changes to take effect, R3E needs to be shut down first.
     
  10. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +412 / 0 / -0
    Why do you want to lock it, what do you want to achieve?
     
  11. Alexander Asner

    Alexander Asner Active Member

    Joined:
    Jan 30, 2018
    Ratings:
    +39 / 0 / -0
    As said above I want to have the AI times match the times and the range that were driven in these races IRL. I think the realism in RR regarding possible lap times is good for this. And it works quite well actually. The only minor inconvenience is that I have to quit, patch and restart after every race. But I can live with that.
     
  12. CheerfullyInsane

    CheerfullyInsane Well-Known Member

    Joined:
    Oct 24, 2015
    Ratings:
    +402 / 0 / -0
    This is probably just me being daft, but if the goal is to achieve specific lap-times, wouldn't you be better off just running the appropriate fixed AI level?
    The whole point of an adaptive AI is that...well, it adapts.
     
    • Agree Agree x 1
  13. Alexander Asner

    Alexander Asner Active Member

    Joined:
    Jan 30, 2018
    Ratings:
    +39 / 0 / -0
    You sure got a point here. But the idea is to also set a range of times in field. That range is pretty much fixed in the fixed AI levels. This range can be set very exact with the primer tool. Or is there some way of setting the variance with fixed AI level I do not know about? I am quite new to RR. Just had it a couple of days.
     
  14. Alexander Asner

    Alexander Asner Active Member

    Joined:
    Jan 30, 2018
    Ratings:
    +39 / 0 / -0
    To make myself clear: With the tool you can set the AI so that all drivers are within a second, or 2 seconds and so forth....
     
  15. CheerfullyInsane

    CheerfullyInsane Well-Known Member

    Joined:
    Oct 24, 2015
    Ratings:
    +402 / 0 / -0
    Actually, you can't. Not entirely sure what gave you that idea.
    All the primer tool does is insert approximate lap-times for any given AI level (or bracket thereof).

    So, the adaptive AI isn't a separate entity. It's a tool that selects an appropriate AI level for you, for any specific combo.
    But all the AAI does is pick an AI level. It doesn't adjust, limit, or in any other way interfere with the AI level picked.
    In other words, if the AAI picks e.g. level 105, it is exactly the same as if you'd run fixed level 105. There is absolutely no difference.

    The index-file (which is what the tool manipulates) contains a list of entries, each describing a car/track combo.
    Each combo entry has two parts; a player-side containing the last 10 lap-times, and an AI side containing the AI levels that has been tried and their corresponding lap-times.
    Whenever you hit that 'Race' button, and you have Adaptive AI selected what happens is that R3E looks up your lap-times for the combo and takes the average of them. It then compares that average to the lap-times it has stored for each AI level it knows about, and picks the closest one. And that AI level is what will be used in the race.
    If it can't find an AI level that has an appropriate lap-time, it will then jump X number of levels to try and find something closer to the player lap-times; this entry is subsequently added to the index-file.
    How much of a difference is needed for it to jump, and how far it jumps, I don't know.
    There's an algorithm somewhere that governs that, but it's in the encrypted portion of the file-structure.
    I do know that the closer it gets, the shorter it'll jump, which means that it's using some sort of variation on root-finding through bisection. But that aside, anything else would be sheer guesswork.

    The idea is that as you do more and more races, you'll get more and more entries added to your index-file, and subsequently the AAI will have an easier time to pick the 'right' AI level to run at.
    Which is fine in theory, but it does mean having to do quite a few races in order to establish a base-line before it'll be able to adapt.
    So @pixeljetstream came up with the Primer Tool to get the ground work done in less time.
    But the tool does not in any way enable you to 'design' an AI level.
     
  16. Alexander Asner

    Alexander Asner Active Member

    Joined:
    Jan 30, 2018
    Ratings:
    +39 / 0 / -0
    Thank you for the extensive explanation. I think I was misled by the fact that you can enter a range and a stepping in the configuration file. However: As a matter of fact a certain fixed AI level still produces a variance in the speed of the different cars. You still have slower and faster cars in the field. Could it be that the entries the tool produces have an effect on the speed difference (or range) of the cars in the field. This might be a placebo effect but I am quite certain that I have witnessed this kind of behavior. Could it be that according to the variance of the times in the aidadptations.xml table the AI changes the variance (a.k.a. speed difference) of the cars in the field? Just guesswork I admit.
     
  17. CheerfullyInsane

    CheerfullyInsane Well-Known Member

    Joined:
    Oct 24, 2015
    Ratings:
    +402 / 0 / -0
    Nope. As I said earlier, whether you run adaptive or fixed doesn't change the AI as such, it only changes the way it finds the AI level to run at.
    Latest patch introduced a race-day variance into the specific drivers, so it's not always the same guys who'll win.
    And I'm pretty sure this is what you've been observing.

    This is educated guess-work, but I'd assume that behind the scenes there is something like the talent-files in GTR2, stating stuff like starting-ability, passing ability, how much of the theoretical grip he uses, and so on.
    So, for the sake of argument, let's say we have 20 AI drivers with a simple percentage-rating of 100 to 81.
    Driver 1 is 100%, driver 2 is 99% and so on.
    Next, let's just say that each percentage-point difference will give you a 1 second difference in lap-times.
    (Highly simplified, I know. Just play along. :) )
    So assuming everyone qualifies in the right position, after 3 laps you'd have P1 three seconds ahead of P2, P2 three seconds of P3 and so on. Or in other words, no matter which race you have, you'd always see approximately the same spread, barring racing-incidents and the like.
    Now we introduce a race-day variance of 5 percentage-points. (Again, simplified and far too big. Merely illustrating a point)
    Now we might see P1 running 2 seconds slower than P2, who in turn runs 5 seconds faster than P3.
    Or you might see the entire grid moving en masse down the track, because they're fast enough to keep up without being fast enough to overtake. Which means you'd be seeing a far lesser variance in the lap-times.
    Doesn't mean that the AI has changed, it just means the variance introduced has produced that particular result.
    Exactly how they've done the variance is (at least to me) unknown. It might be a flat modifier, or it might be more complicated.
    Had it been me, I would've defined the fast guys as also being more consistent i.e. less variance, with some of the slower guys having the option of having a really good day (or bad, I suppose). But that's just me, and I haven't spent enough time with the AI to gather data that'll point me in either direction. I would assume that it's a flat modifier on the entire grid since that's simpler to code, but an assumption is all that is.

    Should you feel like it, you can easily gather empiric data on the spread of the AI drivers.
    If you go to your \Documents\My Games\SimBin\RaceRoom Racing Experience\UserData\Log\Results folder, after each race there'll be a plain-text file generated stating both the race-time, and best lap-time for all drivers in that race.
    Take a single-make class e.g. AudiTT, and run the same race against the same opponents4-5 times, and save the results.txt file between each race. That'll give you a decent data-set for comparisons.
    Just be sure you pick a class where you run against all the cars in the class. Otherwise the AI will pick drivers at random, and you'll never be able to compare anything.
    So don't use GTR3s. ;)
     
  18. Alexander Asner

    Alexander Asner Active Member

    Joined:
    Jan 30, 2018
    Ratings:
    +39 / 0 / -0
    Ok mate. I stand corrected. Thx for taking the time to explain all this in such detail. I really appreciate it.
     
  19. CheerfullyInsane

    CheerfullyInsane Well-Known Member

    Joined:
    Oct 24, 2015
    Ratings:
    +402 / 0 / -0
    Not a problem, happy to help. :)