New simple AI experiment

Shovas

Premium
[This is now a mod with further improvements over here: https://www.racedepartment.com/downloads/sho-competition-ai.30447/]

As I always say, it really bothers me you can win from last place in GTR2. In real life, you usually finish +/- a handful of spots where you qualified.

The simple part of this are my goals and the params to change to accomplish it:

- Primary: Improve AI early braking and slow cornering speeds
- Secondary: Qualifying should represent racing ability +/- a few spots like real life. Ie. Your qualifying position usually indicates your final position in the race +/- a few spots.

I decided to try a new tack with AI by starting from all defaults, a clean, vanilla installation, and just modifying the three UserData PLR AI params related to AI performance. Here are the values I've landed on after a bit of bisection search testing:

AI Brake Power Usage="0.99500" // Default: 0.98000 Fraction of theoretical brake power that AI attempt to use
AI Brake Grip Usage="0.99250" // Default: 0.97000 Fraction of theoretical brake grip that AI attempt to use
AI Corner Grip Usage="0.96500" // Default: 0.93000


The Brake params help alleviate early braking into corners so that you don't end up running into the back of AI too much.

The Corner param helps alleviate slow cornering.

With these changes, if I've qualified realistically, I tend to have very good, hard racing, not passing too many cars unrealistically.

I arrived at these by (so far minimal) bisection searching between the default value and the "perfect" 1.0 value:

1637359293475.png


Additionally, these should not affect AI performance but should improve some AI related things:

AI Max Load="30000.00000" // Default: 40000 Maximum total load to set up theoretical performance tables
AI to AI Collision Rate="40" // Default: 20 Detection rate per second (1-40) for AI-to-AI collisions

Max Load seems to affect how cars respond when they contact (lower it enough and when you hit somebody they might send you flying like a ping pong ball).

EDIT: I was wrong, this doesn't seem to be what this does. Car HDC "AI Torque Stab" might fit this description

Collision Rate helps improve AI situational awareness and I think but not sure can help with first corner / first lap congestion.

EDIT: As of 1/6/22 I recommend default AI to AI Collision Rate=20 as after some testing 40 didn't seem to improve things much at all and I thought I noticed some odd behaviour that wasn't happening at the default. So to be safe I just leave it at the default now to avoid too many variables changing.

So far I've tested these:

- GT: Ferrari 575 at Valencia GP 2004
- NGT: Porsche GT3 RSR at Oschersleben GP 2004
- G3: BMW Z3 at Imola GP 2004

General Tips:
- Run all sessions with default setups to avoid 'gaming' the system with for example better tires or less fuel weight than AI (I'm not exactly sure what GTR2 is doing for session specific setups, though).
- Always start new class/car/track combos at 100% and tune from there

Qualifying Tips:
- Save time finding right AI level: If you're too fast or too slow (ie. not the position you want to be) then note your time and run qualifying again with a different AI level using time acceleration. Compare your time against the AI and see if your time would lie where you like to qualify. Change the AI level if you're unsatisfied and repeat. You don't have to actually put in qualifying laps until you see you're at the right AI level.
- AI Levels (Not Exact, Probably wonky):
- 80-90: 0.5sec increments
- 90-100: 0.25sec increments
- 100-110: 0.2sec increments
- 110-120: 0.10sec increments

Racing Tips:
- Take it easy first race lap, don't pass or don't pass too many anyway, the AI can't really race properly until they're spread out which usually happens by the end of lap 1
- I find it necessary not to pass at all the first lap, just maintain the position, to avoid 'gaming' the race and moving up too quickly (doing so will ruin your fun and immersion)
- Don't take chances with the AI you wouldn't take with a human. This will enhance your experience, improve immersion, and stop you 'gaming' the race by abusing AI behaviour
 
Last edited:
- Run all sessions with default setups to avoid 'gaming' the system with for example better tires or less fuel weight than AI (I'm not exactly sure what GTR2 is doing for session specific setups, though).
This is the default practice I always follow when playing offline, for exactly the reason you mention! It can be a little immersion-breaking though, especially regarding basic things like appropriate gear ratios and having more or less aero (e.g. at Le Mans).

I'm almost certain you can add default setups car-by-car and track-by-track for AI in rFactor, and I would think you can do this in GTR2 as well. Perhaps this would be a worthy addition to your AI mod – a basic default setup for each car-track combo in default GTR2 content that has reasonable gearing and aero for the AI and player to add to the immersion? Simple things like gear ratios and aero for top speed or cornering shouldn't (I don't think) screw up what you've discovered about parameters through bi-section searches... (right?)

EDIT: this is something I bet you could easily get other people to figure out on their own and share with you as well.

EDIT #2: You mention session specific setups. I recall reading a AMS1 changelog mentioning implementing different setups for quali and the race, but I think it's something Reiza had to add to the existing engine. Unsure if it's something SimBin had added too... but I doubt it somehow.

EDIT #3 (lol): Forgot to say thanks for all the amazing work on this!! And for sharing the 'best practices' with us so we can have a good experience with minimal effort. Cheers man.
 
Last edited:
This is the default practice I always follow when playing offline, for exactly the reason you mention! It can be a little immersion-breaking though, especially regarding basic things like appropriate gear ratios and having more or less aero (e.g. at Le Mans).

I guess one way to look at it, and to get around that limitation, is to consider it all as simply "performance". For example, say on a default setup you qualified 10th but with a custom setup you qualified 5th. I guess it's all relative so you'd just be competing with the higher positions.

Same with a race session and tires, etc., if those ahead of you are still putting in better laptimes than it should still be a good race.

The thing that we want to avoid is just having an outright advantage over ALL of the AI. You want to at least have some AI to have real battles against. As long as your setup only gives you an advantage over SOME than does it really matter that you have a custom setup and they don't?

I suppose I want to keep that guidance in the mod for the purpose of reducing complexities and having too many variables to deal with while I develop the mod but actually in the future it may be moot if you just consider everything "performance".

I'm almost certain you can add default setups car-by-car and track-by-track for AI in rFactor, and I would think you can do this in GTR2 as well. Perhaps this would be a worthy addition to your AI mod – a basic default setup for each car-track combo in default GTR2 content that has reasonable gearing and aero for the AI and player to add to the immersion? Simple things like gear ratios and aero for top speed or cornering shouldn't (I don't think) screw up what you've discovered about parameters through bi-section searches... (right?)

This is apparently possible with "Vehicle Specific AI Setups" (see below).

But there are a lot of car/track combos. Customizing and testing each would be a mammoth undertaking.

EDIT: this is something I bet you could easily get other people to figure out on their own and share with you as well.

Good point. I think for now I want to keep working on the most basic universal parameters that affect everything at once to get the most benefit out of the least work (80/20 rule and all that). Once I run out of those options is when I consider getting into Talent, Track, and Car files.

EDIT #2: You mention session specific setups. I recall reading a AMS1 changelog mentioning implementing different setups for quali and the race, but I think it's something Reiza had to add to the existing engine. Unsure if it's something SimBin had added too... but I doubt it somehow.

I worded that poorly. There is this setting:

Vehicle Specific AI Setups="1" // If 1, search specific vehicle directory for "<track>.<qual/race>.svm" or "<track>.svm" or "ai.svm" before falling back on game.gdb defaults

What I really meant was I'm not sure what happens in a race session when you use soft tires for a sprint: Do the AI use soft tires too or are they still using mediums (I assume...) ? Like, do they respond in any way to your setup changes? I don't know.

EDIT #3 (lol): Forgot to say thanks for all the amazing work on this!! And for sharing the 'best practices' with us so we can have a good experience with minimal effort. Cheers man.

No problem, I enjoy doing it, and I hope it helps rejuvenate GTR2 for everyone for years to come!

PS. All of this is now a mod over here: https://www.racedepartment.com/downloads/sho-competition-ai.30447/
 
Thanks so much for the detailed follow-up!! :) Will keep all this in mind.
But there are a lot of car/track combos. Customizing and testing each would be a mammoth undertaking.
Yes, that's true. Work to save for later!
What I really meant was I'm not sure what happens in a race session when you use soft tires for a sprint: Do the AI use soft tires too or are they still using mediums (I assume...) ? Like, do they respond in any way to your setup changes? I don't know.
I don't know if they respond intelligently by default, but I'm almost certain there is a setting in the PLR file to force AI to use your setup. So if you enabled that setting, if you only changed your tyres to soft for a sprint race (as per your example) they would use softs too. But it could be dangerous to alter anything other than tyre compounds in your own setup, given I'm guessing the numerical values describing a setup are not equally applicable to every car (although I may be wrong about this). So I don't feel like it would be right to suggest enabling this setting for everyone, always and everywhere.
 
I don't know if they respond intelligently by default, but I'm almost certain there is a setting in the PLR file to force AI to use your setup. So if you enabled that setting, if you only changed your tyres to soft for a sprint race (as per your example) they would use softs too. But it could be dangerous to alter anything other than tyre compounds in your own setup, given I'm guessing the numerical values describing a setup are not equally applicable to every car (although I may be wrong about this). So I don't feel like it would be right to suggest enabling this setting for everyone, always and everywhere.

I keep thinking there is but I can't find it.
 
I keep thinking there is but I can't find it.
As an update, I've kept looking for this option, and still can't find it. In fact, I don't even see this option in other ISI-based sims like rFactor or Automobilista. Must have invented it in my head! My bad.
 
funny enough I am looking for same exact setting to test one enhancement I am working on. I see this:
Vehicle Specific AI Setups="0"

But did not yet try it.
The GTR2 description of that param didn't sound like it, though? -->

// If 1, search specific vehicle directory for "<track>.<qual/race>.svm" or "<track>.svm" or "ai.svm" before falling back on game.gdb defaults
 
The GTR2 description of that param didn't sound like it, though? -->

// If 1, search specific vehicle directory for "<track>.<qual/race>.svm" or "<track>.svm" or "ai.svm" before falling back on game.gdb defaults
You are right, but doesn't it mean you can force some setup by changing the .gdb? Not exactly force your setup, but still
 
If I understand correctly - you'd have to create equivalent custom setups for each car for each track, then update each track's gdb to look for them? Is that right?
 
Have you looked at Von Dutch AI Tutorial? (in the library here) He goes over much of this; you can get good AI performance, but it's tedious and time consuming.

Another irritant is brought by default track settings. Don't you hate when practicing to be noticeably faster than the AI but then start a race and they leave you in the dust? Or the other extreme where you are a backmarker all through practice and qualifying, start the race at the back of the field, and am in the lead by the end of the first lap.

I tweak the aiw file for each track. Start by running enough practice laps to create a decent setup and know my average times, then set QualRatio and RaceRatio to zero. Run a few testing sessions and note the AI lap times, tweak MidAdjust to set them where you like. Now run a few qualifying sessions and tweak QualRatio to set the AI times where you want them. Next a few AI only races and tweak RaceRatio to set the laptimes there. You will now have AI speeds consistent through practice, qualifying, and race.

You will probably have to do this for each class of car you race, what is optimum for GT cars may be horribly wrong for F1 or prototypes. I keep a txt file in each track folder containing those lines for various classes/mods so a quick copy-paste into the aiw file sets the AI for whatever I want to run.
 
Have you looked at Von Dutch AI Tutorial? (in the library here) He goes over much of this; you can get good AI performance, but it's tedious and time consuming.

Sorry I haven't gottten around to replying for so long. I have a copy of the Van Dutch AI tutorial. Very useful stuff. I should take another look. Got the PDF open right now...it goes deep.

Another irritant is brought by default track settings. Don't you hate when practicing to be noticeably faster than the AI but then start a race and they leave you in the dust? Or the other extreme where you are a backmarker all through practice and qualifying, start the race at the back of the field, and am in the lead by the end of the first lap.

Yep. This has ruined many AI races for me.

I tweak the aiw file for each track. Start by running enough practice laps to create a decent setup and know my average times, then set QualRatio and RaceRatio to zero. Run a few testing sessions and note the AI lap times, tweak MidAdjust to set them where you like. Now run a few qualifying sessions and tweak QualRatio to set the AI times where you want them. Next a few AI only races and tweak RaceRatio to set the laptimes there. You will now have AI speeds consistent through practice, qualifying, and race.

That's dedication! I basically ended up doing this, too, but just focused on RaceRatio to simplify. I figure I can just adjust the AI level in-game to deal with qualifying performance.

You will probably have to do this for each class of car you race, what is optimum for GT cars may be horribly wrong for F1 or prototypes. I keep a txt file in each track folder containing those lines for various classes/mods so a quick copy-paste into the aiw file sets the AI for whatever I want to run.

Luckily, this has worked for the stock 2003/2004 GT and NGT classes for me so far. You're probably right, though, I really was expecting to run into some car combo where it no longer worked.
 
An important correction - initially set RaceRatio and QualRatio to 1.000, and in-game AI to 100%. The ratios and midadjust at 1.000 equals 100%, so with in-game AI at 100% the AI is running unmodified at the settings of the AIW file. Changing the 1.000 is altering the percentage of teh AIW settings the AI will use, so at 0.950 they will run at 95% of the AIW setting, 1.05 would be 105% of the AIW settings.

Once MidAdjust, Race and Qual ratios are set, move on to the next track, leaving AI in-game at 100%. When all tracks/mods are set (for now, lol, this is an ongoing process for me) the in-game AI can be tweaked for a particular race without upsetting the balance of practice/qualify/race speeds. Then it's a matter of fine tuning the talent files.

Start with default cars and tracks (I use the 360 Modena, easy to drive and setup; and a field of a dozen of them for the AI races). Now you're familiar with the procedure it's easy to repeat with any new track, 20-30 minutes of solo testing, 20-30 minutes of AI racing, and it's set (and I always spend at least an hour with a new track anyway, so it's not extra time involved).

Yes, the settings are usually good for the default cars and similar mods; the farther in performance a mod is from the default cars, the more likely it will require custom settings; though you may have enough leeway in the talent files to get decent performance with your base track settings.
 
Last edited:
You are right, but doesn't it mean you can force some setup by changing the .gdb? Not exactly force your setup, but still
Enable AI setups (in the plr file, I believe); then copy your setup for that car and track into the car folder (not the subfolder for each skin) and rename it exactly as listed or it will be ignored. It's a good idea to give the AI setup a slightly taller top gear or they are prone to blowing the engines on long straights. Note this can quickly eat up HD space if you have hundreds of tracks and cars ...a 4k allocation unit for each setup, qual and race, for each car type at each track; but it definitely improves the racing.
 
Thank you so much jgf, this is super fascinating information and insight! :)
Start by running enough practice laps to create a decent setup and know my average times, then set QualRatio and RaceRatio to zero. Run a few testing sessions and note the AI lap times, tweak MidAdjust to set them where you like.
Two quick clarifying questions:
  1. What affects the AI's speed in a practice session (not quali or the race)? QualRatio, RaceRatio, or something else?
  2. So you can speed up or slow down the overall AI pace (given a fixed AI Strength percentage) at a track by setting MidAdjust, is that correct?
 
Thank you so much jgf, this is super fascinating information and insight! :)

Two quick clarifying questions:
  1. What affects the AI's speed in a practice session (not quali or the race)? QualRatio, RaceRatio, or something else?
  2. So you can speed up or slow down the overall AI pace (given a fixed AI Strength percentage) at a track by setting MidAdjust, is that correct?
MidAdjust is an overall setting, it will affect both ratio settings and practice speed; so set both ratios to 1.000 and tweak MidAdjust so the AI run the practice times you want, then use the ratio tweaks to set their qual and race times. Now when you vary the AI strength in the menu, all three will vary in proportion, AI will remain consistent through practice, qualifying, and race.
 
FWIW, you can then give the AI cars setups for each track (I use my own setups with a click or two taller top gear), then tweak the talent files so each performs slightly differently. An ongoing process, and excellent excuse for running more laps, but you'll be surprised how good AI races can be.
 
Glad you chimed in jgf.

In another post here on RD I mentioned a multipage discussion on NoGrip about tuning the AI by editing the AIW, among other tweaks. Granted I couldn't remember a lot of the info in that original thread so it's nice to see some of it again.
 
For more info I recommend the VonDutch AI Tutorial and Barry's GTR2 Reborn, both in the libraries here. The former contains pdfs of many of those old NoGrip threads. Do not install both as they edit many of the same files, but the documentation for both is a wealth of information on tweaking AI. (I particularly like the AITorqueStab adjustment VonDutch found, doesn't change performance but no longer are the AI cars tanks, they will be as likely to spin from contact as you.)
 
I have both of those archived somewhere on one of my many DVD backups. I'll grab them to save me the time of going through those old discs.

I remember that AITorqueStab adjustment. I just looked through one of my original "enhanced" installs of GTR2 from way way back and sure enough I had applied it to the cars. Ahhhh, the things you forget over time.
 

Latest News

How long have you been simracing

  • < 1 year

    Votes: 373 16.1%
  • < 2 years

    Votes: 256 11.0%
  • < 3 years

    Votes: 247 10.7%
  • < 4 years

    Votes: 181 7.8%
  • < 5 years

    Votes: 304 13.1%
  • < 10 years

    Votes: 260 11.2%
  • < 15 years

    Votes: 166 7.2%
  • < 20 years

    Votes: 129 5.6%
  • < 25 years

    Votes: 100 4.3%
  • Ok, I am a dinosaur

    Votes: 301 13.0%
Back
Top