AI and tire selection

Discussion in 'Car Modding' started by dosequis56, Mar 20, 2023.

  1. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    133
    Likes Received:
    48
    I have seen some threads on this topic, but no conclusion or solution that helps.
    I am trying to get decent F1 racing with AI. With good AIW, RCD files, etc. I find I can produce pretty good results with driving lines, passing etc. Safety car is a disaster, but living with that at the moment (may not have a solution anyway).
    But, the tire selection of AI is a problem. I can live with AI not playing by F1 rules and choosing the best tire for the situation regardless of rules that say must run two compounds in a race. But, the AI ALWAYS appear to select the tire based on TBC lines ...
    DryLatLong=(2.0220,2.0120)
    WetLatLong=(0.9099,0.9054)
    Contrary to some threads that claim they select the hardest tire, suggest using alternate upgrades file and so on. AI in my class will always use my tire TBC choice and not their own from VEH/HDV and Upgrades file. So basically, they always choose the tire with max grip for the conditions, even if it means they have to stop to change tires when a tire that would allow them to run all the laps is available. I also don't think they will ever run the intermediate tire since their is no wetness threshold vs. longevity info decision.
    Does anyone have any insight into alternate ways to get them to make a different decision?
    - can I adjust in a plugin?
    - can I use memory mapping plugin and force feed some values?
    - any property I can change to adjust the decision, besides the actual grip setting that also changes my tire dynamics?
    - perhaps I should have AI cars in a different class. Has anyone tried this approach to see if I can now alter their tire choice?

    It is interesting that AI choose different tires in practice, so they know how to do it, they just don't seem to know when to do it.

    Thanks.
     
  2. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    133
    Likes Received:
    48
    Two additional updates:
    1) It does look like vehicle specific upgrades and TBC setting works to prevent AI from selecting soft tires. I had missed the track override in the upgrade file
    2) the DryLatLong and WetLatLong settings do not seem to change AI tire selection. I tried to define some terrible numbers for C3 tires and AI would still choose them.
     
  3. SharD

    SharD Registered

    Joined:
    Apr 17, 2019
    Messages:
    379
    Likes Received:
    438
    Whether the AI picks rain or dry tyres is decided by this value:

    WetWeather=0.75

    0.00 = dry
    0.70 = intermediates
    1.00 = wets

    DryLatLong= and WetLatLong= is how much grip the tyres have.
     
  4. Nicola59

    Nicola59 Registered

    Joined:
    Dec 5, 2014
    Messages:
    157
    Likes Received:
    178
    Dear mates,
    maybe i could be wrong.....but....
    in RF2, unfortunatelly, AI drivers are NOT changing compounds during their pits. Although the "code" of the game is prone to allow AI drivers changing compounds, for example from hard to soft, this is not happening.
    If You see a F1 race in automatic mode ( I ), when AI drivers are pitting, You can see, just for a moment, the change of compounds ( if tyres are recognizable by different colored stripes ), but then, starting the car from pitlane, installed compound comes back to the original one.
    For what I know, S 397 Team seems to have not yet implemented this feature.
    In RF1, thanks to the great RFE Plugin from Marco Rotondi, this was possible.

    Anyway, back to the topic:
    AI drivers are usually loading tyres included in the TBC set, reported in the HDV ( physics ) file.
    Let's take, for example, a F1 HDV file reporting in its [GENERAL] section a TBC set called as follows:



    TireBrand=Pirelli_F1-2022_Tires_C1_C2_C3.tbc
    FrontTireCompoundSetting=2
    RearTireCompoundSetting=2


    The above strings in HDV are saying that TBC has 3 dry compounds, and that HUMAN player will load compound number 2.
    If in the TBC are reported, for example, C3 as first, then C2, and C1, the number order is:
    0 for C3, 1 for C2, and 2 for C1.
    So, human player will load C1.
    Of course, editing TBC and HDV, You can impose another compound order and tyre set

    If You put in HDV
    FrontTireCompoundSetting=0
    RearTireCompoundSetting=0
    Human player will load C3.( the first reported in TBC )

    For the moment, forget the rain compounds, Intermediate and Wet, that could be also present in TBC.
    They can be reported also as first, and the order of dry compounds may change.
    But, in this moment, let's consider only Dry compounds.
    The discussion, infact, is quite complicated.

    Now, giving that Human player is loading C1, due to the tirecompoundSetting=2 ( the third compound, after 0 and 1 )
    AI drivers may load the same Human player compound, or not, depending from another factor included in TBC file.

    If You open to read the TBC file, You will see for each Front and Rear section, the string
    Softness=0......
    This value, although originally was reported maybe as a physical factor ( IMO ) , it is always used by RFactor as "strategic" factor, and it's important for AI drivers.
    Strategic factor means that RFactor is loading always the "less" soft compound as first.
    If in Your TBC file the 3 dry compounds are featuring, for example, 0.60 softness for C3, 0.58 for C2, and 0.56 for C1 ( this division could be logical and natural indeed...), the tyre compound loaded will be C1 ( 0.56 is less soft than 0.58, or 0.60 ).
    Softness is a number that in RF can be also more than 0.6, but it should not be more then 0.85, commonly used for Intermediate, and 1.0, used for Wet tyres
    ( These values of Softness for Intermediate and Wet must be remain as they are, to avoid issues or mismatches, in case of Rain.)

    So, when starting game, considering the above TBC C1-C2-C3, in which the less soft compound is C1, that is also indicated in HDV ( tiresettin=2 ), Human player will have Hard compound, like also AI drivers.
    But....if You want that AI drivers may load as first compound the C3, for example, You have to write in TBC, under C3 section, the hardest softness, 0.56 ( although this is resembling a non sense thing ).

    Example:
    The TBC is reporting 3 dry compounds, named ( in order ) C3, C2, and C1.
    The softness of compounds is logically reported as 0.60 for C3, 0.58 for C2, 0.56 for C1
    The HDV is reporting tire compound setting=2

    Human player, and AI driver, will load both the hardest compound C1
    You want that AI drivers are loading C3, instead of C1, while Human player is continuing to load C1?
    Put in TBC under C3 the less value for softness ( in this example, 0.56 ).
    In this way, Human will start the session with C1, while AI drivers will load directly C3.

    DryLatLong=(
    WetLatLong=(
    are not influencing the choice of tyre compounds; they are only grip factors for AI tyres, in dry and wet conditions.

    The fact that in RF2 AI drivers are loading Intermediate, or Wet tyres, in case of Rain weather, is depending from track dampness and rainfall intensity. These factors interact with string-code reported in TBC on the Intermediate and wet compounds:

    [COMPOUND]
    Name="Intermediate"
    WetWeather=0.75 // until 75% of track dampness


    [COMPOUND]
    Name="Wet" // 100% of track dampness
    WetWeather=1

    All this explantaion on which tyre compound AI drivers ( and Human...) may load is complicated from the use of Upgrades.
    If You have designed in Upgrades a different tyre set from the default one ( in our example, C1-C2-C3 ), for a specific track, let's say C3-C4-C5, You have to compile a TBC set with these compounds, and if You want that drivers are loading as first the softest compound, You have also to impose to this compound the "hardest" softness.

    I hope this my explanation may do more clear the concept on how RF2 is imposing to drivers the tyre componds.
    Overall, I hope You are not more confused by my replay.
     
    atomed and dosequis56 like this.
  5. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    133
    Likes Received:
    48
    This is a lot of great data. Let me try working with the softness value. My goal here is only to choose which tire they will use, not to fix the issue of them not changing compounds which I have decided is not doable. Thanks.
     
  6. Coutie

    Coutie Moderator Staff Member

    Joined:
    Oct 5, 2010
    Messages:
    3,787
    Likes Received:
    2,244
    This may not be what you want, but it was changed in the first build this year that in practice the AI always use random tires. In qualifying and race, they'll always use the fastest one.
     
  7. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    133
    Likes Received:
    48
    The question is really how they determine fastest one. I took the soft tire and made it terrible and they still chose it and ran 1/2 speed laps. I wanted them to pick mediums so they would stop short pitting. It is is not softness, then I have to keep trying to figure that out. I do already have a working model using separate TBC files for AI cars which does work but causes a bit of an issue with tire graphics unless I put in a dummy wet tire in the TBC file in position 1.
     
  8. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    133
    Likes Received:
    48
    On a different topic, I notice the AI are wearing their rear tires away too quick while having almost zero wear on the fronts. I have yet to see if I have the same issue and it is more of a vehicle physics issue vs. AI issue.
    They seem to get about 20-30% less laps on tires vs. what I would expect a real F1 car to get.
     
  9. Nicola59

    Nicola59 Registered

    Joined:
    Dec 5, 2014
    Messages:
    157
    Likes Received:
    178
    Hi, mate
    The wear of AI must be set in TBC file, under the string “wear”.
    Ideally, AI compounds should offer the same wear of human tyres ( tgm ).
    And this is not quick or easy work to get editing TBC and TGM files.
    You need a lot of test sessions to reach this.
    For tgm wear editing there is the great Online Tool by Redapg.
     
    dosequis56 likes this.
  10. SharD

    SharD Registered

    Joined:
    Apr 17, 2019
    Messages:
    379
    Likes Received:
    438
    I've seen AI cars use both softs and mediums during the race as well, but not as commonly.

    It may also have to do with the fact that I use a time as a race criterium rather than laps, as with that, the AI also uses the fuel set in the .hdv file rather than all cars using the same amount of fuel.
     
    Last edited: Mar 23, 2023
  11. Coutie

    Coutie Moderator Staff Member

    Joined:
    Oct 5, 2010
    Messages:
    3,787
    Likes Received:
    2,244
    I'm no programmer, but the AI is able to estimate their lap times, so they may check it on all tires, then choose the one that gives them the fastest time.
     
    atomed likes this.
  12. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    133
    Likes Received:
    48
    Unlikely. In a race, all cars choose the same tire regardless of if they ran practice laps.
     
  13. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    133
    Likes Received:
    48
    From my experiments, I think they may choose the tire with most TGM grip without regard to TBC settings. Or perhaps they always choose the first tire in the TBC file since that is the RED tire. I can make the tire complete garbage in TBC file and they still choose it. Make it last one lap in wear, make the grip so bad they run 1/2 speed and so on. Makes no difference to their tire choice. So still at a loss other than to change VEH files to point to a TBC file with limits choices. Unfortunately, this also alters the textures used, so they will run a MEDIUM tire with RED sidewalls due to graphics file indexes. All I can try is define YELLOW, INTERMEDIATE and WET as 1st, 2nd and 3rd and then add RED and WHITE as last two. Not ideal.
     
  14. Matheus Pucci

    Matheus Pucci Registered

    Joined:
    Mar 23, 2023
    Messages:
    17
    Likes Received:
    4
    So if i write the same value to C1, C2 and C3 the AI may choose "ramdomly" which tire to start the race? Because i've been playing F1 mods and i've noticed tha F1 2010 and F1 2012 are great with AI tire strategy. They start the race with different compounds and make different choices during pits. I'll try it tomorrow!
     
  15. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    133
    Likes Received:
    48
    Let us know. I don't think so however.
     
  16. Matheus Pucci

    Matheus Pucci Registered

    Joined:
    Mar 23, 2023
    Messages:
    17
    Likes Received:
    4
    Unfortunately didnt work. I tried many settings and the only thing i've achieved was AI using Hard tires from the beggining. I still dont know how some mods make the AI change compound. I'm looking into VEH, TBC and HDV files but nothing is different.

    My best bet so far is that the TBC files are the key, they all have more than one TBC file for each team, but still dont know how AI change tires.
     
  17. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,025
    Likes Received:
    2,883
    @Matheus Pucci Are you sure, that in the described Mods (F1 2010 and F1 2012), the same AI Car changes his dry Tire Compound during a Pit Stop?
    As @Nicola59 (Happy new Year BTW :)) has said already, to let different Cars start with different Compounds, is possible.
    But as far as i know, an AI Tire Strategy, with predefined Compounds is no rFactor 2 Feature.
     
  18. Matheus Pucci

    Matheus Pucci Registered

    Joined:
    Mar 23, 2023
    Messages:
    17
    Likes Received:
    4
    Yeah, i'm running some tests and in F1 2010 and F1 2012 (You can download both on Steam Workshop) the AI change tire compound during pits. I'm trying to find any file or parameter that is different but so far no luck
     
  19. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,025
    Likes Received:
    2,883
    Please give me the direct Steam Workshop Links for both Mods, there at least are 2 F1 2010 Mods.
     
  20. Nicola59

    Nicola59 Registered

    Joined:
    Dec 5, 2014
    Messages:
    157
    Likes Received:
    178
    Hello, Matheus
    Hi, Chris ( Happy new Year also to You...:) )
    Well...I agree with Chris "redapg": RF2 actually is "not perfect" for this feature ( that is the tyre changing in pit stops " following a logical strategy" ).
    I tested on my F1 2023 mod a whole session of event, in Monza ( full laps ), with half number of drivers ( 10 ), to better follow all of them.
    In Free session, AI drivers indeed used randomly all tyre componds ( I saw that most were using the compond - soft red - imposed in TBC, but also in few (2 ) cases jellow-Medium, and white - hard ).
    So, we can say that for free sessions, RF2 made a progress.
    In Qualify, again, the most drivers used red-soft compound, and only 2 used white ( ????...).
    Obviously, in race, only they used white tyre compound.....and here is the limit of RFactor2: infact, while these 2 drivers made a pitstop in race, loading the soft-red, all other drivers starting with red-soft compound made a pitstop in which for a moment You can see that RF2 is attempting to give them white-hard compound ( I never saw medium....however ), but immediately they start again with red-soft.....and they go on with red, until the end of the race with this compound, although they make then another pitstop.

    The conclusion is that AI, when loading in a race hard ( or medium ) tyre compound, may load in pitstop the soft compound.
    But the opposite is not possible ( at least...in my experience...)
    So: I think there are still limits for Rf2 in offering a realistic pitstop tyre strategy.
     
    buzz hornet likes this.

Share This Page