AI Settings experiment

It's that time of year again, so I got motivated to try and run my 1960s Le Man's race against AI. The HistorX mod has most of the cars, and the 1977 Le Man's track by VirtuaLM is lovely for the task. After a few laps, I suddenly remembered the major problem with RFactor1. The AI will slam into your back and put you off the track. No fun when you are racing 30 laps of Le Mans.

So this led me down the rabbit hole, as it always does, to see if I could improve this AI problem and enjoy my race. I remembered a recent discussion about Composure in GTR2 and wondered if this idea might help me. So off I went, adjusting the Talent files one at a time, raising the composure setting by 20 in each file. This took a few hours :(
Much to my surprise, it made a big difference. So as I always do, if a little bit helps, then a lot should be better. So I used Notepad++ to raise the Composure in all files to 99 and the courtesy to 90 something. This did make an even more significant difference. Possibly the AI is a little boring now, and I may need to tune it back a little.
This morning I thought I would experiment to see the difference in AI more closely. So I started a race, quit to the pit, and followed one of the AI cars as they lapped slow traffic.

Here is a video of what I saw.

 
raising the composure setting by 20 in each file. This took a few hours
This hurts to read... Just so you don't spend hours each time you redo the experiment: such changes are rather easy to do with programmatic text-processing tools. Unix/Linux's command-line tools are pretty great for this, and I would guess Windows has something in the Powershell (and also late-ishly began allowing to embed Linux with the WSL). IDK if Notepad++ has built-in scripting which can be used together with text replacement—perhaps there's a plugin for that: i.e. you could match ‘Composure=something’ and have the editor add a value automatically.

You can probably even use good old regular expressions for that, with some awkwardness, presuming that Notepad++ can run the replacement in multiple files at once: since the values seem to be all in double digits, you would replace ‘7(\d)\.’ with ‘9$1.’, ‘6(\d)\.’ with ‘8$1.’, etc. (Dunno about values of >80, since the parameter seems to be a percentage.)

I realize that nerding out with such tools is not everyone's cup of tea, but learning them once comes in handy repeatedly—especially if you regularly deal with text configs like rFactor's. In the few hours one could go through a simple tutorial e.g. for regular expressions or command-line tools, and then make them do the replacement. =)

There's also a Python lib for manipulating rFactor config files—it doesn't have anything specifically for talent files, but the format looks the same for all of the text configs, so code can probably be copied and adjusted. Not sure if the replacement would keep comments and such, though.

If you have anything in the way of Unix tools (e.g. WSL or MinGW) or, say, Python or Node.js—you can shoot me a message, we could slap together a script in like twenty minutes. Can't help with Powershell, though. I would also guess that there are graphical Windows tools for such specific kinds of processing, but then again they tend to be limited and to poorly chain with other programs.
 
As for the AI, a question: are you running the ‘AI Improvement Plugin by JR’?

I just did some attempts at VSM Indycar an hour ago, with many a broken wing, and I'm ready to either slap some AI drivers, run a plugin, or finally try Automobilista. Notably, driver files for the mod already have both composure and courtesy in the 80s for most drivers.
 
As for the AI, a question: are you running the ‘AI Improvement Plugin by JR’?

I just did some attempts at VSM Indycar an hour ago, with many a broken wing, and I'm ready to either slap some AI drivers, run a plugin, or finally try Automobilista. Notably, driver files for the mod already have both composure and courtesy in the 80s for most drivers.
Thanks for the tips. For the second round of adjusting, I used Notepad++, which has a Find and Replace function. So I did find composure=\d\d Replace with composure=99.
My problem is how do I multiply the number by something and put the result in? It would be ideal to raise all values by 5%, for example. I see you are using some other symbols in your example. What do they mean, and where would I get a small list of the available functions I could use?

As for your Indy car problem, I think they painted targets on the wings, and the AI is trying to hit them. It's similar to another great mod I like to try now and then, Chief Wiggum's F1 1986. It's a good mod but ruined by the AI trying to break the sound barrier on every corner.

