Jump to content


* * * * * 1 votes

Adjusting AI Speeds


  • Please log in to reply
14 replies to this topic

#1 npattinson - guest

npattinson - guest
  • Guests

Posted Apr 04 2009 - 05:00 PM

My intention in this post is to give you enough information to enable you to tailor AI speeds how you wish. This will work both for the original GPL and for mods - the same process works for both. With this information, you should be able to -

Make the AI faster or slower in general.
Make the AI faster or slower at one particular track.
Adjust the spread of the AI times, producing either a tightly bunched field, or one that's quite spread out.

One disclaimer - I'm a slow driver, consequently my experience is with slowing the AI down, not speeding it up. It's possible some things don't work quite as described if your aim is to speed up the AI.

When I talk about altering certain files, I'll use their original GPL names. The mods all have their own versions of these files, generally with a two character code representing the mod appearing somewhere within the file name. For track.ini, there may or may not be a track.ini file designed  explicitly for the mod you're running. If there isn't, the standard track.ini is used. For driver.ini, some mods have separate driver.ini files for each race that occurred within the championship - these files exist within the track directories and override the normal driver.ini at that track only.

The first concept that needs to be understood is normalized player time, or npt for short. This is a measurement of the skill of the player, with 1.0 representing a par rating. Note that 1.0 should not be interpreted as 'average' - you need to be a very good driver to achieve a 1.0 rating. If you're even better than that, your rating will be less than 1.0 . However most of us will be slower than that, and will have ratings greater than 1.0 .

I don't know the precise details of how the rating is calculated, but conceptually it's done by comparing your lap times at a particular track with the reference_value in track.ini, reference_value being a lap time in seconds, probably representing par. Information on what lap times you've done is stored in the player.sts file in your player directory.

GPL's default behaviour is to adjust the speed of the AI in parallel with your ability - the quicker you are, the quicker the AI will go. However, again by default, it doesn't do this quite the way you might expect, I'll go into the details later.

There are two values in gpl_ai.ini that relate to normalized player time. startup_npt is the rating that GPL uses when you create a new player - at this point you don't have any recorded lap times, so GPL can't calculate npt in the normal fashion. GPL shipped with a value of 1.20 for startup_npt. 1.20 represents an exceptionally slow driver - I'm one of the world's worst GPL drivers, and I guess my rating to be about 1.15. For the mods we generally set startup_npt to 1.05, since most people installing the mod will already be experienced and skillful GPL drivers.

The second value in gpl_ai.ini is npt_override - this is the most important value we will look at. It serves two different purposes, which makes it slightly confusing. Firstly I said that GPL normally adjusts the AI to match your speed - this is true when npt_override is set to 0.0, which is the default value. However if npt_override is set to anything else, when determining AI speed GPL uses the npt_override value instead of your npt rating. This gives you a direct way to control the overall AI speed. The useful range of values is probably around 0.80 - 1.20, beyond that the AI will be insanely fast or stupidly slow. Note also that when npt_override is not 0.0 the player.sts file becomes irrelevant. This is handy since the player.sts file seems to be quite susceptible to corruption with bad lap times. Also for add-on tracks the reference_value may not be set well, resulting in inaccurate values. You'll have more control over AI speeds if you set npt_override to something other than 0.0 .

I believe the AI Speed field in GEM+ sets npt_override in gpl_ai.ini.

So if all you want to do is speed up or slow down the AI overall, this is all you need - set npt_override to an appropriate value, though of course you may need to do some experimentation to find what that value is. Once you've found a value that works for you for one mod, you should be able to use the same value in other mods with approximately similar results.

The next problem you may encounter is that the AI might be too slow or too fast at one particular track. This is easy to fix, just adjust the dlong_speed_adj_coeff value in track.ini . Higher values make the AI quicker, lower slower. These values are normally 1.0 or above, but if you need to set one lower than 1.0 that should still work. If you want to make the AI 1% quicker, I suspect in general you'd need to multiply the value by about 1.015, but really you'll need to experiment.

If you want to adjust speeds for a mod at a track that doesn't have a mod-specific track.ini you're a little bit stuck. Don't just make a copy of the track.ini with the right name - the AI fuel loads, dlong_speed_maximum and reference_value will be wrong. The mod would make adjustments to these values when loading track.ini itself, but will not do so when loading a mod-specific track.ini. The best approach is probably just to temporarily alter dlong_speed_adj_coeff in track.ini itself, then set it back once your race has finished. Of course it's possible that the adjusted value would work perfectly well in 67 and other mods anyway.

For add-on tracks I'm assuming that the AI are already running relatively sensibly. If the AI are currently behaving strangely or are very slow or very fast, that's almost certainly a problem with the .lp files, and won't be fixable via track.ini .

