Information for Customizing AI drivers in AMS2

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

  1. Luciano Santos Filho

    Luciano Santos Filho Active Member

    Joined:
    Sep 7, 2017
    Messages:
    148
    Likes Received:
    44
    I'd say it's likely that one or more of these 31 selected liveries have some misspelling and that brakes the funcionationality. Could you share your file?
     
  2. sampopel

    sampopel Active Member AMS2 Club Member

    Joined:
    Mar 31, 2020
    Messages:
    339
    Likes Received:
    150
    Sure - attached. It contains the 35 drivers.

    When reducing to 31, I'm deleting the final 4 in the xml file and this is when the game decides to start using mostly default AI drivers.
     

    Attached Files:

    • GT4.xml
      File size:
      17.6 KB
      Views:
      245
  3. chonk

    chonk Well-Known Member AMS2 Club Member

    Joined:
    Jul 3, 2021
    Messages:
    502
    Likes Received:
    265
    haha it really feels ever so slightly overly complicated doesn't it!

    But it will work if everything is correct the first thing to make sure of as @Luciano Santos Filho suggested above is that you have no spelling mistakes or syntax errors in the file, once absolutely sure of that try commenting out/temporarily removing any drivers or livery's that have non standard spellings although this shouldn't be an issue with the right character set chosen for the file, but it's good to check.

    edit: correcting misinformation.
     
    Last edited: Dec 26, 2021
  4. Romeo Foxtrot

    Romeo Foxtrot Active Member AMS2 Club Member

    Joined:
    Apr 10, 2020
    Messages:
    166
    Likes Received:
    69
    The file works OK but if you reduce the field remove one of the 005 McLarens or one of the 011 BMWs.
     
    • Like Like x 1
  5. sampopel

    sampopel Active Member AMS2 Club Member

    Joined:
    Mar 31, 2020
    Messages:
    339
    Likes Received:
    150
    That was it! A couple of duplicates. Thank you!
     
  6. sampopel

    sampopel Active Member AMS2 Club Member

    Joined:
    Mar 31, 2020
    Messages:
    339
    Likes Received:
    150
    I don't think that bit is correct. With the exception of the GT4 problem I was having (now resolved as RomeoF had noticed that I assigned duplicate skins :rolleyes:), to race against 31 custom AI drivers, I'm just setting up XML files with 31 AI drivers, not 32.

    But I agree, it's currently a bit too complicated, particularly when you have to manually type out the livery names whilst reading them one by one with the game open, and a single character error in any of them breaks it.
     
  7. chonk

    chonk Well-Known Member AMS2 Club Member

    Joined:
    Jul 3, 2021
    Messages:
    502
    Likes Received:
    265
    haha you are right, that's so weird, I managed to have exactly livery related spelling mistake in like 5 different files, all different classes too. :whistle::D

    In future, just ignore me. maybe just ignore me now for your own sakes.
     
  8. Luciano Santos Filho

    Luciano Santos Filho Active Member

    Joined:
    Sep 7, 2017
    Messages:
    148
    Likes Received:
    44
    I wish we could have a file (or files) with all the liveries sorted by class.

    BTW, does someone knows the XLM file name for the BMW 2002? And the Classic GT (Porsche & Corvette)?
     
  9. stlutz

    stlutz Active Member

    Joined:
    Feb 10, 2021
    Messages:
    194
    Likes Received:
    93
    This weekend I started a manual 1991 F1 championship (with the F-Classic Gen 3 cars). I'm using 50 for the overall aggression value. After my first couple of races (30 minutes each), I have to disagree with the view that parameters outside of skill/qualifying don't do anything.

    I setup my AI file by basing the skill off of the actual points from that year, applied a random adjustment for the qualifying value, and then set all of the other values completely randomly. The result isn't necessarily true-to-real-life, but it's been interesting.

    Senna of course has the highest skill, but he ended up ranking 5th in qualifying ability, which is about where he has been starting. He has moderate aggression, low stamina, and low defending values (again, I just randomly filled these). All of those low numbers have meant that he ends up making few passes, and even gets knocked around a bit, despite having the highest skill.

    Haikkenen and Schumacher have the highest defending numbers and they are indeed very difficult to get by--both other AI (particularly Ayrton) and I have gotten bottled up behind them.

    Prost has very high stamina and consistency numbers, and he has passed a lot of cars in the races I've done thus far.

    None of that is to say that the AI are working perfectly at this point. When I watch replays, I do notice the same thing that others have--the car with the preferred inside line tends to back out of it too often. In fact, they seem to have an easier time going by on the outside.

    Bottom line--I can see that that all of the values in the AI file matter, and that possibly some minor tweaks to the overall AI logic when it comes to passing will make a big difference.
     
    • Informative Informative x 2
    • Like Like x 1
    • Agree Agree x 1
  10. sampopel

    sampopel Active Member AMS2 Club Member

    Joined:
    Mar 31, 2020
    Messages:
    339
    Likes Received:
    150
    eSTee3 has already created this in his spreadsheet - see this post. Note, I copied the info from his first version and there were quite a lot of spelling mistakes in the livery names which need to be corrected for it to work in the .xml files - he may have sorted some of them in his more recent update. I've also started to reorder them in my list to match the order of the cars in the livery selection screens in-game but I've only done about 4 classes so far.

    I think you want the TC60S (BMW2002 & Chevy Corvette) and TC70S (Porsche 911 RSR & Corvette) xml files.
     
    • Like Like x 1
    • Informative Informative x 1
  11. Sergio Rizato

    Sergio Rizato New Member

    Joined:
    Jul 16, 2020
    Messages:
    11
    Likes Received:
    24

    The AI drivers name's only works in OFF LINE RACES??
     
  12. Sergio Rizato

    Sergio Rizato New Member

    Joined:
    Jul 16, 2020
    Messages:
    11
    Likes Received:
    24
    The AI drivers names modified works only on off-line races? Because I can't see them in on-line lobbys filled with AIs
     
  13. deadly

    deadly Well-Known Member

    Joined:
    Jul 8, 2016
    Messages:
    1,519
    Likes Received:
    532
    As people can have different custom AI files for a class of cars, it is only there for offline racing.
     
  14. justposted

    justposted Member AMS2 Club Member

    Joined:
    Nov 10, 2021
    Messages:
    36
    Likes Received:
    19
    I exported @eSTee3 's spreadsheet (Information for Customizing AI drivers in AMS2 V1.3) to Excel, as I'm not a Google person when I can help it.

    Then I wrote a script/module/macro that generates all of the XML files in one go. That way I can make wholesale changes and regenerate everything fresh each time. Takes about 1 second to generate them all.

    Running other peoples' macro-enabled spreadsheets is always a bit dicey, so I'll just paste it here. If you think it is useful, then all you need to do is change the filepath and paste it into a new module in Excel's Visual Basic environment. It only works with eSTee3's spreadsheet, though could easily be adapted to any other variations out there.

    Code:
    Sub ExportAll()
    
    Dim userPath, carxml, currentFile, driverVariable(1 To 13) As String
    Dim rowNum, colNum, carNumber, d, C(1 To 13), driverNumber, rowStart As Integer
    
    '********************
    'UPDATE THIS TO MATCH YOUR PATH
    userPath = "J:\SteamLibraryJ\steamapps\common\Automobilista 2\UserData\CustomAIDrivers\"
    '********************
    
    driverVariable(1) = "name>"
    driverVariable(2) = "country>"
    driverVariable(3) = "race_skill>"
    driverVariable(4) = "qualifying_skill>"
    driverVariable(5) = "aggression>"
    driverVariable(6) = "defending>"
    driverVariable(7) = "stamina>"
    driverVariable(8) = "consistency>"
    driverVariable(9) = "start_reactions>"
    driverVariable(10) = "wet_skill>"
    driverVariable(11) = "tyre_management>"
    driverVariable(12) = "blue_flag_conceding>"
    driverVariable(13) = "weather_tyre_changes>"
    
    C(1) = 5
    C(2) = 6
    C(3) = 8
    C(4) = 9
    C(5) = 10
    C(6) = 11
    C(7) = 12
    C(8) = 13
    C(9) = 14
    C(10) = 15
    C(11) = 16
    C(12) = 17
    C(13) = 18
    
    
    carNumber = 0
    'rowStart is the row number for the first driver in the spreadsheet
    rowStart = 3
    'rowLook is the row currently being used to extract variables, such as driver name
    rowLook = 3
    
    For allCars = 0 To 50
    
        carxml = Cells(rowLook, 2)
    'as soon as a blank cell is found in column B, the code stops
        If carxml = "" Then Exit Sub
        currentFile = userPath & carxml
      
        Open currentFile For Output As #1
      
        Print #1, "<?xml version=""1.0"" encoding=""UTF-8""?>"
        Print #1, "<custom_ai_drivers>"
          
        For driverNumber = 0 To 50
            rowLook = rowStart + driverNumber
            If Cells(rowLook, 2) = carxml Then
                Print #1, "    <driver livery_name=""" & Cells(rowLook, 4) & """>"
                For d = 1 To 13
                    Print #1, "        <" & driverVariable(d) & Cells(rowLook, C(d)).Value & "</" & driverVariable(d)
                Next d
            Else
                Exit For
            End If
            Print #1, "    </driver>"
        Next driverNumber
      
        Print #1, "</custom_ai_drivers>"
        Close #1
        'make rowStart move to the start of the next car list
        rowStart = rowLook
    
    Next allCars
    
    MsgBox "Saved"
    
    End Sub
    
     
  15. Luciano Santos Filho

    Luciano Santos Filho Active Member

    Joined:
    Sep 7, 2017
    Messages:
    148
    Likes Received:
    44
    Does someone knows how can I reference the Metalmoro AJR Chevy called "AJR-Tubarão #5"?
    It has a special character, I tried to guarantee it seems correct in the file, but no luck so far.

    Thanks in advance.
     

    Attached Files:

  16. Romeo Foxtrot

    Romeo Foxtrot Active Member AMS2 Club Member

    Joined:
    Apr 10, 2020
    Messages:
    166
    Likes Received:
    69
    AJR-Tubarão #5 has a space after it. Surprised you didn't spot that! It only took me 317 tries. ;)
     
    • Funny Funny x 4
    • Optimistic Optimistic x 1
  17. Luciano Santos Filho

    Luciano Santos Filho Active Member

    Joined:
    Sep 7, 2017
    Messages:
    148
    Likes Received:
    44
    Worked, thanks!
     
  18. Harry H

    Harry H Active Member AMS2 Club Member

    Joined:
    Mar 25, 2020
    Messages:
    237
    Likes Received:
    197
    Check for typos in your AI liveries?
     
  19. Harry H

    Harry H Active Member AMS2 Club Member

    Joined:
    Mar 25, 2020
    Messages:
    237
    Likes Received:
    197
  20. Harry H

    Harry H Active Member AMS2 Club Member

    Joined:
    Mar 25, 2020
    Messages:
    237
    Likes Received:
    197
    How the heck did you figure that out? Good work! :)
     

Share This Page