Information for Customizing AI drivers in AMS2

Discussion in 'Automobilista 2 - General Discussion' started by gian, Nov 19, 2021.

  1. chonk

    chonk Well-Known Member AMS2 Club Member

    Joined:
    Jul 3, 2021
    Messages:
    502
    Likes Received:
    265
    Glad you tracked down the issue, at first glance I thought that character might be a problem, I didn't realize it was from one of the stock skins though.

    As for the custom championship it is possible to create one and not have a duplicate livery. You just need to make sure that the livery you choose is not already designated to one of the drivers listed in the custom AI file.

    For example the DPi class has 15 liveries available. If you create a custom AI file and assign 8 of those liveries to AI drivers to avoid having a dupe you need to choose your car from one of the 7 remaining liveries. This way there will be no duplication. Obviously in certain classes this will be hard to avoid because there are a limited number of skins available, but it is possible all the same.
     
    Last edited: Dec 12, 2021
    • Informative Informative x 1
    • Friendly Friendly x 1
  2. gian

    gian Administrator Staff Member AMS2 Club Member

    Joined:
    Mar 16, 2020
    Messages:
    91
    Likes Received:
    123
    Fixed bugs with wrong nationality of custom AI drivers for next version 1.3.0.2 and above.
     
    • Informative Informative x 5
    • Like Like x 4
    • Winner Winner x 2
  3. deadly

    deadly Well-Known Member

    Joined:
    Jul 8, 2016
    Messages:
    1,513
    Likes Received:
    532
    Just for fun, here is my Custom AI file for the F1 1991 mod for Formula Classic Gen3.
    You can get the liveries here:
    [F-Classic Gen3] F1 1991 Season

    As I once changed the names of some teams a little bit and can not remember exactly, I included the xml-files for the vehicles folders (does of course not affect the liveries), too. You need those files in order to have the custom file working.

    As some cars now are very slow in order to portray the performance differences of that year, you might increase the opponent's strength.

    Edit: Altered the Custom AI file once more, so that the Model 2 cars are less dominating. To have aggression values take effect, aggression sliders should be set to 50% ingame, as far as I understood.
     

    Attached Files:

    Last edited: Dec 7, 2021
    • Like Like x 1
    • Friendly Friendly x 1
  4. GregzVR

    GregzVR P1 passion, P10 talent.

    Joined:
    Mar 12, 2020
    Messages:
    695
    Likes Received:
    480
    Thanks for this. By default, the Benetton B191 car is far too slow vs the Williams and Ferrari V12 models, that it’s hard to use it in a race(as Schumacher or Piquet). Hopefully with these I can race competitively now.
     
  5. deadly

    deadly Well-Known Member

    Joined:
    Jul 8, 2016
    Messages:
    1,513
    Likes Received:
    532
    Problem is that the Benettons have the slowest model and the McLarens just the second best. So, although I gave Senna the highest values by far, he has to fight hard against the Williams cars.
    But I did not alter the aggression values, so that there is a little bit uncertainty during races. If you add a line like "<aggression>1.0</aggression>" for the cars you want to be faster, they might try to force their way through (but unfortunately, AI's overtaking is poor in game).
     
    Last edited: Dec 7, 2021
  6. Simon Aguirre

    Simon Aguirre New Member AMS2 Club Member

    Joined:
    May 31, 2016
    Messages:
    1
    Likes Received:
    3
    I have made a small tool to edit IA drivers; nothing fancy, just to fill the gap until something better comes along. Make a backup of any custom AI files you have already made before trying this tool, i did some testing but it still is mostly unproven code.
    The installation is as follows:
    1) download the attached file AMS2-AI-Editor.txt
    2) copy the file to AMS2 root folder (where ams2.exe is located)
    3) change the extension from 'txt' to 'hta'

    There are lots of cars in the game, so i decided not to include them inside the editor; it will work with the already present files instead. To start editing a vehicle class you need to place the xml file in (with the proper name) in the UserData\CustomAIDrivers\ folder and fill it with the livery names. Using the M1-Procar (Procar.xml) as an example, it would be something like this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <custom_ai_drivers>
    <driver livery_name="BMW Motorsport #01" />
    <driver livery_name="BMW Motorsport #06" />
    <driver livery_name="Tres Kings/Goodspeed #02" />
    <driver livery_name="Tres Kings/Goodspeed #03" />
    <driver livery_name="Cassino Racing #07" />
    <driver livery_name="Cassino Racing #08" />
    <driver livery_name="Weißbier/Petrocelli Racing #17" />
    <driver livery_name="Weißbier/Petrocelli Racing #18" />
    <driver livery_name="M-Sport Veloce #19" />
    <driver livery_name="M-Sport Veloce #20" />
    <driver livery_name="DTSA Procar Motorsport #22" />
    <driver livery_name="DTSA Procar Motorsport #23" />
    <driver livery_name="Artenova Roxmil Racing #24" />
    <driver livery_name="Artenova Roxmil Racing #25" />
    <driver livery_name="Maxwell Team #27" />
    <driver livery_name="Maxwell Team #28" />
    <driver livery_name="Deutsche Bier Team #35" />
    <driver livery_name="Deutsche Bier Team #36" />
    <driver livery_name="Green Spartan #37" />
    <driver livery_name="Green Spartan #38" />
    <driver livery_name="Gelbbuchtelekom #42" />
    <driver livery_name="Gelbbuchtelekom #43" />
    <driver livery_name="Gold Seal Racing #81" />
    <driver livery_name="Gold Seal Racing #82" />
    <driver livery_name="Apex Motorsports #86" />
    <driver livery_name="Apex Motorsports #87" />
    </custom_ai_drivers>
    When execute the editor you will see this screen:
    AMS2-AI-Editor.png

    All the values that are left empty (or 'Default' for country) won't be save in the xml so AMS will use the original values instead. All the personality values must be between 0.0 and 1.0 (inclusive). The tool makes no validations; so if you write 2.5 (invalid value), that is what will be saved.
    The 'Save' button will write all the xml files (even the ones that weren't modified). Before that, any changes you make will be seen inside the editor only.
    All the parsing and serializing is done by xml libraries, if you edit a hand-made file you will lose any additional edits (comment, whitespaces, line breaks, etc).

    I hope you find this usefull.
     

    Attached Files:

    • Like Like x 3
    • Useful Useful x 2
  7. MrX

    MrX Active Member

    Joined:
    Jun 8, 2021
    Messages:
    113
    Likes Received:
    191
    does anyone know which classes the Porsche RSR 74 belongs to I want to try something with ai files
     
    • Creative Creative x 1
  8. MrX

    MrX Active Member

    Joined:
    Jun 8, 2021
    Messages:
    113
    Likes Received:
    191
    I don't see GT classics in the list??
     
  9. CrimsonEminence

    CrimsonEminence Administrator Staff Member AMS2 Club Member

    Joined:
    Nov 4, 2018
    Messages:
    9,824
    Likes Received:
    9,985
    Try looking for TC70s
     
  10. MrX

    MrX Active Member

    Joined:
    Jun 8, 2021
    Messages:
    113
    Likes Received:
    191
    Oke thx I try it
     
  11. R00bDriver

    R00bDriver Member

    Joined:
    Jun 26, 2021
    Messages:
    59
    Likes Received:
    36
    Hey there,

    I was mucking about with my own spreadsheet and added a column that works out the approximate** AI Skill level for each AI driver.

    ** approximate as I believe there are other factors at play, e.g. aggression, defending, consistency, car type, weather etc

    The formula is as follows:

    =(race_skill - 0.0) * ( (SKILL_HIGH - SKILL_LOW) / (1.0 - 0.0) ) + SKILL_LOW

    Where
    SKILL_HIGH = Game AI Skill setting (+5)
    SKILL_LOW = Game AI Skill setting (-5)
    race_skill = AI driver race skill cell (Cell D2 for the first driver in your spreadsheet)

    1.0 = equates to SKILL_HIGH
    0.0 = equates to SKILL_LOW​

    I added it into my Excel spreadsheet and then get Excel to export the XML.
    But, as not everyone has Excel it might be better going into your doc?

    Just a thought ;)

    Anyway, take it easy and happy racing!

    :)
     
    • Informative Informative x 2
    • Like Like x 1
  12. stealthradek

    stealthradek Smoothie operator AMS2 Club Member

    Joined:
    Nov 22, 2020
    Messages:
    770
    Likes Received:
    662
    Thanks for contributing and I'm happy to add it, but I cannot see the benefits of it. My understanding is that AI level is set globally for session in game and race_skill then determines where on the AI skill axis the driver is:

    With that in mind I have a feeling that if you have your custom AI XML data with the field configured to have the race_skill performance varied, it'll mean the gaps would be roughly the same but with different (slower/faster) lap times which are determined by global AI Skill Level slider setting.

    So similar logic to Aggression:

    Please correct me if I'm wrong as I want to get it right :)
     
    • Like Like x 1
  13. R00bDriver

    R00bDriver Member

    Joined:
    Jun 26, 2021
    Messages:
    59
    Likes Received:
    36
    You're understanding might be better than mine then :)

    My understanding is, (and I'm happy to be corrected!), is the Main Game AI Skill level, e.g. 100, would be then be set to a range of (+/-)5 to give a range of 95...105. The 'race_skill' value in the AI XML file of 0.0...1.0 would then scale 0.0 (95), to 1.0 (105), with 0.5 being 100 - the same value in the main game AI Skill setting.

    So the little formula was giving an approximation of what in game Skill level each driver would have based on the 'race_skill' value entered.

    I only did this as I downloaded some custom AI driver files and the values in the 'race_skill' ranged from 0.80 to 0.95, which when you work it out doesn't equate to much difference in skill (0.8 = 103 and 0.95 = 104.5), and when racing I found a big long line of cars all going round with barely any gaps in between (some may like this - some don't - whatever floats your boat!).

    Like I say, if this is wrong, then I'm happy to be corrected! :)

    I'm off to see a bunch of friends for a Christmas dinner and maybe a drink or three, so may not respond for a while ;)

    Have a great day :D
     
    • Friendly Friendly x 1
  14. br1x92

    br1x92 Active Member

    Joined:
    Aug 1, 2021
    Messages:
    327
    Likes Received:
    146
    Funny because when I tested my file for GT1 I found that changing from say 75 to 76 qualifying strength it equaled changing the whole AI up by 1 point, while it should only be a tenth of that.
    So now my AI ranges are in about 15 points of eachother which gives about 1.5 second laptime difference in qualifying (depending on the track of course) which should be faaaaaar less if the system is was working as described in the first post. So something is definetly off there.
     
  15. eSTee3

    eSTee3 Active Member AMS2 Club Member

    Joined:
    Mar 17, 2020
    Messages:
    124
    Likes Received:
    69
    With some great partnership from @Harry H I've greatly improved on the google sheet template I originally posted (earlier in this thread). You can now sort to your heart's content AND you don't have to fill out each group of cars in a consecutive manner.

    I've added a "Create XML Here" tab where you go (after filling out the "Populate AI Here" tab) to quickly concatenate all your filled in AI (and their settings), in one copy/paste-able chunk of text.

    TEMPLATE - AMS2 AI Creation Tool (make copy to use)
     
    • Like Like x 5
    • Winner Winner x 2
  16. Harry H

    Harry H Active Member AMS2 Club Member

    Joined:
    Mar 25, 2020
    Messages:
    233
    Likes Received:
    194
    Perhaps the Qualify value is only used to simulate lap times, as in the case where the players skips qualifying? So if you are running a full qualifying session then it’s the race skill values that determine the results. That’s a guess. I certainly remember that was the case with either AMS1, RF2 or both!
     
  17. krissangel

    krissangel Member AMS2 Club Member

    Joined:
    Mar 8, 2016
    Messages:
    47
    Likes Received:
    6
    Hi, does anybody succeed to make a custom AI file for the "Formula Retro Gen 1 - F1 1975 historic pack" from ianez ? Personnaly i did not and don't know why.
     
  18. Pieter Nienhuis

    Pieter Nienhuis Active Member AMS2 Club Member

    Joined:
    Mar 11, 2016
    Messages:
    209
    Likes Received:
    44
    Thanks for a great tool man !

    Small error in a Livery name for the 2021 Stockcars "RKL Competicoes - G.Frigotto #86" should be
    "RKL Competições - G.Frigotto #86" otherwise the name of the driver won't be shown. Save and rename the text file to StockCarV8_2021.xml in Userdata

    Now if only we could read Livery-names from custom xml's.
     

    Attached Files:

    Last edited: Dec 11, 2021
    • Like Like x 1
    • Agree Agree x 1
  19. Marg

    Marg Active Member

    Joined:
    Dec 7, 2021
    Messages:
    123
    Likes Received:
    49
    I made AI.xml file for that 1975 pack. I noticed some drivers are missing there, like Chris Amon. His "Ensign" had quite typical shape for that era.
     
  20. Pieter Nienhuis

    Pieter Nienhuis Active Member AMS2 Club Member

    Joined:
    Mar 11, 2016
    Messages:
    209
    Likes Received:
    44
    Just noticed that Italian and Mexican flags for drivers are rotated 90 degrees on the Monitor-screen.
     
    • Agree Agree x 1

Share This Page