I like to try reducing the brake power, brake grip, and corner grip in the PLR.
Change or add the line AIBrakeingstiffness into the AIW for the track.
Narrow the track boundaries in the AIW file, so the AI thinks the corner is narrower.
Raise the composure in the talent file to 99 :) I just learned this one.
Fiddle with the AITorqueStab numbers to reduce the freight train effect of AI cars, specifically the last number.

That are just a few things off the top of my head. Hopefully, something you haven't tried is in there.
We know some mods work very well, so it must be possible to get the indy cars to do it too.
 
I heard enthusiastic praises about the AI Improvement plugin—like, apparently it somehow makes the AI more aware of the surroundings, and I guess should cure it of running over everyone else around. However spinning up Java 1.8 might not be straightforward, especially in more involved system configurations.

I haven't fiddled with any track or AI params so far. Kinda loath to deviate from the ‘official’ sources and turn the whole game into my unique arrangement—though then again it seems to be inevitable. But—is there some doc listing all the params and their effects? I'd like to have some idea of what I'm doing before letting my fingers loose.

how do I multiply the number by something and put the result in?
Alas, regular expressions can't do that. They are quite powerful, but ultimately they can only shuffle text around. However, with some editors like the old pair Emacs and Vim, you can use their internal scripting languages to construct the replacements on the fly—i.e. exactly take the original number, add to it or multiply it or whatever else, and put the result back in the place. Plus, these editors can do the replacement in a bunch of files at once—so the whole affair takes just a minute start to finish. Since Notepad++ supports plugins, it might have something like this available.

What I did with those regular expressions above is, I match two-digit numbers that have a dot after them and with a specific first digit, then I replace the first digit by adding 2—specified manually—and put the second digit back as it was. This amounts to adding 20, but without any programmatic math since it's out of regexes' power.
 
FWIW, when editing multiple files try Textcrawler; tell it what files to process, what expressions to check in those files, what edits to make, and to create backups, and in a couple of seconds it will process hundreds of files.
 
Textcrawler seems to only do regular expressions, which is the same as what Notepad++ does by default.

I'll try to come up with something for Powershell, out of pure sporting interest—since it shouldn't take long, and Powershell happens to be available for Mac and Linux too.
 
Last edited:
Following this thread with interest! :)

By the way – Unix systems may not only be useful for their text editors and scripting capabilities. Simon Aguirre says here that on a Linux system running rFactor through Proton/Wine (when emulating Windows 7) you can launch the original rFactor AIWCAM editor e.g. recalculate the visual "racing groove" or drive new racing lines!

I heard enthusiastic praises about the AI Improvement plugin—like, apparently it somehow makes the AI more aware of the surroundings, and I guess should cure it of running over everyone else around. However spinning up Java 1.8 might not be straightforward, especially in more involved system configurations.
I wouldn't give the plugin "enthusiastic" praise BUT in my experience it does significantly improve the AI's spatial awareness. It might cause as many or more problems than it solves, though e.g. improved awareness at the expense of their ability to overtake. But that's something I need to test more. Follow this thread for more as myself and others continue testing.

Anyway, on a Windows system, installing the necessary Java Runtime Environment version to get the AI plugin working (at least partially) is easy. Go to this link https://www.java.com/en/download/manual.jsp. You want to download the "Windows Offline" version. It's the 32-bit one, and should be named jre-8u...-windows-i586. FYI if you have an old 32-bit JRE installed (e.g. jre-6u, which is needed in order to run dynHud) you'll need to uninstall it for the plugin to work.
 
I am still trying to create my perfect Le Mans 1960's race. And thanks to you guys, I am learning a few things along the way.

