Real AI Driver names (RAD): A Helper Tool to Generate Random Grids

Real AI Driver names (RAD): A Helper Tool to Generate Random Grids v1.2

Login or Register an account to download this content

Real AI Driver names (RAD)

This is a python script to help you generate random grids with real driver names based on existing .cmpresets grids that you have created.

Pre-requisites:
CM and python 3 are required
NOTE: python regex module required - run the "pip install regex" command if necessary​


How to run?
1 - Download and extract the .zip file in the folder where your race grid files are stored. For example: "C:\Users\YOURUSERNAME\AppData\Local\AcTools Content Manager\Presets\Race Grids"

Swap the YOURUSERNAME for yours. The easiest way to get this is to press on the "Save Preset" button when customizing your grid in CM:
Save Preset.png

Then an Explorer window will pop up - click on the path on top and you can copy the directory path. You can paste that to a text file in Notepad for quick reference.

Get Directory Path.png


2 - Open Command Prompt and run:
cd "C:\Users\YOURUSERNAME\AppData\Local\AcTools Content Manager\Presets\Race Grids"

Make sure to encapsulate the directory path with the quotes!

3 - Run:
python real-ai-driver-names.py <name-of-preset>.cmpreset
Command 2.png


There are three additional modes:
1686909614374.png


The additional modes help you to set an estimated AI Strength level, and you can further sort the grid, whether descending or ascending. AI Strength level is based on where the driver is listed in the drivers-list.txt file. Drivers in the first 25% of the list are considered the strongest, and so on.

(without any switches) - the script will randomly assign drivers WITHOUT any AI Strength level set (i.e. left to Auto) - it will use the overall AI Strength settings as shown in CM
-r - the script will set an estimated AI Strength level for each driver without sorting the grid
-s - AI drivers will be sorted from highest to lowest AI Strength level on the grid
-sr - AI drivers will be sorted from lowest to highest AI Strength level on the grid

You can use the switches alongside the filename as follows:
Command 3.png


Want more options / use your own list?
There are currently 4 more switches to help you form your grid.

-d <1, 2, 4 or 5> - you can specify how many divisions of AI levels should be performed
-i <custom list> - you can specify a custom list to use instead of the default drivers-list.txt. It must follow the same Driver Name,Nationality format.
-l <ai strength level> - you can specify and override the AI level instead of referencing the .cmpreset file
-o <no of opponents> - you can specify and override how many AIs to generate for the grid

4 - Load the newly generated preset in CM, and your grid is ready!



Ideal grid .cmpreset:
  • No individual opponent strength or aggression was set in the grid e.g. its listed as Auto for both columns.
  • Overall AI Strength level is set on the main CM Race screen.
  • Skins are all set to Random.
  • Your starting position is set to Random.
  • The number of opponents is set.


  1. The python script loads a drivers-list.txt, currently filled with 200 real driver names and their nationalities, from FIA Formula drivers, to IndyCar, to WEC / IMSA / DTM / TCR series. If you want someone to go to the top, just copy + paste their name up the list. Wanna add more drivers? Go ahead! Wanna use your own list? Just follow the same format of Driver Name,Nationality - just keep in mind that AI levels are set according to which division they belong to in drivers-list.txt (or your custom list). Further explanation in point no. 4.
  2. It then parses the list of cars from the .cmpreset file, plus their associated ballasts and restrictors. It will retain any ballasts or restrictors you have set for EACH UNIQUE car, based on the car's directory name. If you have the same car with different ballast and restrictor values, only the first occurrence will be recorded.
  3. It then starts lining up the grid randomly based on the drivers in the drivers-list.txt, as well as assigns a car randomly based on the cars listed in the .cmpreset settings.
  4. It checks for the .cmpreset AiLevel and uses it as the maximum benchmark. Strongest drivers are the first division in the list of drivers, followed by the next division etc. Each subsequent division after the first is a decrement of 2 in terms of AI skill level. e.g. if my cmpreset file has AiLevel set to 96, top drivers will be set to 96, followed by 94, so on and so forth. It does not use the range value i.e. AiLevelMin and AiLevelMax.
  5. Sorts the grid according to AI level if the mode switches are used.
  6. Saves the new grid to a newly generated .cmpreset file. The new filename is the original filename appended with date-time.


Are there bugs left unsquashed?

Yep, unfortunately. I've seen some out of bounds index issues but normally I can just re-run the same command and it will work. I've not determined what's causing it. So in case a generation fails, just try to re-run the same command. Otherwise, do let me know of any errors you encountered!

Are there updates planned?
Yes, for sure. Do feel free to request some additions to the script. :) I'm not gonna debate the arrangement of the list - I'm sure there's some super funky rankings in there cause I'm not knowledgeable enough lmao - but I'll likely update it with more drivers and adjust as necessary.

Some features I may implement:
  1. Ability to specify the AI level decrement per slice instead of the default 2
  2. Ability to set how many drivers you want from each slice i.e. I want a ratio of 10:6:2:2, meaning 10 strongest drivers, followed by 4 in the second quarter, so on and so forth.
  3. Retain the existing driver lineup and just re-assign cars, randomly reorder the grid, etc.
  4. Ability to 'group' drivers up into the 'same team' by setting the same SkinId
  5. Ability to retain multiple SkinIds for the same car to limit the grid skins
This is my first ever public python script; its also pretty simple to be honest. So let me know your thoughts! I hope it helps enriches your AC experiences further. :)

Race on,
mk
  • 1686760308091.png
    1686760308091.png
    22.1 KB · Views: 74
  • Command 4.png
    Command 4.png
    17.3 KB · Views: 332
  • 1686803729502.png
    1686803729502.png
    28.3 KB · Views: 332

Latest updates

  1. v1.2 Released!

    v1.2 - Update Log New Features: More divisor values for splitting AI levels for Realistic Mode...
  2. v1.1 released!

    v1.1 - Update Log New Features: Custom Drivers List New switch "-i": Users can now load their...
  3. v1.0-hotfix1 released!

    Woops, just uncovered some tool-breaking bugs by missing out some checks. Please use this...

Latest News

Author
mk-sg
Downloads
64
File size
5.7 KB
Views
2,278
First release
Last update
User rating
0.00 star(s) 0 ratings

What's needed for simracing in 2024?

  • More games, period

  • Better graphics/visuals

  • Advanced physics and handling

  • More cars and tracks

  • AI improvements

  • AI engineering

  • Cross-platform play

  • New game Modes

  • Other, post your idea


Results are only viewable after voting.
Back
Top