1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
Like RaceDepartment on Facebook.

[Guide] How to make an AI Mod

Discussion in 'F1 2011 Mods' started by Kristian Nenov, May 5, 2012.

  1. Yes

    66 vote(s)
    97.1%
  2. No

    2 vote(s)
    2.9%
  1. Hello! This guide will show you, how to make an AI Mod. Even if you are an AI Modder, you may learn something. :)

    0. Introducing

    To make a good AI Mod, you'll need:
    1. A program that converts XML to txt. I usually use F1 2010 AI Tool Kit's converter, as it's the easiest for me.
    2. Ryder's database editor
    3. (Optional) Ryder's language editor
    Before you start making any changes, read the whole topic. When you know more, you're gonna make it better.

    1. AI Behavior

    The files that are responsible for the behavior of the AI are at the "ai" folder. The most important of them is "ai_driver_config".

    When you open it, you'll see that there are strange abbreviations like "Hv" "Ov" "tg" and etc. All of these mean something. Here's the list of the meanings:

    rm = Race Manager
    th = Throttle
    br = Break
    tg = Tail Gate
    as = Along Side
    rt = Retirement
    df = Draft (Slipstream)
    rc = Recovery
    ra = Race
    ov = Overtake
    vl = Vision Lost
    bl = Block
    av = Avoidence
    rs = Race Start
    co = Co Driver (Team Mate)
    sq = Squeeze
    tr = Track
    atg = Anti Tail Gate
    lc = Lost Control
    cr = Crash
    sc = Safety Car

    Now when you know what these mean, I'll try to explain how the most important rows of the file work.


    <rmCurvatureMultiplier float="1.6" /> - For some modders, this is the fix for the out of sight bug. They're lowering the value to make the AI out of sight slower. I don't really like this fix and I prefer to NEVER touch this value. It brings a lot of bugs.



    <scTargetSeparationTime float="0.2" /> - This is the distance that the first car will keep with the safety car. Higher value - more distance.
    <scInLapLeadSeparationTime float="15.0" /> - Like above, but this is only when SC is going into the pits.
    <scBrakingPerformance float="0.8" /> - How good is the safety car under breaking.
    <scCorneringPerformance float="0.85" /> - How fast will the safety car take the corners.
    <scMaxThrottle float="0.68" /> - How much throttle will the safety car driver give. Higher value results in faster safety car.



    <rearWingMaxCurvature float="0.01" /> - If you make it to "0.02" for example, the AI will start trying to use the rear wing (DRS) on bigger corners. I prefer to don't touch it because it results in spinning AI's due to DRS.
    <rearWingMinSpeed float="25.0" /> - The minimum speed that they activate their DRS on.
    <rearWingMinDistanceToNextCorner float="200.0" /> - If you make this value lower (for example 50) the AI's will use the DRS even on a small straights when the next corner is very close. The value is in METERS.




    <tgOffsetMergeFactor float="2.5" /> - I don't understand very good these "offset factors" but I think with a higher value, the AI is driving like he's more stressed. I mean, not so smooth, more aggressive and etc.
    <tgNonOptimalSpeedFactor float="0.6" /> - If the car ahead is under that speed (I think it's in % or something.), it won't slipstream it because it's too slow.
    <tgClampOffsetLeft bool="true" /> - Should it move left (to overtake) the slipstreamed car.
    <tgClampOffsetRight bool="true" /> - Should it move right (to overtake) the slipstreamed car.
    <tgUndersteerMaxOffset float="2.0" /> - If you set it to lower value, the AI will crash into each other trying to alongside the car ahead.



    <asRejectDistance float="7.0" /> - How close should the AI car (behind) get, to start breaking (so it doesn't crash into the car in front).
    <asTargetBuffer float="-3.0" /> - I used this to improve a little the overtakes. The car that is getting overtaken is under stress and this value "-3.0" is slowing him down due to the pressure. It is originally "-2.0".



    <damagedMaxThrottle float="0.6" /> - When the AI has broken wing, tire or something it drives slower around the track. This is the max % throttle that the AI should give. It is originally set to 0.6 (60%).
    <damagedCurvatureModifier float="0.6" /> - Same as above but this is the speed that the AI is carrying through the corner.



    <dfMinDraftSeperation float="1.25" /> - The separation (in seconds) on that the car behind will try to slipstream the car ahead. If you make this to "2.0" for example, it will try to slipstream when it's a lot behind.
    <dfBrakeZoneLimit float="50.0" /> - This value is in METERS. It makes the AI not to slipstream, when the breaking zone (point) is 50 meters away.
    <dfTrackCurvatureLimit float="0.005" /> - Slipstream = understeer. With a corner bigger than "0.005" - the AI doesn't slipstream so it can take the corner properly.




    <rcResetAllowed bool="false" /> - If you set this to "True", the AI car will be able to reset to the track when they've crashed. By reset I mean the "R" button in NFS or when you click ESC sometimes you get "Reset to track" on this game. It will use this. It's very unrealistic, I've never set it to True and I think no one would want this to be "True".



    Now all of these are the things that mostly matter for overtakings by AI.
    <ovTime float="0.6" /> - The lower value - more aggression the AI has. It's like this because this is the time that the car behind gives itself to overtake the car ahead. If you make it to "5.0", they won't try to overtake that much, because they're not on such "hurry". :D
    <ovBrakeOvertakeTime float="0.0" /> - This should be for overtakings under breaking, but it doesn't really work, so changing this value will result in NOTHING.
    <ovRejectDistance float="500.0" /> - When the car ahead escapes from the car behind in this value (this isn't meters) - it won't try to overtake it anymore and it will forget it.
    <ovSpeedDifference float="9.1" /> - When the value is lower, the AI will try to overtake at minimum speed difference. It brings problems under breaking because the car ahead breaks first and the car behind wants to overtake it because it's slower and it crashes into it. :D
    <ovFollowDistance float="1.0" /> - I don't know why it is 1.0 for me! I thought I changed it! Anyways, this is the distance that the car behind will keep with the car ahead before going alongside it. I hope you understood that. :/
    <ovMinFireTime float="0.0001f" /> - I played a lot with this and I didn't find out what exactly is doing. I think when it's a lower value - the AI overtakes better.
    <ovMaxCornerCurvature float="0.07" /> - The biggest corner that the AI will try to overtake on will be "0.07". I don't understand these values. How do I calculate a corner? But anyways, you don't really need to touch this.
    <ovMinMetresSeparationAwayFromCorner float="10.0" /> - The minimum separation in METERS that the two cars should have before a corner. If you make this value too low, they'll crash under breaking.
    <ovSeparationDistanceAtBrakeLine float="50.0" /> - The separation at the breaking point.
    <ovSecondsBeforeBrakeZoneToReact float="1.6" /> - When this is set to 1.6, the AI trying to overtake will stop giving more throttle 1.6 secs before the corner so they don't crash. I tried to change this value to a smaller one so we can get overtakes in corners and we got overtakes in corners but many people started moaning because they're using damage multipliers, so it's a tricky value.




    <blOffsetMergeFactor float="0.2" /> - No effect
    <blMaxBlockeeDeceleration float="5.0" /> - No effect
    <blMaxTrackCurvature float="0.005" /> - No effect
    <blMinIntersectionTime float="1.0" /> - No effect
    <blMaxIntersectionTime float="4.0" /> - No effect
    <blMaxSpeedDifference float="20.0" /> - No effect
    <blBrakeLineDistMin float="50.0" /> - No effect
    <blMinValidBlockingMovement float="9.0" /> - No effect
    <blCornerCurvatureToBlockToTrackInside float="0.015" /> - No effect
    <blMinSpeed float="25.0" /> - No effect




    <rsStallPercentage float="2.0" /> - How many % every AI car has to stall at the race start. Even with 2%, they don't stall a lot.



    <trTrackCurveOfflineRatio float="1.0" /> - This value regulates the AI cornering speed. It's not exactly in %, but it is usually set to "0.6". I made it to "1.0" so the AI carries more speed through the corners. DO NOT make it more than 1.0 because it will take it as "0.0" and the AI will be slower.
     
    • Like Like x 14
  2. 2. Out of Sight Bug FIX

    I showed you how most of the modders fix the out of sight bug a litttle above. Here, I will post my fix.

    It is in "ai_handling_config".

    When you open it, you'll see some interesting values tho. For more overtakings with DRS you can set this to a higher value:


    <drsSpeedBoost float="1.5" />


    Anyways, for the out of sight bug.

    <corneringAccelerationCoefficent float="0.20" />

    This is what it makes it. After Patch 1.2 this value was "0.7" or something like this. I lowered it. Now, another thing is that I make the tracks in groups. I've been making Lineage 2 servers years ago and this is simple XML thing to do. For you, it will be easier to just copy/paste it.

    <handling_type name="vlow">
    <corneringAccelerationCoefficent float="0.20" />
    </handling_type>
    <handling_type name="low">
    <corneringAccelerationCoefficent float="0.25" />
    </handling_type>
    <handling_type name="mid">
    <corneringAccelerationCoefficent float="0.15" />
    </handling_type>
    <handling_type name="high">
    <corneringAccelerationCoefficent float="0.50" />
    </handling_type>
    <handling_type name="vhigh">
    <corneringAccelerationCoefficent float="0.35" />
    </handling_type>

    Tracks with Mid handling type:
    melbourne, catalunya, istanbul, montreal, hockenheim, hungaroring, brazil, nurburgring

    Tracks with Lowhandling type:
    sepang, shanghai, silverstone, spa, singapore, suzuka, korea, abu dhabi, delhi

    Tracks with vHigh handling type:
    Monaco

    Tracks with vLow handling type:
    Monza

    Tracks with High handling type:
    Valencia


    3. Race Starts

    I just know this, I have never used it.

    Open "ai_choreographer"

    The values under Race discipline!

    race_start_factor_1="0.01" race_start_factor_2="0.0" race_start_factor_3="0.02" race_start_factor_4="0.02" race_start_factor_5="0.5"

    Changing this will improve race starts (not first corners, only the starts) or more likely if you don't do it correctly, it will ruin their race starts. :D


    4. Database

    Now.. There are a LOT of things that you can change here. I'm getting tired of writing all of this, so I'll stick with the most important.


    ai_driver tab.

    You can see a lot of things there. Aggression, Mechanical Failures, Speed_In, Speed_Out, Virtual Performance.

    All of these have a maximum value of "1.0". Making it over 1.0 will result in the game reading it as "1.0".

    I don't think I should explain everything around this tab as it's pretty clear.


    ai_tier_characteristics tab.

    Now, firstly.. I'll write the default Tiers of the teams.

    Tier 1 - RBR, McLaren, Ferrari
    Tier 2 - Mercedes GP, Renault
    Tier 3 - Sauber, Toro Rosso
    Tier 4 - Force India, Williams
    Tier 5 - Lotus, Virgin, HRT

    If you make the tier 2 values to "0.2" - they will be very, very, very slow. If you make it to "1.0" - they will fight for the win with RBR, McLaren and Ferrari. It's as simple as that. I've used this to speed up the backmarkers.


    f1drivers tab.

    I'm including this tab only because of one thing. There are many people complaining that they don't like their team mates. I mean, when they join a team. For example Williams, the game gives them Barrichelo as a team mate.. But they don't like him and they want Maldonado. You can make the game give you Maldonado as a team mate when you go to "stats_driver_level" and make Maldonado's driver level, higher than Barrichelo's.


    f1teams tab.

    You can balance the team's performance from here. There are 2 ways to do it:
    1) Change their tier.
    2) Change their virtual performance.

    NEVER! I mean.. NEVER!!!! touch anything under "short_name" , "boss_firstname" , "boss_surname" , "billboard_texture_id"!!

    track_model tab.

    Just look what information you can change here. It's quite too long and it's pretty easy to understand (as everything about the database).

    5. How to start with the Top Teams.

    Firstly, I don't like this. I've always wanted to start with the slowest team possible and this just messes up the game a lot.

    You read about the team's tiers above. Well the game gives you the Tier 5 and Tier 4 teams to choose from when you begin your career. You can turn around the team's tiers. Make RBR, McLaren, Ferrari Tier 5 and Lotus, Virgin, HRT - Tier 1. After that you can simply turn around the Tier_characteristics so the Tier 5 teams are the fastest. You can turn around the objectives. And maybe a lots of other things that I'm forgetting. The stupid thing is that next year, your team will gradate to "Tier 4". Your team mate will get slower. And year after year, the team which is "progressing" will get slower and slower..

    6. How to make the AI faster.

    You can make the AI faster by adjusting it track-by-track. It takes a lot of time, a lot of nervs and it's not a fun thing to do. Just open ==> game root folder ==>tracks=>circuits=>melbourne (for example..)==> route_0==>ai_vehicle_track

    Now you can see a lot of lines. You'll have to experiment a little with them till you fully understand how everything works.

    You can see that there are:


    <brake_line id="0">
    <brake_line id="10">
    <brake_line id="15">

    This is the corner's ID. When it starts with "9" in front, for example like this one:

    <brake_line id="990">

    This means that this is only for the FIRST LAP OF THE RACE.

    Now, the values you'll be changing on corners are just 2.

    distance_modifier & curve_modifier.

    distance_modifier is for the breaking distance. For example, for me the 1st turn (break line 0) it's like this:

    distance_modifier="0.90"

    If you make it to 1.00, the AI will break a lot earlier. If you make it to 0.80, the AI won't have enough time to break and will go into the grass. You can adjust it perfectly by making it like this for example. From 0.90 to 0.89647573. There IS a limit of the numbers, but I don't think you'll reach it.

    The other value,

    curve_modifier

    It works the exact same was as distance_modifier but it regulates the speed carrying through the corner. The higher the number - the faster they'll take the corner.

    Mind that sometimes if you make the curve_modifier bigger and make the AI to break a little more earlier, you may get a better result than making it to break as late as possible. :)



    If you have any questions, feel free to ask! :)
     
    • Like Like x 14
  3. mydriaz

    mydriaz
    Premium Member

    Thank you for this very complete guide. May be I'm going to start tweaking these files step by step...​
     
  4. Kristiannn - I have to say that you are probably the most considerate and generous dude on this forum. I'm not a modder but I was always curious to know how the **** worked for this game. I'm plenty happy with your mod as I think it's probably the best it can be for such a flawed game. You should should be working for Codemasters helping them get their **** together. Your work is much appreciated. Thanks.
     
    • Like Like x 2
  5. Hehe. Thanks! :)
     
  6. This is Brilliant....Any chance this could be done with helmets.......
    I know there is a render thats been posted but it would be great.
     
    • Like Like x 1
  7. I've never done such things. I don't know how to do it. If I help someone, it's just from general knowledge. I've never tried it. Sorry. :/
     
    • Like Like x 1
  8. @kristiannn you are the star now
    and hey not only by changing tier's also making the ai_characteristics swap tier values to get them at places works
    And i got a theoretical way for Ai tier mess up at end of season
    We need to give the teams of almost equal level of bhp through out 5 seasons then we can cover the mayhem up to some extent i think
     
  9. but i can say if we use the Normal damage we can get lot more Things
     
  10. So where can i change so that DNF cars stays longer on track?
     
    • Like Like x 1
  11. i guess this one
    rtStuckTime float
    but can't say surely if it works then we can have the best chance of SC coming out
     
  12. Thanks kristiannn, great tutorial!
     
  13. I don't think is possible. I tried to make it for V1.0 but I couldn't.


    You don't think very much.. It is very close to the mind why making the BHP same for all seasons won't do the trick that good. :)
     
  14. Great Turtorial;) , but where can I download F1 2010 AI Tool Kit's converter??
     
  15. Well I open the whole tool. You can use any kind of XML to txt converter if you don't have F1 2010. :)
     
  16. @Kartik Sri Harsha

    Which one???
    <rtRetirementSpeed float="60.0" />
    <rtRetirementResetTimer float="12.0" />
    <rtStuckTime float="10.0" />
    <rtStuckDistanceSq float="4.0" />
     
  17. @kristiannn ; You have some serious talent with modding.:thumbsup:
     
    • Like Like x 1
  18. :)
     
  19. its not working with stuck time or reset timer

    @kristiannn
    How do you wanted to include? And what was the problem?
     
  20. I told you, it doesn't work. rtStuckTime - no effect. It's for something else.