Things are working much better now with The Composure for all AI Drivers set to 99 And Courtesy set to a range of 90-99.
However, this is racing, and an AI will eventually hit my bumper. The Historx (or HistoricGT) mod still tends to hit you "out of the park" if an AI ever bumps into you (the freight train effect).
So with my new confidence in replacing values in bulk files, I thought I would try to adjust this.
Due to past conversations and reading posts on this forum, I know that a significant factor in this effect is the AITorqueStab setting in the .HDV file.
I looked at the values in the HistorX mod and found that a high setting of AITorqueStab=(1,1,1.4) was in all of the cars. I had a look at how the Enduracers mod was set up because the AI in that mod works very well. I found a setting of AITorqueStab=(0.90, 0.90, 0.42).
So using Windows search, I searched for all the .HDV files in the GameData\Vehicles\HISTORIC GT folder. Then I dragged and dropped them all into Notedpad++ and did a find AITorqueStab=(1, 1, 1.4) and replace with AITorqueStab=(0.90, 0.90, 0.42) and saved all files.

Now for testing.
To my surprise, the AI cars did not become unstable with this new setting. Things seem to have become a little more stable. The AI are not losing grip on the rear end as they did before? This is opposite to what I expected. And yes, when the AI bumps into me, I can feel it in the FFB, but I do not lose control.

I can only guess that the speed the AI attempts through the corner is affected by the AITorqueStab setting and that the AI is now going a little slower.
 
I'm ready to either slap some AI drivers, run a plugin, or finally try Automobilista.
:roflmao::roflmao::roflmao:

Just a note I thought I should add. If you give up on vanilla rFactor, you don't have to lose the cars or track you're driving by switching to Automobilista 1. With the rfactortools GUI program, it's simple to convert content (either cars or tracks) stored in a GameData directory to a GameData folder with content readable in Automobilista. For cars, you then also have to convert the info from the RFM file in rFactor 1 to a "Series" file in Automobilista – which is simple to do if you compare the RFM file to a series file for one of the default content series in AMS, then adapt accordingly. :) This converted content is not optimized for AMS (e.g. fancy shaders, turbo, flatspots, skies, dynamic track) BUT does benefit from core game improvements e.g. to AI behaviour – and therefore should be better than a frustrating rF1 experience.
 
I looked at the values in the HistorX mod and found that a high setting of AITorqueStab=(1,1,1.4) was in all of the cars. I had a look at how the Enduracers mod was set up because the AI in that mod works very well. I found a setting of AITorqueStab=(0.90, 0.90, 0.42).
So using Windows search, I searched for all the .HDV files in the GameData\Vehicles\HISTORIC GT folder. Then I dragged and dropped them all into Notedpad++ and did a find AITorqueStab=(1, 1, 1.4) and replace with AITorqueStab=(0.90, 0.90, 0.42) and saved all files.

Now for testing.
To my surprise, the AI cars did not become unstable with this new setting. Things seem to have become a little more stable. The AI are not losing grip on the rear end as they did before? This is opposite to what I expected. And yes, when the AI bumps into me, I can feel it in the FFB, but I do not lose control.

I can only guess that the speed the AI attempts through the corner is affected by the AITorqueStab setting and that the AI is now going a little slower.
Surprising result, for sure. Hmm. Maybe, just to confirm AITorqueStab can have an impact on AI behaviour with HistorX cars, you could set the values really low e.g. (0.1, 0.1, 0.1) and see what happens? I guess you hope it's total carnage :D:p
 
For those curious, some explanation of the meaning of AITorqueStab from master RACE 07 modder @AndreasFSC is below:

The fields are 1 Pitch (car body up/down front/rear), 2 Jaw (car body rotate as when turning), 3 Roll (car body rotates side to side, as prevented/decreased by anti roll bars)

AITorqueStab stabilizes these rotations as an opposite force. Settings about 1.05 - 1.15 usually works well and feels quite equal to player car.
Too high settings makes ai cars feel like trains that can't be moved, and it also reduces weight transfer load on tyres and therefore also reduces some grip. Too low makes them very unstable as you say.
 
The AITorqueStab only affects the force required to move the AI car; if set too high (typically 2.0+) they are tanks, any contact will send you flying off the track while they wont even bobble; too low (this varies greatly) and the slightest contact will send them careening off everything. Unfortunately this also affects contact with trackside objects, so a too low setting will have them rebounding from the least contact with armco.