Finally, trickiest of all is controlling the field spread. For this we need to understand two values in driver.ini - hype and global_hype_scaling.

hype is the main measure of an AI driver's skill - you can think of it as being similar to normalized player time, except that confusingly it's the other way around, more skillful AI drivers have higher hype ratings. They tend to fall in the range 1.05 - 0.95, though some less skillful drivers may have even lower ratings. Since this is the primary way of controlling the speed of an AI driver, the rating also encompasses other things. For instance many privateers drove one or even two year old cars, but in terms of GPL physics they'll effectively be driving brand new works cars. Hence their hype values need to be set lower to produce realistic lap times.

The hype rating is used directly when the normalized player time (or npt_override) is 1.0 . When npt is any other value, some scaling of the hype value takes place; this is how GPL adjusts AI speeds to match your own. This is where global_hype_scaling comes in, it controls the amount of scaling applied to each driver. A value of 1.0 represents the full amount of scaling, a value of 0.0 would mean no scaling took place. So for instance if all the global_hype_scaling values were 0.0, the AI would always run at the same speed regardless of npt.

I think if you're running Grand Prix level races, if all the global_hype_scaling values were 1.0, the AI field speeds should adjust in parallel to npt. So if over time you reduce your laptimes by 1.0%, the AI field as a whole should do the same. I believe more scaling is applied at the lower race levels (Novice/Intermediate), so if you're running at those levels global_hype_scaling values of 1.0 might be too high.

