I have created this Guide for the JSON entry of "Autocalibrate", this basically helps the AI learn a given track and save their Learning Process for future usage. I will be detailing both the "Autocalibrate AI Mode":1 and "Autocalibrate AI Mode":2 processes. (I may make additons, fix errors in future, if so Post #2 will detail what has changed) Before I begin here's a few notes: - You don't need to do any of the AI Learning if the AI are just fine at a track, more often than not it's 3rd party Tracks that need it or if a particular Mod has difficulty in a corner or section of a track that you're racing at. - Remember the AI make mistakes (there is a setting in the JSON for this). If you see AI occasionally spinning at a corner then that's ok, you don't need to panic and jump into the Learning Process to make them 100% Clean every lap. The beauty of RF2s AI is that they are very Human like....so they make mistakes! - The Tracks AIW file (this is what the Track Author creates to give the AI a Basic Driving Line) is a Major key factor in both Learning processes, no amount of AI Learning will prevent the AI crashing if the AIW is poorly created. - "Autocalibrate AI Mode":2 can have the tendency to create much faster AI and to a point where they become "too good", if (like me) you want AI to reflect Humans as best as possible (i.e. they make Mistakes) then either run fewer laps with this setting or don't run it at all. As per the first point you don't have to do any Learning, this guide is merely for those times where it is needed should the AI be struggling. - Both #1 & #2 use Different algorithms, this means that #1 may actually work better at some tracks than #2 and vice versa. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- For the Guide I'll be using the latest ISI Renault Clio 2010 (v1.51) mod at Mills Metropark (v1.43) 'Layout Inner Loop C'. AI Learning Guide #1: "Autocalibrate AI Mode":1, 1) Locate your player.JSON file in your '\RFactor2\UserData\player' (yours may differ if you chose Default Dir when installing) and open with Notepad or preferred JSON editing tool. Search for and locate the following: "Autocalibrate AI Mode":0, In this Guide we will be using the "1" variable so go ahead and change the 0 to a 1. (NB: Make sure your player.JSON isn't Read Only) Save and exit Notepad then Load RF2 2) The in Game settings are important, so setup as follows (Picture for reference): - Firstly make sure AI is at 0 - Make sure to UNSELECT All 3 Sessions so you see 3 Grey Xs, this will enter you into a Test Day after track loading - Set the Weather to Sunny or Overcast, as long as there's no Rain at all - Turn OFF Tire, Fuel and Mechanical Failures. Set the Strength to 100% and Aggression to 50% (Edit: the following picture is incorrect with Practice selected, as above Unselect instead for Test Day) 3) OK here we are at the track, go ahead and ADD 1 AI (Important: Only 1 AI), in the Chat Box you'll see a friendly message from the AI telling you to pretty much sit in the Garage and not move: Now during His or Her learning process he or she will drive lap after lap and gradually you'll see the "I can do better" message scroll down until the "Meters" gets to 0.00 or as close too it. Sometimes they finish Learning before they reach 0.00 so don't worry if they do: Depending on the Track and/or Mod the AI might have difficulty in finishing the session, for example they might get into the 20.0meters range and constantly loop around that Number. If this happens type in FINISH into the chat box and you'll get the following message: Once they have Finished Learning you'll see the "Track Learning Succesful" message, you can now exit the track and that's it, they have learnt the track and are ready for Racing. 4) For Confirmation go to your \RFactor2\UserData\player\Settings\ISI_Renault_ClioCup_2010 folder and you'll see a List of the Cars (or just One) and their respective Folder. Inside one of the Folders there will be the following file: MILLS_INNERLOOPC.ini This indicates the Learning Process was completed. 5) For this file to work with all cars you have to manually copy the INI file to all the other Individual Car Folders, this way each individual car will read the same MILLS_INNERLOOPC.ini file when the track is loaded. Finally go back to your player.JSON file and set Autocalibrate back to 0: "Autocalibrate AI Mode":0, Important notes on this setting: - If you're running a Multicar Mod then you will have to do the process for each type of Car. - If the AI crashes before completing then simply Boot him out and ADD a new one (just 1 remember), if he crashes and fails to complete the process it could be the fault of the AIW, this Process is not a Perfect Cure for a poorly create AIW file. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- AI Learning Guide #2: "Autocalibrate AI Mode":2, 1) Locate your player.JSON file in your '\RFactor2\UserData\player' (yours may differ if you chose Default Dir when installing) and open with Notepad or preferred JSON editing tool. Search for and locate the following: "Autocalibrate AI Mode":0, In this Guide we will be using the "2" variable so go ahead and change the 0 to a 2. (NB: Make sure your player.JSON isn't Read Only) Save and exit Notepad then Load RF2 2) These are the settings you'll need: - PRACTICE and QUALIFYING only - Weather is set to Sunny or Overcast, as long as there's no Rain at all - Give the AI plenty of time, this is important for Longer tracks as this process can take some time to complete (I always use the maximum 1440minutes) - Turn OFF Tire, Fuel and Mechanical Failures. Set the Strength to 100% and Aggression to 50% - Make sure you select the exact number of Cars for the Mod, in this case there are 15 Clio AI Drivers (other Mods will vary) Load the Track 3) Right then here we are ready to go, as you can see the AI have loaded and they're set to begin the Learning Process. First up we won't sit back and wait for them to Complete the process in Real Time...we'll be here all day! so hit 'CTRL + X' so that Time Acceleration is On, again Larger tracks will still take some time even with Acceleration on so do some Housework or make a cuppa tea and watch TV for a bit! As you can see after 23-24 Laps they do their first Pit Stop for a rest then head out for another 24 Laps: ISI suggest running between 240-300 Laps for a decent sized Wisdom file, this will give the AI plenty of Learning time to create a decent sized file. This is what MikeZ of ISI says for this Setting: ...this new system doesn't make little improvements every lap like the old system tried to do. In this new system, the car goes out for (by default) 24 laps at a time (he warms up his tires the first 3 laps, then runs 3 alternating trials of X laps each...as defined in the playerfile....default is 7). After that 24* lap excursion, he returns to the pit and figures out which of the 3 trial values for that particular variable worked best (i.e. fastest time) through each "corner" and adds those results to his "wisdom" database. Then, before he refuels and heads out for another run, he figures out a new variable to test & 3 "trial" values (for each corner) to try based on past best values. I've been setting the game in time acceleration mode and letting them run 240-300 laps to build up a decent sized database. 4) When the AI have completed a decent number of Laps it is very important that you click NEXT SESSION, this Saves the Wisdom file into the AI cars folder (at time of writing simply Exiting the Track during Practice does not save the file). Now exit the game and go back to your player.JSON file and set Autocalibrate back to 0: "Autocalibrate AI Mode":0, I advise this as leaving it at 2 the AI will be in Learning Mode everytime you have a practice session (not needed) and setting to 3 (which is Read Only from the Wisdom file) has yeilded some pretty strange AI behaviour so best bet is put it back to 0. 5) For Confirmation go to your \RFactor2\UserData\player\Settings\ISI_Renault_ClioCup_2010 folder and you'll see a List of the Cars and their respective folders, open one up and you'll see the following file: MILLS_INNERLOOPC.wis The size of the file depends on the size of the track, I've seen them vary from 30k to 250k in size. Important notes on this setting: - The time it takes can depend on the number of Cars (as well as Track size), so if you have a Large field of AI then it's going to take a very long time, a way around this is to split it up so select 0 AI before you load the track and ADD AI individually (Say 15) let them Learn and when complete re-do with the other 15. Think of t this way, The More AI = The Longer Time. - If you see a *.wis file that is 2k in size that is You...as in the car you selected during the Learning Process. So if you go back and chose a different car then you'll need to run this Process again soley for that AI to Learn the track, so repeat above but Select 0 AI and when you click ADD AI find the relevant AI and it'll be completed a lot quicker this way. - Once the *.wis files are saved then leave them well alone, they do not need to be moved anywhere, don't edit them incase it renders them null & void. - Should you notice that an AI has had a crash and stopped running Laps then it is upto you what to do, if they have done 100+ laps I leave them, if less then simply Boot and find the particular AI in the 'ADD AI' Box and he'll start again. What you may find is he constantly crashes at a certain point, if that's the case then I would'nt worry too much. - Remember if a lot of AI are crashing and failing to complete a lot of Laps it could be the fault of the AIW, this Process is not a Perfect Cure for a poorly create AIW file. -From the Changelog when #2 came into force: When Autocalibrate AI Mode=”2″ in the playerfile, AIs will run laps in practice trying to optimize their operating parameters on a per corner basis ( up to the new playerfile variable “AI Calibrate Sample Size” number of trials). They create a database (*.wis file…for “wisdom”, in the UserData\player\Settings\componentName\VehicleFile directory) with the results & use these results to adjust their parameters on the fly in a race.
Thank you. Is it possible using the guide #2 on some few cars and to copy the .wis generated on the other car that not made the run?
It may work but I've always done it to the Number of AI per Mod, if you start copying/pasting wis files then there will be less variation between them and they could become too predictable.
Such a great guide man, thank you very much. Offline racing takes a lot of my time so this is very valuable to me. I will definitely be trying out the auto calibrated mode 2 now.
Thank you very much for posting such a comprehensive guide to doing this... I've been doing this for years since rF1 to make the AI better and it works really well... I've noticed however the new way to teach the AI via Wisdom files (*.wis) doesn't work nearly as well at all... perhaps it isn't fully implemented yet, but I taught a whole series several tracks and double checked they had the proper *.wis files, however the AI was an absolute mess after teaching them that way... so I went back to the rF1 old-school method (learning files) and it worked like a charm. My question is, have you done much research/testing with the new method and have you found it to be more useful and effective at teaching the AI? And perhaps what's throwing me off about the new method is you don't get any feedback from the AI so I'm not entirely sure when it's 'done' learning. In any case, I have always been driven to get ultra-realistic AI settings and AI learning is the first step in doing so. Thank you Marc for taking the time to post this.
Thank you very much for the guide. I'd just like to add rF2 appears to allow one line per car in AIW now (at least the HDV has a line for it) so if it's really working would be great for modders. Some cars can ride over kerbs, other can't so you can drive one line per car. This plus AI calibration would be the ideal condition.
Great guide--thanks for putting together such a clear and helpful instruction. But all of us doing this individually is a bit silly is it not? Successful .ini files should just be posted so we can enjoy them without the time and effort. It would take months of hours every day to do every combination of cars and tracks that have poor AI. We should set-up a volunteer system where we could each take a particular combination (or two or three) and then pool the results files for all to use. People could vote on what needed to be improved the most and we tackle those first. Eventually, all or almost all the combinations would be done.
I agree 100% with what Marc posted. I have done a lot of AI learning work with the Toyota Celica GTO and plan on releasing the proper AI files separately, to go along with my skinpack that will be released.
Thanks for the thanks guys much appreciated the *.wis method has always worked well for me barring One track that had an issue (which is now fixed) so not quite sure what you mean by "isn't fully implelmented", can you expand on that a little please? thanks As in the Guide I found the #2 Method to mean the AI become "too good", #1 is the best option if AI are struggling at a Corner/Section as they do Learn to take it properly without "over learning" the track. I think ISI were going to implement Feedback from the AI with #2 and there is occasionally the odd line from them, but now all you need to know is complete 240-300 Laps so Feedback isn't really needed anyway. In very old Builds #1 wasn't working so had to be fixed (and was a long time ago) and everytime I've tried #2 it's worked just fine (Most Builds), either way they work in the latest Build 930 so that's all you need to know (Can't help you if you're running an older Build, sorry). Yep I played with the Alternative Individual Line AIW (probably not what you're talking about but...) in this thread here: http://isiforums.net/f/showthread.p...ettings-Thread?p=246577&viewfull=1#post246577 But that's another tutorial for another day as there's a lot more involved in that! It's been mentioned (by me!) before that we need a Central Location for ini & wis files....but it fell on deaf ears and I gave up with the idea, if you want to start a Central Thread then go for it, well volunteered
Brilliant thread, MarcG, and thank you. I may have missed it in the OP, but could you please describe/expand-on the differences between the two methods? Also, I believe you said that method 2 can make the AI learn "too good"; could you please explain a little more? Thanks. Fantastic idea, Marc
by the way this really works, The sces honda arx was lapping a dismal 1:52 in silverstone wich didn't allow me to enjoy races, I made the steps suggested here and is now lapping at the 1:41 wich I can't follow. Brilliant.
I've added to the first post what the original changelog says (forget which Build, long time ago I know that much). The way I see it is #1 is a quick fire "fix" for certain areas of track, #2 is more detailed Learning process which allows the AI to learn & remember different lines through corners.
The only reason I can imagine that Tim wouldn't set-up a spot on this site in the third-party mods section for the .ini files is if ISI plans to change the learning programming soon or will have an automated way for this to happen in the future (i.e., it can run in the background while you are using a track under normal practice conditions...don't think anyone would want it to run under Q or race). Or, perhaps, it's just too fiddly and will generate issues for people who can't unzip files to their proper folders or zip them the proper way in the first place? Or, maybe a new AI superstructure is coming that will make this redundant because the AI will be smarter from the outset? So before I or someone else approaches Tim, what do you mean by "fell on deaf ears?"