January 23, 2018, 07:40:37 AM
bigger smaller reset 800px Wide width Full width Reset * *

NRTracks

 
Welcome, Guest. Please login or register.

Login with username, password and session length
« previous next »
Pages: [1] Go Down Print
Author Topic: AI Adjustments  (Read 4954 times)
Lyndon
Administrator
Sr. Member
*****
Posts: 147



WWW
« on: October 29, 2010, 03:08:03 PM »

A link to the original article by fortine_oo .  Some of these links were misplaced by recent site changes but the files are still there.

Making AI Adjustments For A Human Condition

Quote fortine_oo:
The information that I had based my work on was becoming more than I could recall offhand, so I compiled a file that I could refer to when needed.
I never intended for it to be a public release, but Lyndon wished to put it on his website, so I cleaned it up a little and that is what you'll find at the link.

Update:
I have simplified the information and posted a new tutorial below.
fortine_oo

« Last Edit: December 14, 2017, 12:24:46 AM by fortine_oo » Logged
fortine_oo
Legacy
Sr. Member
*****
Posts: 188



« Reply #1 on: July 07, 2013, 10:30:56 PM »

ai Development Tutorial
Track.ini Adjustments

Successful ai are made up of a gazillion properly executed little details rather than some bright idea demon tweak or radical notion that's going to turn the whole simworld upside down and set fire to it in the bargain..
     [...with apology to BS Levy.]


This tutorial is for developing ai that act like you hope a human would in an online race.
The ai traits should yield close racing with minimal incidents/accidents, passing at appropiate areas, and ai vehicle characteristics comparable to the Player.

The disclaimer:
1. Most of NR2003's adjustable features, the track.ini, the lp's, the fast setup, the ai ratings, and some options (such as Opponent Strength), are not
       applied in isolation but are interacting and interdependent with each other and the exe. In order to maintain the ai's laptimes, when you change
       something, you may have to adjust a track.ini parameter to compensate for the change.
2. The ai are not subject to the same physical properties as the Player.
    The exe is designed to keep the ai on the track and moving foward. The ai do not drift, they track until their grip limit is reached and then
       slide off the track. Occasionally the ai will encounter a loose condition (free rearend) and then re-acquire enough grip, but instead of spinning
       the ai will only lose momentum before continuing foward.


Preliminary Requirements:
1. Though it isn't be covered here, if you're working on a new track (or doing a complete makeover of an existing track) you'll need to address
       the [ track ] or [ track_(series) ] values before beginning any ai work.
    See: How To Develop ai (a SHORT COURSE), PART 1 @NRTracks
2. Though it isn't be covered here, if you're working on a new track (or doing a complete makeover of an existing track) you'll need to address
       the lp's before beginning any ai work. You'll want a good race.lp so you can get close to the proper values for [ track_ai ] ai_drag_modifier and
       ai_grip_modifier before fine tuning the other track.ini parameters.
    See: How To Develop ai (a SHORT COURSE), PART 2 @NRTracks
3. Before proceeding with the [ track_ai ] values, have a roster of ai opponents (2 - 6), for which you can predict their capabilities (laptimes and driving
       ability) on a known tracks. That's a track where you know what YOU can do, and what the ai can do.
    Ideally, you'll want 1 or 2 ai that run laptimes equivalent to yours on a known track. This will allow you to evaluate the effectiveness of [ track_ai ] values
       because you'll know how you're running versus the ai.
    I include an ai that has 100 ratings (min and max). This provides a quick read to see the effects of changes you make. A bonus, so to speak,
       if you're as fast or faster than the 100 guy, you obviously need some major track.ini changes.
    See also: How To Develop ai (a SHORT COURSE), PART 3 @NRTracks, and AI Driver Ratings @NRTracks
    Note: When the track characteristics compel the ai to race in close proximity to each other, an ai with less than a 50 minimum value in the
                ratings categories DRIVER/TRACK TYPE, DRIVER/CONSISTENCY, and VEHICLE/CHASSIS will be significantly predisposed
                to causing an accident when the exe selects/applies that rating at less than 50.
            The racing results of these subpar catagories will cause unnecessary tweaks to track.ini parameters to try and overcome the crashfest.
