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. 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".
<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.
<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.
0. Introducing
To make a good AI Mod, you'll need:
- A program that converts XML to txt. I usually use F1 2010 AI Tool Kit's converter, as it's the easiest for me.
- Ryder's database editor
- (Optional) Ryder's language editor
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".
<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.
<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.