How to make AI learn the racing line for a track

Marco Versele

Hhmmm, yes ...
Another interesting feature I found in rFactor threads: you can improve the racing line of the AI on a track!
I tried it in GSC and it worked like a charm.

Here's how to do it:

1.
Make sure GSC is not running, otherwise all your effort will be overwritten when exiting GSC.

2.
Open UserData\YOURNAME\YOURNAME.prl with notepad, and look for the line
'Autocalibrate AI Mode="0" // When in a test day with 1 AI, AI will attempt to perfect his driving line, and save his knowledge for future use'
Change to Autocalibrate AI Mode="1", save and exit

3.
Start GSC, and choose the vehicle and track you want the AI to learn.
In Settings set the following options:
- Private testing = ON
- AI drivers = 1
- Race grid position = 1
- Race start time = 08:00 PM
- Type of start : STANDING
- Race length type = TIME
- Flagrules = NONE
- Ethanol usage = OFF
- Tyre wear = OFF
- Mech. failures = OFF
- Time scale = NONE

4.
Load the track. Don't start the race!
When you are in the monitor screen, choose Add AI.
The AI will start its training and a message appears: "STAY OUT OF MY WAY HUMAN". The longer the AI is learning, the better times it gets.
The messages inform you of the distance the AI drove per lap compared to the ideal line. With each lap this difference gets smaller.
Type 'R'-key to switch from 'delayed replay' to 'live'.
Right-clicking on the AI's name will switch to a list of all laps driven by the AI with the respective lap times.
You can speed up time by typing 'ctrl-T', this will not affect the learning of the AI.
After a number of laps the message appears 'AI finished the learning' or similar.

5.
Still some meters of difference with the ideal race line can be left over.
The AI can improve to about 0 m of difference!.
To obtain this, remove the AI from the drivers list, and add a new AI.
The new Ai will start where the previous AI ended, and will continue to improve.

6.
When the learning is finished for your car and track, a track.ini file has been created for your team in \GameData\Vehicles\mod\CarType\team folder.
(For Blancpain mod: \Gamedata\Vehicles\Teams\CarType folder)
In order for all other cars of the same vehicle type to profit from the learning of the AI, you can copy the track.ini file from the team folder and paste it into the \GameData\Vehicles\mod\CarType folder.
(For Blancpain mod: \GameData\Vehicles\Physics\CarType folder), that is: where the CarType.hdv files, CarType-Tires.tbc files and other car related files reside.
Remove the file from the team folder.

7.
This procedure is per car type and per track. You need to repeat for each different car or track

8.
DON'T FORGET!
Revert to the original state of your YOURNAME.prl file (see point 2.), and restore your ingame settings (see point 3.).

Enjoy
 
7.
This procedure is per car type [...] You need to repeat for each different car [...]

No.

As per threads by RSC's Rob (and slobbeman, etc), pertaining to rFactor AI learning (way back from 2006/2007), this is what needs to be done:

"Speaking of the INI file, the following is the manipulation needed for all the cars to use it not just the team that did the AI LEARNING.

Look in C:\Program Files\rFactor\GameData\Vehicles\\ now in the TEAM that did the learning there will be a .INI file, THIS is the file that needs to be moved so that all cars in the chosen mod can use the updated learning file."

This is how we have been doing for years, and works effectively for rF or GSC.
 
Well, you forget to read and mention the rest of the text:

"What you do is CUT the file and paste it in the CAR directory of the effected car. So SAVE it to C:\Program Files\rFactor\GameData\Vehicles\. The dir that has the .HDV and .TBC and other car related files in it."

This means it's only valid for the same type of car, or 'the effected car' as it is called in that thread. As I mentioned: the track.ini goes to the folder of the CarType folder. It needs to be repeated for a different type of car, and then goes to the appropriate CarType folder or the folder of the effected or related car.
 
No, you don't need to do that.

Open the ini file generated by one car, generate another one and compare the two. You'll notice the differences, but you have to understand WHY and what's going on.

If you know anything about AIW's (speed, position, latitude for dry and wet lines, inside lat, outside lat, groove lat, etc) and understand what is being generated in the ini file, it ought to be easy for you to figure this out.

One ini file generated under "learning mode" is not "valid" nor "invalid" for 1 car or multiple cars. The same ini file (for the same TRACK) can be used for different cars, as it simply alters the speed and position for all waypoints defined in the AIW of the track.

This topic has come up multiple times throughout the years at ISIFORUMS. Neither speed12 nor Tim have advised against it - not even with rF2.

As for "The dir that has the .HDV and .TBC and other car related files in it", you have misunderstood the text. The ini file generated per track must reside alongside files such as the hdv and tbc. That simple.

Perhaps it's best to show you what ISI themselves have stated about "AI learning".

Artificial Intelligence
-----------------------
- AI can attempt to "learn" a track (by learn I mean, better follow the path). To enable turn on Autocalibrate AI Mode="1" in .plr file. Enter a track in Test Day with a single AI. The AI will take off and talk to you in chat and tell you how he's doing. Typeing "status" tells you how he's doing and "finish" will make him end next lap.
- AI's upon Init now look recursively up from the *.veh directory for a trackname.ini file that modifies the speed and position of every waypoint on the main track.
- Improved AI behavior when rolling to standing starts on banks. If all else fails will teleport to their locations.
- Improved AI pit behavior, should no longer slow down for cars heading into pits
- Fixed "Safety car always drives 10 meters off road/crashes into walls" bug
- Improved calculation of AI max cornering speed.
 