4. Establish a fast.(series).sim setup.
    This may be a setup from another (similar) track or a copy of the setup you've developed for the track. Sometimes one is appreciabely faster than the
       other. Trying the ai with different setups and then comparing the resulting laptimes is the only way to determine the best "fast" setup.
    The ai don't always react positively to a "real" setup. The ai tend to work best with a "generic" setup, tending toward medium to soft springs and mild
       bar stiffness. Degrees of wing doesn't seem to have as much of a grip influence for the ai as it does for the Player, but it does have a substantial
       affect on the ai's top speed.
    Gearing should be the same as the Player, or a little higher. If the ai are a little quicker getting up to speed than the Player on starts/restarts, it's
       easier to equalize the baseline ai and the Player with (setup) gearing before adjusting the "[ ai_track_(series) ] ai_accel_modifier and ai_drag_modifier"
       parameters.
    See also: How To Develop ai (a SHORT COURSE), PART 4 @NRTracks
5. The [ track ] and [ ai_track ] sections will be applied to any series/mod that does not have its own sections ([ track_(series) ] or [ ai_track_(series) ])
       in the track.ini.
    If there is a line (parameter) in the [ track ] or [ ai_track ] sections and the same line is not in the series/mod specific section(s) ([ track_(series) ] or
       [ ai_track_(series) ]), the value of that line (parameter) in the cup section will be applied to the series/mod.
6. Be vigilant to the heat generated in tires. If there isn't enough tire heat, the available grip won't be utilized and all the tweaking in the world won't
       provide good racing experience. If your tires are too hot, you won't be as fast as possible and you'll be handicapping the ai when you tweak the
       track.ini.
    Keep the tire heat just out of the red for the hottest tire. You'll want the tire temp (on the hottest tire) to be 200 - 210F the maximum amount of time
       during a lap. Long, fast straights raise tire temps dramatically, so it's okay if the temp exceeds 220 as long as it drops back to 210 or less fairly quickly
       (or at least before you really need the tires to work at full capacity). Very long straights raise the tire heat, the optimal tire heat value may have to
       be reduced to compensate for this circumstance.
7. It's a good idea to set the NR2003 Race (page)/Weather/Temperature: 70 F.

There are two types of track.ini sections:
   1) Applicable to both the Player and the ai, [ track ] for cup and any other series that doesn't have its own section, and [ track_(series) ].
          (Hereafter, [ track ] will be used to convey the cup series as well as the other series [ track_(series) ].)
          These parameters are set to accommodate the Player, as determined by the track creator's vision of racing conditions, and therefore will not
             be addressed here.
       See: How To Develop ai (a SHORT COURSE), PART 1 @NRTracks
   2) Applicable to the ai only, [ ai_track ] for cup and any other series that doesn't have its own section, and [ ai_track_(series) ].
          (Hereafter, [ ai_track ] will be used to convey the cup series ai as well as the other series ai [ ai_track_(series) ].)
          These parameters are set to fine tune the ai's use of the track's configuration, the [ track ] parameters, the lp's, and the exe's inherent tendencies.


continue below >
« Last Edit: July 28, 2013, 10:19:04 PM by fortine_oo » Logged
fortine_oo
Legacy
Sr. Member
*****
Posts: 188



« Reply #2 on: July 07, 2013, 11:02:02 PM »

[ ai_track ]:

Major Adjustments
1. ai_drag_modifier =
    This value will determine the ai's top speed.
    Determine your top speed on the longest straight when you're not in a drafting situation.
    Set the value so the ai is plus 1 or 2 mph faster than you when the ai's not in a drafting situation.
    Determine this value first, i.e. before you start adjusting the ai_grip_modifier. You may have to tweak it a little after
       you dial in the ai_grip_modifier, but a close ai_drag_modifier will lead to the correct ai_grip_modifier value faster.
    Start at 1.00. Whether you have to decrease or increase the value will depend on the race.lp, the ai_grip_modifier, and the series.
2. ai_grip_modifier =
    This value will determine the ai's best laptimes.
    This value will depend on what you want the ai's laptimes to be with Opponent Stength @ 100%. I set it for the laptime that I can consistently run.
       This may need to be adjusted as you become more proficient at the track or you change the race.lp.
    Start at 1.00. Whether you have to decrease or increase the value will depend on the race.lp and the series.
    This value will likely need multiple revisions as you get all the ai components dialed in.