A good rule of thumb is to consider the mass of the car, a large GT car may need 1.0 or slightly hgiher while a small formula car works with 0.2; feel free to experiment. (In GTR2 some cars had 3.0 and above, they were like brick walls.)
 
The AITorqueStab only affects the force required to move the AI car; if set too high (typically 2.0+) they are tanks, any contact will send you flying off the track while they wont even bobble; too low (this varies greatly) and the slightest contact will send them careening off everything. Unfortunately this also affects contact with trackside objects, so a too low setting will have them rebounding from the least contact with armco.

A good rule of thumb is to consider the mass of the car, a large GT car may need 1.0 or slightly hgiher while a small formula car works with 0.2; feel free to experiment. (In GTR2 some cars had 3.0 and above, they were like brick walls.)
Thanks, jgf. Your comment that it should be based on weight is an excellent idea. For the moment, I am simply guessing and testing to see if it works.
If I were to race a single class, maybe something with an average weight, and find the best AITorqueStab, I could then use that to calculate the number for all the rest based on weight and save myself a lot of time.
Surprising result, for sure. Hmm. Maybe, just to confirm AITorqueStab can have an impact on AI behaviour with HistorX cars, you could set the values really low e.g. (0.1, 0.1, 0.1) and see what happens? I guess you hope it's total carnage :D:p
I did do this experiment in Race07. The cars lose their grip on reality.
With the first number very low, they couldn't drive and just sat spinning the wheels. With the second number low, they couldn't turn and would drive straight ahead. And they started rolling on the spot like a barrel with the third number low.

In the meantime, I discovered this parameter in the HDV file for each car.

AIPerfUsage=(-1.0, -1.0, -1.0)

After a bit of searching, I found this description of its use.
PLR file overrides for (brake power usage, brake grip usage, corner grip usage) used by AI to estimate performance - only positive values will override, see PLR for defaults

This is very interesting. It means that in RFactor, each AI car has easily adjustable individual brake and grip characteristics. And also explains why adjusting these things in the PLR file had no effect.
So, of course, I went about adjusting these values too. After searching in the HDV files, I found that the HistorX mod has five different groups of settings for this. Some groups of cars had a setting of 1.4 for brake grip. And they happen to be the ones who love smashing me off the track.
I have now adjusted all of these values, ensuring no car has a value higher than one.

The AI racing in HistorX is much better now. Sure my adjustments are pretty rough. I certainly could spend more time perfecting the values for these settings. But that was not my aim.

I find the best way to learn is to mess things up and see what happens.
 
I discovered this parameter in the HDV file for each car.

AIPerfUsage=(-1.0, -1.0, -1.0)

After a bit of searching, I found this description of its use.
PLR file overrides for (brake power usage, brake grip usage, corner grip usage) used by AI to estimate performance - only positive values will override, see PLR for defaults

This is very interesting. It means that in RFactor, each AI car has easily adjustable individual brake and grip characteristics. And also explains why adjusting these things in the PLR file had no effect.
So, of course, I went about adjusting these values too. After searching in the HDV files, I found that the HistorX mod has five different groups of settings for this. Some groups of cars had a setting of 1.4 for brake grip. And they happen to be the ones who love smashing me off the track.
I have now adjusted all of these values, ensuring no car has a value higher than one.

The AI racing in HistorX is much better now. Sure my adjustments are pretty rough. I certainly could spend more time perfecting the values for these settings. But that was not my aim.

I find the best way to learn is to mess things up and see what happens.
Thanks for sharing your explorations, as always. :) Ah yes, AIPerfUsage. Makes sense! It's also used in the V8Factor Unleashed car files, by the way.
 

Latest News

How are you going to watch 24 hours of Le Mans

  • On national tv

    Votes: 269 34.5%
  • Eurosport app/website

    Votes: 215 27.6%
  • WEC app/website

    Votes: 145 18.6%
  • Watch party

    Votes: 64 8.2%
  • At a friends house

    Votes: 18 2.3%
  • At Le Mans

    Votes: 69 8.8%
Back
Top