1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to make AI learn the racing line for a track

Discussion in 'Stock Car Extreme' started by Marco Versele, Jun 14, 2014.

  1. Marco Versele

    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:

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

    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

    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

    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.

    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.

    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.

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

    Revert to the original state of your YOURNAME.prl file (see point 2.), and restore your ingame settings (see point 3.).

    • Like Like x 1
  2. is it for default cars/tracks or only for mods
  3. Marco Versele

    Marco Versele
    Hhmmm, yes ...

    Whatever track or car. I've used "mod" in my directory destinations as a general instruction. The important thing is to be at the right track directory or the right car directory.
  4. 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.
  5. Marco Versele

    Marco Versele
    Hhmmm, yes ...

    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.
  6. 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".

    Last edited: Jun 14, 2014
  7. Marco Versele

    Marco Versele
    Hhmmm, yes ...

    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?

    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: Jun 15, 2014
  8. "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:


    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".

    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.
  9. Marco Versele

    Marco Versele
    Hhmmm, yes ...

    I'm eager to learn more about this. However I'm not aware of how to open a .chm file. Can you guide me for this? Thanks.
  10. It's curious you ask that, been asked that question (how to open chm files) many times by people who have recently adopted Win 7 or 8.

    If that's your case, maybe this will help:
  11. 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?

  12. Marco Versele

    Marco Versele
    Hhmmm, yes ...

    I think it's a matter of driving a lot of laps, and keeping the raceline with the fastest result. The AI ends up with a raceline that cannot be improved any more (under no opponent conditions).
  13. Fabian Biehne

    Fabian Biehne
    Premium Member

    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?
  14. yes cut and paste into the car main folder
  15. Fabian Biehne

    Fabian Biehne
    Premium Member

    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.
  16. I've found the CART AI to be pretty good as-is.
  17. Fabian Biehne

    Fabian Biehne
    Premium Member

    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.
  18. Ahh, I replied before I had my coffee for the day.
  19. Fabian Biehne

    Fabian Biehne
    Premium Member

    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.
  20. 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" -

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