Last edited:
I don't wanna argue to much about this, but apparently the text you're referring to comes from a readme file dated 2004-2006 (rfactor readme1087.txt).

http://tripp.team-forum.net/t17-rfactor-tweaks (27-mar-2014) comes with a confirmation of my thaughts on how to do it properly:
"3.Choose the car you want under VEHICLE to teach AI to run this car type properly on any track.", and: "now in the TEAM that did the learning there will be a .INI file, THIS is the file that needs to be moved so that all cars in the chosen mod can use the updated learning file. What you do is CUT the file and paste it in the CAR directory of the effected car".

After all, I can't imagine a Lada taking the same raceline as a LMP1?

Edit:
After some further investigating I come to the following conclusion:
Within a mod (in my case: EnduranceSeries) you cannot choose a specific vehicle within the most detailed category. Meaning: I can choose an EnduranceSeries GT car, but not choose between Porsche, Aston Martin, Corvette, ...) But I can choose an Endurance GT AI car to learn the track, then choose an EnduranceSeries LM P1 AI car to learn the track on its own, and then cut and paste the track.ini files from the team folders to their respective category folders. I would'nt let an EnduranceSeries LMP1 run with a EnduranceSeries GT raceline, because I'm not convinced they both follow the same racelines.
 
Last edited:
apparently the text you're referring to comes from a readme file dated 2004-2006 (rfactor readme1087.txt).

http://tripp.team-forum.net/t17-rfactor-tweaks (27-mar-2014) comes with a confirmation of my thaughts

"Apparently"?

No, not at all. :)

The text comes from the readme file from Image Space Incorporated's official 1255 update index page, and is not dated as per your "2004-2006" (?) but actually 13-08-2008 (or... June 2013 for the 1.255g update).

If I recall correctly, old rFactor setup disks install a readme file dated June 2007, but their official page has suffered consecutive updates. Take a look below:

http://files.imagespaceinc.com/1255/
or
http://files.imagespaceinc.com/1255g/

The .chm file is the first file after the last folder. Download it, I'm sure it will help you understand what changes they did to the AI since initial release.

There's simply no arguing here.

You can, however, ask ISI themselves for corroboration of what you wrote above, that the AI learning process is "only valid for the same type of car".

Anyway,
AI Learning is very important for rFactor (maybe not so much for rF2, according to some feedback), the process is simple (as outlined in the 1st post, with a minor correction to point 7) and though time-consuming (if done for several or all tracks) it can enhance dramatically the racing. It could be invaluable for newcomers to have AI Learning instructions stickied somewhere in this forum.
 
Is it better ot "train" the AI or to increase their difficulty? Does the "training" also increase their racecraft, ie does it provide them with more information about the track and thus more lines and options to drive, thereby increasing their ability to vary and use different lines as well, or does it simply increase their ability to drive "on rails" on the best line?

Thanks
 
So…what I don't exactly get: do I have to cut the *.ini file from the AI-learning process and put it in the cars folder? Or do i have to copy it?

An example.
I want the Formula Classic AI to become better at a certain track.
After an AI driver has successfully learned the track the *.ini will be created in the team folder.
What to do now? Cut the *.ini or copy it into the Formula Classic folder?
 
Ok, now I have two more questions:

• What is for example with the CART mod? Where do I have to put the track.ini? The main category is CART but further on it is divided into Lola, Reynard, Penske and one other. Same question can be asked for the DRM Mod (and many others where you have different brands)

• Does it matter which driver you choose for the AI learning? As I have noticed some make more and some make less errors while learning the tracks. I tend to choose the ones who are most consistent and fast.
 
It depends on the tracks, William. I've tried them at Mexico for example and there is one part of the track where they hit the curbs and slide out. So I did some AI learning and it got better after all. As I don’t know how to create a new fastpath for tracks that’s the way I do it for now, but I’ll try to get into the AIW tools.
 
Aaaaand AI learning continues. :D
Now I read that the created *.ini track file has to go into the folder where the *.hdv and *.tbc files of the specific cars are. Problem is that they are in different folders.... (CART Extreme mod)

Can some expert help me out?

Also the official Reiza content has no *.hdv or *.tbc files anymore, since they seem to be encrypted.
How will you handle this?

Would be great if someone can help out.
 
How will you handle this?

Take note of which car the AI uses to learn the track You wil find the INI file inside that teams folder.

Place the track learned INI file from the "Team" folder (where the AI creates the file) to the Car "Class" folder so that all the team folders in the car class can share it.

GSC is setup like this

"Vehicles" -
"Car Class" -
"Teams"

If you put the INI file in the vehicles folder all the car class will use the INI and that will cause issues.
 

Latest News

How long have you been simracing

  • < 1 year

    Votes: 260 15.4%
  • < 2 years

    Votes: 170 10.1%
  • < 3 years

    Votes: 168 10.0%
  • < 4 years

    Votes: 125 7.4%
  • < 5 years

    Votes: 231 13.7%
  • < 10 years

    Votes: 200 11.9%
  • < 15 years

    Votes: 125 7.4%
  • < 20 years

    Votes: 98 5.8%
  • < 25 years

    Votes: 77 4.6%
  • Ok, I am a dinosaur

    Votes: 230 13.7%
Back
Top