In its original configuration, GPL was set up with minimal hype scaling for the quicker drivers (Clark's was 0.05), increasing through the field up to 1.0 for some of the slower drivers.  We've followed this general scheme in the mods. The result of that is that if you're rather unskillful, the front end of the AI field will still run quickly, but some of the back markers run quite slowly so that you should have a few of the AI drivers doing similar times to your own.

A lot of people don't like how this works however, particularly those that want to be competing at the front end of the race. The simplest thing to do here is to make the range of global_hype_scaling values much smaller - most likely just setting them all the same. If you're running at GP level (I think Pro is the same but am unsure) setting all the global_hype_scaling values to 1.0 might work well, though you could experiment with somewhat lower values. If you're running Novice or Intermediate races, I think 1.0 will be too high, and would recommend something lower.

For the mods we've tried to produce a realistic AI spread when running with npt at 1.0 . Some of the real privateers really were quite slow, no doubt in part due to the machinery they were running. If you find that even with all the global_hype_scaling values the same the AI spread is wider than you would like, the thing to do would be to increase the hype ratings of the slowest drivers.

Hopefully this will have helped you get the AI running how you want. Please understand that it's not possible for us to deliver the mods in such a way that it runs out of the box exactly how you want - there is a wide range of skills among GPL drivers, and also different tastes in how they want the AI speeds to be. Instead what we aim for is that whatever you have done to tailor you 67 AI should also work reasonably well for the mods.

Nigel

Edited by npattinson, Apr 05 2009 - 03:25 PM.


#2 pirenzo

pirenzo

    TwoPedalsOneFoot

  • Staff Crew
  • 2,091 posts
  • Gender:Male
  • Location:Birmingham, UK
  • Interests:GPL (of course), rock and progressive/experimental rock.
    Enjoy many motorsports as well as football and a passing interest in a dozen other sports as well.
  • Sim interest:GPL

Posted Apr 04 2009 - 09:11 PM

A very useful post, thanks for sharing :thumbup:

I have stuck the thread to make it easier for people to find in the future

Edited by pirenzo, Apr 04 2009 - 09:12 PM.


#3 FloP

FloP

    Denny Hulme

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 602 posts
  • Location:Rödermark
  • Sim interest:GPL

Posted Apr 05 2009 - 06:32 AM

I have two comments to make:

1. Player.sts. AFAIK GPL stores the last five competition laptimes here, i.e. private testing times are excluded. I don't know of any filtering mechanism that would make GPL store only your fastest times as they don't provide a good reference anyway. (I've never examined this myself, though.)

2. Missing mod-specific track.ini. If a mod-specific file is missing, GPL uses the standard file as you described. So why shouldn't I create a copy of track.ini and rename it to match any mod I want, so I can at least get the AI speed right? IMO there's nothing you can lose by doing this, even though it will not work perfectly of course, but neither will the original track.ini.



Other than that there is nothing I can add. You've summed up pretty much all I know perfectly!  :thumbup:

#4 Bernd Nowak

Bernd Nowak

    Denny Hulme

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,716 posts
  • Gender:Male
  • Sim interest:GPL

Posted Apr 05 2009 - 06:59 AM

Not sure about the player.sts file FloP.

I had a quick look with a hex editor and while I have been driving/testing my track project there's only the original tracks in it.

And from the place between the entries of the original tracks I assume that only the best lap time will be stored in the player.sts file. You have more entries (maybe 5 but I assume much more) in the player.ini file but even there I assume it's one time per track, session type as well as car chassis. So with GPL 67 it's 7 cars and at least 2 session types like race and practise which makes a minimum of 14 entries per track.

But Nigel for sure will know it better :)

#5 npattinson - guest

npattinson - guest
  • Guests

Posted Apr 05 2009 - 02:34 PM

 FloP, on Apr 6 2009, 12:32 AM, said:

1. Player.sts. AFAIK GPL stores the last five competition laptimes here, i.e. private testing times are excluded. I don't know of any filtering mechanism that would make GPL store only your fastest times as they don't provide a good reference anyway. (I've never examined this myself, though.)
Thanks, I was just guessing with the details. If it ever becomes important I can investigate what happens, but overriding npt seems like a better option anyway in general.

 FloP, on Apr 6 2009, 12:32 AM, said:

2. Missing mod-specific track.ini. If a mod-specific file is missing, GPL uses the standard file as you described. So why shouldn't I create a copy of track.ini and rename it to match any mod I want, so I can at least get the AI speed right? IMO there's nothing you can lose by doing this, even though it will not work perfectly of course, but neither will the original track.ini.
I should have explained a little more - the mods do different things depending on whether or not a mod-specific track.ini is present. If one is present, the values in it are used directly. However if one is not present, some values  (AI fuel loads, dlong_speed_maximum and reference_value to be precise) are adjusted before taking effect. So if you want to make a copy of track.ini for a mod, you need to sort those values out, otherwise the result will be worse than simply not having the mod-specific track.ini .

Nigel

P.S. I've made some small adjustments to the first post to remove the disinformation and clarify the mod-specific track.ini situation.

Edited by npattinson, Apr 05 2009 - 03:26 PM.


#6 dbell84

dbell84

    Dan Gurney For President

  • Supporter
  • PipPipPipPipPipPipPipPipPipPip
  • 921 posts
  • Gender:Male
  • Location:20 minutes from Road Atlanta
  • Interests:Whatever
  • Sim interest:GPL

Posted Apr 06 2009 - 07:34 AM

Great post.  There seems to be a lot of useful information there that I've been looking for.  When I get a chance I'm going to try to use this as a guide to adjust my AI at a couple of tracks where I'm not as competetive as I'd like to be.

Thanks for taking the time to share this Nigel.    :thumbup:


Dave

#7 stuboyle

stuboyle

    Stuart Boyle

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 160 posts
  • Gender:Male
  • Sim interest:GPL

Posted Apr 21 2009 - 11:36 AM

I think we need to take this info and add it to a Wiki.

#8 miklkit

miklkit

    airhead

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,137 posts
  • Gender:Male
  • Location:left coast, U.S.A.
  • Interests:GPL
  • Sim interest:GPL

Posted Nov 03 2009 - 09:06 PM

Just wondering if it is possible to adjust the ai top speed independent of cornering or acceleration.  And is it possible to do this for one track only.  The ai I'm using now, 60fpsaiv1, do everything well except for top speed.  making them faster overall increases their cornering speed more than their top speed.  In some places they actually slow down when they get on a long straight.

#9 grego

grego

    confuzius

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:new zealand
  • Interests:motorbikes, petanque, philosophy,
    psychology, GPL
  • Sim interest:GPL

Posted Nov 04 2009 - 04:27 AM

i have been trying to adjust ai speeds using npt_override for a few weeks .
After finding a "sweetspot",  aka a figure that made me work very hard and if i drove well i did great battles "upfront", I kinda "locked it in.
I am only driving the 65 mod and only on 3 tracks. What i seem to experience is of cause completely absurd but while my laptimes seem to be consistant, the AI driver speed seem to be different every time I switch GPL on .
Is this phenomenon known ?
Has it maybe simply got something to do with my pc?
Or,   is it just happening inside my mind ?????? :lol:

I add,  that it is quite extreme eg I might well go up the hill at the Glen at the same speed as the 2 fast AI's but sometimes we keep the same speed on the straight and sometimes the AI's take off like they pressed the turbo button....................................

#10 ginetto

ginetto

    GPL track editor

  • Administrators
  • PipPipPipPipPipPipPipPipPipPip
  • 2,816 posts
  • Gender:Male
  • Location:Lombardia, Italia
  • Interests:Mountain
  • Sim interest:GPL

Posted Nov 04 2009 - 04:55 AM

 miklkit, on Nov 4 2009, 04:06 AM, said:

Just wondering if it is possible to adjust the ai top speed independent of cornering or acceleration.  And is it possible to do this for one track only.  The ai I'm using now, 60fpsaiv1, do everything well except for top speed.  making them faster overall increases their cornering speed more than their top speed.  In some places they actually slow down when they get on a long straight.
In track.ini of every track there is a line that looks like this:

Quote

dlong_speed_maximum = 2.000000           ; max. dlong speed (meters/tick) for .LP after all modifiers (e.g., dlong_speed_adj_coeff)

1 equals to 80 Mph so, with some math, you should adjust the top speed as you like.
remember that might be mods that have their own ini so take a look at the track directory and change the file that you need.
:wave:

#11 FloP

FloP

    Denny Hulme

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 602 posts
  • Location:Rödermark
  • Sim interest:GPL

Posted Nov 04 2009 - 08:17 AM

 Ginetto, on Nov 4 2009, 11:55 AM, said:

In track.ini of every track there is a line that looks like this:

Quote

dlong_speed_maximum = 2.000000           ; max. dlong speed (meters/tick) for .LP after all modifiers (e.g., dlong_speed_adj_coeff)

1 equals to 80 Mph so, with some math, you should adjust the top speed as you like.

... or 129.6 kph. ;) However, this seems to be different in 60 fps, i.e. the 60 fps top speed is only 36/60 times the 36 fps top speed. If you increase the dlong_speed_maximum by a factor of 60/36 (= 1.6), the AI drivers should have the same top speed as previously with 36 fps.  :2c:

#12 miklkit

miklkit

    airhead

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,137 posts
  • Gender:Male
  • Location:left coast, U.S.A.
  • Interests:GPL
  • Sim interest:GPL

Posted Nov 04 2009 - 09:42 AM

Thanks gents.   :thumbup:

Mexico is now a 60fps only track for me because 36fps is simply too blurry with all of the goodies out there.  Different years behave differently, but this is a year specific track so there is reason to believe it can be tailored just right for each.  Will report back after the math is done.  

Grego:  I have no idea why the ai should be inconsistent.  Their lap times vary some, but not very much.


update:  I changed the dlong_speed_maximum in the track66.ini in increments with very little results.  Ended up with it at 3000.000000.  The ai would leave the pits and rocket away passing me with ease.  Then they would slam on the brakes.  Something happens at the s/f line. They will accelerate out of the last turn until they hit the line and then slow down.

Edited by miklkit, Nov 04 2009 - 02:12 PM.


#13 FloP

FloP

    Denny Hulme

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 602 posts
  • Location:Rödermark
  • Sim interest:GPL

Posted Nov 04 2009 - 04:03 PM

Ultimately, the dlong_speed_maximum is just that, a limit that GPL imposes on the AI drivers. As long as they don't reach it through all those different parameters in driver.ini, gpl_ai.ini, track.ini and the .lps, it doesn't have any effect. Even though, my assumption is that what you report is a result of a start/finish mismatch in the .lp that also exists with 36 fps. It might just be less obvious.

#14 Sid

Sid

    An unlapsed lapsed GPLer

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 100 posts
  • Gender:Male
  • Location:5 miles from Brooklands
  • Interests:Only the 55 mod will tempt me back onto the track.
    Update: The 55 mod has tempted me back onto the track.
  • Sim interest:GPL

Posted Dec 05 2009 - 12:28 PM

I've just had a full GP race against the AI using the 66 mod at Brands Hatch. I usually try to set them to go at the historic speeds (at least for the front runners) and/or make the race last the same amount of time (within a couple of minutes... the actual race lasted 2hrs11mins, mine lasted 2hrs13mins)).
So all's fine and dandy, everyone's going the right speed except that when they enter the pits they slow right down to 16 mph! They do this right in the middle of the last bend, so it's a bit disconcerting to come flying round the bend to have this in front of you.
Is there any way of speeding them up at that point?

#15 MECH

MECH

    Double poly killer

  • Administrators
  • PipPipPipPipPipPipPipPipPipPip
  • 2,408 posts
  • Gender:Male
  • Location:Here ->
  • Interests:My Girlfriend
  • Sim interest:GPL

Posted Jun 04 2010 - 04:49 AM

 Sid, on Dec 05 2009 - 12:28 PM, said:

I've just had a full GP race against the AI using the 66 mod at Brands Hatch. I usually try to set them to go at the historic speeds (at least for the front runners) and/or make the race last the same amount of time (within a couple of minutes... the actual race lasted 2hrs11mins, mine lasted 2hrs13mins)).
So all's fine and dandy, everyone's going the right speed except that when they enter the pits they slow right down to 16 mph! They do this right in the middle of the last bend, so it's a bit disconcerting to come flying round the bend to have this in front of you.
Is there any way of speeding them up at that point?

Yes, by creating a new pit.lp where the pit entering speed is kept high untill driving into the pitlane it self.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Sim Racing Links