3. ai_tire_wear_left = / ai_tire_wear_right =
    Set this value so the ai's tire wear is the same as yours, i.e. the ai's lap times increase relative to your laptimes as the tires wear.
    The left value may be different than the right value due to the type of track.
    Gtp tire wear does not degrade performance (in the course of a single fuel run), set it at 0.25-0.45.
    Pta tire wear usally does not degrade performance, but there may be a slight fall off in laptimes, usual value would be 0.35 to 0.50.
    Cup (cts,gns) definitely has tire wear and it degrades performance. There's no automatic range for this value. The value is dependent on
       the track and the tire wear values, [ track ] track_tire_wear, track_tire_wear_loss, ai_inverse_slipcurve_k.
       I try to make the player's tires just last for a fuel run (with no allowance for abuse) by adjusting the settings in the
       [ track ] track_tire_wear, track_tire_wear_loss, then tweak the ai_tire_wear_left/ ai_tire_wear_right to match my performance.
    Cts and gns is basically the same as cup, but I allow less fall off in performance than in cup since they are lighter and more nimble.
4. ai_inverse_slipcurve_k =
    Set this value so the ai break loose as easily when you bump them as you get loose when the ai bump you.
    This has the added benefit that the ai won't have a superior cornering ability over the Player (assuming the Player has some cornering skill).
    The higher the grip value(s) (track_asphalt_grip, track_concrete_grip), the lower this value will need to be.
    Too low a value will cause the ai to slide off the track in the corners.
5. ai_qual_modifier =
    This value will determine the ai's best qualifying laptime.
    Set this value to yield the qualifying laptime you want.
    I prefer to set this value so the best ai qualify at a laptime that still makes it possible for the Player to get the pole if they drive the perfect lap.
6. ai_wall_offset =
    This value will determine the ai's collision boundary.
    A value of 100 means there's immediate contact when one ai's boundary touches another ai's boundary.
    A value of 0 means there's no contact, the ai will morph through each other with no consequence.
    Values less than 100 will have some morphing, but you need to get below 20 before it's really noticeable.
    I recommend (and I use) 20. It allows for ai to ai "rubbing", visually it appears normal, and it does not completely eliminate accidents.
    When using a low value (I only have experience with a value between 8-10), rather than bumping off each other, the ai tend to
       "explode" (violently repel) upon contact.

Minor Adjustments
 1. ai_accel_modifier =
     This value will get the (best) ai to accelerate at the same rate as the Player.
     The ai are pretty good at accelerating, this value will usually be 40-55, but whatever value achieves the desired result is acceptable.
     To determine this value:
     From a corner (where there has been a throttle lift) which is followed by a long straight, pick a spot a fair distance down the straight and read the
        mph you have attained. It may help to take a reading at 2 or 3 locations down the straight.
     Read the mph attained by the ai and adjust the value so the ai is attaining the same speed as you (or 1-2 mph faster).
     Take all readings when it's not a drafting situation.
     It will be easier and more accurate to perform these readings from a replay.
     Note: This value may need to be adjusted if ai_grip_modifier is raised or lowered significantly.
 2. ai_decel_modifier =
     This value will get the (best) ai to brake at the same rate as the Player.
     The ai don't brake near as good as they accelerate. This value will usually be 80-98, but whatever value achieves the desired result is acceptable.
     To determine this value:
     This is partly a read of the ai braking while you are racing them and partly a read on the location where the ai's top speed drops as they approach a corner.
        It will be easier and more accurate to perform the speed drop readings from a replay.
     Note: This value may need to be adjusted if ai_grip_modifier is raised or lowered significantly.
     Note: Set the value for ai_dlongpad_scale before adjusting ai_decel_modifier.
 3. ai_drafting_distance =
     This value determines the distance between cars linearly, the grill of one car to the tail of the other. A value of 1.00 would be zero clearance.
     For RC's: a base value for cup would be 1.075-1.085, 1.07-1.055 for pta and GTP.
     For Ovals: probably 1.085 at a minimum to 1.1+ for Short tracks and plate tracks.
     Note: Too high a value will retard passing. Don't use a value higher than absolutely necessary to keep accidents to a minimum.
              A high value may cause the ai to checkup because they must maintain the minimum distance of clearance.
 4. ai_dlat_pad =
     This value determines the distance between cars laterally, door to door. A value of 1.00 would be zero clearance.
     The value for this parameter is not as critical as the value for ai_drafting_distance is.
     For cup, 0.85 - 0.65 should work. For pta, 0.70 - 0.55. For GTP, 0.70 - 0.45.
     Note: Too high a value will retard passing.  Don't use a value higher than absolutely necessary to keep accidents to a minimum.
 5. ai_dlongpad_scale =
     This line adds artificial braking, i.e. braking above and beyond what the race.lp indicates is necessary.
     The widely publicized definition would seem to indicate a high value is in order. The opposite is true.
     A value of 0.3 does not induce the ai to brake when it's not required by the exe and race.lp. There doesn't seem to be any improvement using a lower value.
     For certain situations there would appear to be a good reason for employing artificial (extra) braking by the ai. Example: On a RC, where a long, fast straight
         leads to a slow corner, the ai usually are able to brake significantly later than the Player. However, there is no improvement for this type corner (using a
         value greater than 0.3), but the ai will checkup early at all the other corners, so the Player will tend to run into the back of the ai at those corners.
        {The fix for this situation is different track surfaces with slightly different grip values. See:
         ai...WHAT'S THE TROUBLE, WHAT'S POSSIBLE, HOW TO DO IT/ Reply #6 / HOW TO COAX ai / Part 2 / ai run into the back of me #3}
 6. ai_panic_decel =
     This line alerts the ai that a panic situation is imminent, i.e. the ai must change course or brake to avoid running into another car.
     The widely publicized definition would seem to indicate a low(er) value is in order to help the ai panic sooner. The opposite is true.
     A value of 3 would be a starting point, but any (higher) value may be employed to keep the ai from running into trouble. The value needed depends on the track
        and each series using that track usually requires a different value. Usually a value need be no greater than something in the teens; if the ai are still running into
        cars, the problem is probably beyond fixing with this value alone.
     Note: The location of the minpanic.lp & maxpanic.lp must allow at least a half car width beyond the location of the minrace.lp & maxrace.lp to
        allow the ai room to avoid a blocked path.
 7. ai_pacing_distance =
     The distance between the cars (front to back) during a pace lap or caution lap.
     For ovals, 1.5 - 2.0, but you may be able to go as close as 1.3.
     Due to slowing for corners, the spacing for a RC may need to be a little more than it is for an oval, 2.0 - 2.5.
     There is a lot of "rubberbanding" to the pacing line on RC's because of the corners, only testing will determine an acceptable pacing separation.
 8. ai_bunching_distance =
     The distance between the cars (front to back) just prior to the start/restart of a race.
     When this value is the same as the ai_pacing_distance, the ai will maintain that distance to the drop of the green flag.
     When this value is different than the ai_pacing_distance, the ai will close up or expand the distance between the cars. This can
        cause a rubberband effect on the pacing line, sometimes that's good and sometimes it causes problems.
 9. ai_squeeze_pcnt =
     This allows the AI to deviate from the ususal constraints of the Race.lp, i.e. they'll more readily change racing lines.
     The optimal value is very track and racing series dependant. Leave it at 0.00, unless there's a definite need.
     Increase the value to encourage passing, but only do this after the best opportunities for encouraging passing have been exhausted, i.e. the location of
        the lp's and using passing sensitive values for ai_drafting_distance and ai_dlat_pad.
       {Passing can be difficult, but a top car should be able to get by a backmarker in a lap or two. A top car should get by a mid-field car in 3 - 5 laps. Two equal
        competitors will almost require a draft or a mistake by the lead car. Ai ratings Driver/Track-type is also a factor.}
     Too high a value will have the ai running into things and/or running off the track for no reason. A value of 0.05 - 0.20 shouldn't cause wild-driving problems.
        You can venture into the 1.0 - 2.0 range (at some tracks it's ok, at others it's mayhem). If your lp's are very close to a wall at the clipping point of a
        turn, the ai may run into the wall when this above 0.00. Obviously, the higher the value, the greater chance the ai will run afoul.
     The by-product of the ai trying to move off line to pass is, if the minrace and maxrace lp's aren't defining a realistic secondary race line, they'll be out of
        position to take a corner efficiently and consequently they will lose a lot of momentum and negate any chance for a (successful) pass.
     Note: At plate tracks (or any track where you never have to lift or drafting is paramount), ai_squeeze_pcnt  > 0 provides no useful benefit, in fact, it can retard passing.
10. ai_line_modifier =
     This value tells the ai the percentage grip they have relative to the actual grip value.
     At 1.00, the ai have/use 100%. Less than 1.00, the ai behave as if the grip value is less than 100%. Greater than 1.00, the ai behave as if the grip value is more
        than 100%. The actual grip level never changes, only the ai's perception/implementation of the grip level. A change of 0.01 is significant, 0.05 is major.
     If you have ai that are a little docile, or not quite as quick as you'd like, raise the value. The ai will drive like they have more grip, but the actual grip level is
        unchanged. The ai_inverse_slipcurve_k may need to be increased if you raise this value too much.
     If you have ai that are a little out of control, lower the value. The ai will drive like they have less grip, more deliberate, but the actual grip level is unchanged.
     Raising the value will lower the ai laptimes, lowering the value will increase laptimes. If you want the laptimes to remain the same, increase/decrease
        the ai_grip_modifier value.
11. ai_fuel_use =
     A value of 1.00 is "supposed" to allow the same fuel mileage as the Player.
     The only way to get this correct is to run your car out fuel and note the laps run (include quarter laps). Use 4x Pit Stop Frequency, it's quicker.
     Then get the ai to run out of fuel.
     Test the ai using 2x Pit Stop Frequency, different resuts are not unusual for 4x. In order to get the ai to run out fuel, use these values:
        strategy_lap_time_wear_loss = 0.00005
        strategy_lap_time_fuel_use_gain = 15.00
        strategy_base_pitting_cost = 240
        These "strategies" don't always keep the ai from pitting. In that case keep lowering or raising the ai_fuel_use until the ai pit on or
           about the same lap as you would need to. You can also try lowering the track_tire_wear value so the tires don't wear.
     Adjust the value (greater than 1.00 decreases fuel mileage), and test again until you get it close (not all ai get the same mileage).
12. strategy_lap_time_wear_loss = ***
     The lap time loss from totally worn tires.
     Increasing this value causes earlier pitting. If you're trying to get the ai to pit, 8-30 usually works. If you're trying to get the ai to stay out, 1.0 or 0.10 or 0.00001.
     Note: At some tracks, using a value of less than 1.00 or 1.50 may cause the ai to not change tires or only change one side (especially if one of
     the lines, ai_tire_wear_left/ai_tire_wear_right, has a lower value than the other).
13. strategy_lap_time_fuel_use_gain = ***
     The lap time gain from low fuel.
     Increasing this value causes later pitting. If you're trying to get the ai to pit, 0.0001. If you're trying to get the ai to stay out, 5-8, 17, but it's a lot trickier to get
        the ai to stay out using this parameter, so I use ( raise ) strategy_base_pitting_cost first.
14. strategy_base_pitting_cost = ***
     The time lost to a stop & go pitstop.
     A normal setting is 50.00. Increasing this value causes later pitting. Decreasing this value wil make the ai pit sooner.
     I've used 20 - 190.  240 seems to be the practical high limit, beyond that doesn't seem to impart any greater effect.
*** Use all three stategies together to get the ai to pit like the player. It's trial and error. The ai may pit differently if there's less than 24 cars than they do
if there's more than 24 cars. Depending on the track length (esp. @ roadcourses ), proper pitting for 1x Pit Stop Frequency may require different settings than
2x Pit Stop Frequency.
Each series will likely require a different set of values for fuel consumption and the strategies.
Once you've figured out the proper values for ai_fuel_use, strategy_lap_time_wear_loss, strategy_lap_time_fuel_use_gain, and strategy_base_pitting_cost
   for a specific track length, those values will probably work for another track of that length. At the very least it'll be close and getting it correct will be a lot easier.

     *****      *****     *****      *****     *****      *****     *****      *****

papy_ai.ini:
    
[My opinion Tongue, ascertained from my experience developing ai that race as close to real players as the exe will allow.]

   For all practical purpose, the original is just fine. thumbsup
   Using the papy_ai.ini as a means to get the ai to race a specific way is overkill. Most, if not all, of the perceived benefits could have been realized using the
      track.ini and lp's, and there wouldn't be so many requests to fix other tracks because of an altered papy_ai.ini.
   A long time ago, I investigated and tried a wide range of values for the lines in the [ driver ] and [ physics ] sections. The results didn't yield much (if any) of
      a different behavior that was noticeable. Because of the less than spectacular results, and because it may have negative effects on the the ai behavior at
      some tracks, I choose to not look for fixes there.

« Last Edit: July 31, 2014, 02:06:59 PM by fortine_oo » Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Powered by SMF 1.1.15 | SMF © 2006-2008, Simple Machines
Leviathan design by Bloc | XHTML | CSS