DumbAI

DumbAIMisc  1.0.1

  • Thread starter Thread starter ancient_3
  • 75 comments
  • 4,297 views
I ran a test to help me better understand version 1.0.

Mod: F1 1999 by SD
Track: Magny-Cours 1998 by Shin
CSP: 0.3.0-preview 212
Extended physics: Enabled

I set the race distance to 50 laps, which according to Content Manager corresponds to 209.7 km.
1769447233540.webp


I checked, and all cars have a fuel_cons.ini file with the same values:
1769447311711.webp


Fuel consumption and fuel tank capacity are also set identically for all cars:
1769447367269.webp


However, when the race started, some drivers were able to complete the race without making a pit stop, while others were not (for example Heinz-harald Frentzen), as shown in the Race Fuel Monitor:
1769447659596.webp
1769447433517.webp


Is this how it’s supposed to be, or is it an issue?
 
Last edited:
If you have a fuel consumption of 0.85 km per L and your race is 209 km, then you need an amount of fuel of 268 L to complete the race.
With a fuel tank max capacity of 140L, in an optimal world, every AI should have something like 134L in its tank at start and should pit once to refuel for 134L.

But as DumbAI takes a 5% margin (with a bit of randomness), it will compute around an estimation of 281L to complete the race, and here we are at the limit of the fuel tank. So this is a special case :)

The AI that had the random number more optimistic will keep just under the cut and will fill the tank with values close to 140 and make one pit stop. The others that had a more pessimistic random number will be over the 280L limit and then will have to plan 2 pitstops, for example, if they computed 285L to complete the race , they will have 3 stints with 95L at start of each stint.

Not sure what Race Fuel Monitor is displaying. The app shows the result of DumbAI spamming (999999) for LTC (Laps to Complete) but I'm not sure DumbAI replace the values that have been computed for fuel, I had to make Dumb AI spam.

To check what happens with DumbAI:

go to the file bot.lua which is in the "structures" folder in the DumbAI app folder, and there, you can modify lines 229, 230 and 231 of the files from:
--ac.log(ac_name.." laps_to_stop "..table.concat(this.laps_to_stop,", "))
--ac.log(ac_name.." fuel_strat = "..table.concat(this.fuel_after_pit,", "))
--ac.log(ac_name.." real car fuel = "..ac.getCar(this.ac_id).fuel)
to
ac.log(ac_name.." laps_to_stop "..table.concat(this.laps_to_stop,", "))
ac.log(ac_name.." fuel_strat = "..table.concat(this.fuel_after_pit,", "))
ac.log(ac_name.." real car fuel = "..ac.getCar(this.ac_id).fuel)

then save the file and launch the race.

Open the lua debug app and here in the debug area of the app, it will display before the start of the race, for each bot, how much fuel is in the tank at start and how many pit stops are expected. You'll see different values that have been computed each time you have changed items of the DumbAI (every thing is recomputed according to the new options you selected and then displayed in the debug). As there is a little randomization in the computation of the fuel strategy, you'll have some slight differences between the tables that are displayed (mostly because AC do not modify things coming from lua exactly at the same time, according to how you have coded the modificaitons) but you'll get the picture and when the lights go green, the last value displayed is what the car has really inside of it.

If you want to see the amount of fuel in the AIs in real time, you can also modify line 260 from the same bot.lua file from
--ac.log(ac_name.." real car fuel = "..ac.getCar(this.ac_id).fuel)
to
ac.log(ac_name.." real car fuel = "..ac.getCar(this.ac_id).fuel)
and then the AI will spam the lua debug area with its fuel amount at each update of the DumbAI app
 
Last edited:
I made some approximations in my last post so I'll give a complete simple accurate example with Kunos car and Kunos track here:

Suppose you want to race 50 laps of Monza with a Lambo Huracan GT3.
The track is 5755 meters long so your race is 287.75 km.

Lambo GT3:
Max fuel tank is 120 L
Fuel consumption rate in fuel_cons ini is 1.684336 km/L

Margin and DumbAI randomness is applied to Fuel Consumption rate (not to the fuel amount at the end of computation as I mistaked in my earlier post, bad memory sorry).

Margin is 10% and randomness is +/- 5% around this margin value, hence final margin is somewhere between 0.85 and 0.95.

So the final range of fuel consumption rate is somewhere between 1.6 km/L (optimistic margin) and 1.43168 km/L (pessimistic margin)

The fuel needed for the race is then between 179.84 L (optimistic) and 201 L (pessimistic).

Considering the tank is 120L max, every bots will compute 2 stints with 89.92 L for the most optimistic and 100.5 for the most pessimistic. None of the bots should be outside this range.

If I modify the code accordingly to my previous post for lines 229, 230 and 231, I have those results in the debug:
Conrad Gingras laps_to_stop 25
Conrad Gingras fuel_strat = 98.118230534831, 98.118230534831
Conrad Gingras real car fuel = 114.80410003662

And here you see what I meant, the amount of fuel in the car is not assessed correctly by lua when called just after the modification by DumbAI.

But if I add the modification of line 260, then you will see in the spamming in the debug that:
Conrad Gingras real car fuel = 98.108993530273

It has been updated and is correctly accessed by the lua app now. When the race starts, the bot starts with the correct amount of fuel computed by DumbAI.

I hope you enjoyed this small ride in the marvelous world of AC hacking in lua ;)
 
Last edited:
I ran a test to help me better understand version 1.0.

Mod: F1 1999 by SD
Track: Magny-Cours 1998 by Shin
CSP: 0.3.0-preview 212
Extended physics: Enabled

I set the race distance to 50 laps, which according to Content Manager corresponds to 209.7 km.
View attachment 1509040

I checked, and all cars have a fuel_cons.ini file with the same values:
View attachment 1509042

Fuel consumption and fuel tank capacity are also set identically for all cars:
View attachment 1509043

However, when the race started, some drivers were able to complete the race without making a pit stop, while others were not (for example Heinz-harald Frentzen), as shown in the Race Fuel Monitor:
View attachment 1509045View attachment 1509044

Is this how it’s supposed to be, or is it an issue?
Making the same computation by hand as in the previous post, here you should end with either:
  • most AI that expect 2 stints (1 pit stop) with between 129 and 140L in the tank at start
  • a few AI that expect 3 stints (2 pit stops) with between 93.33L and 96.15L at start

Your values look close but some of them are out of the range, I'm not sure why, let me know if you check with DumbAI debug what you obtain :)
 
Last edited:
Hey ive been trying out the mod and on 3.0preview212 the race and practice works fine but the cars wouldnt leave the pits in quailfying. So i tried other csp versions and 2.12preview1, 3.0preview120, and 3.0preview132 all work fine.
 
Thank you for the report, this is a nasty bug. I made some changes and they are now able to start the qualifying but not able to go out of pits after the first qualifying run.If it works during race session, likely it is due to a change in the way qualifying session is handled that impacts one of the lua function but can't figure which one until now, sorry. I'll update when I find.
 
Last edited:
Thank you for the report, this is a nasty bug. I made some changes and they are now able to start the qualifying but not able to go out of pits after the first qualifying run.If it works during race session, likely it is due to a change in the way qualifying session is handled that impacts one of the lua function but can't figure which one until now, sorry. I'll update when I find.
Thanks. If this helps the ai dont even leave the pits. They just jump for like a minute then stop and turn there wheel while revving
Still a great app watching the ai fight alot more is so fun
 
Thanks. If this helps the ai dont even leave the pits. They just jump for like a minute then stop and turn there wheel while revving
Still a great app watching the ai fight alot more is so fun
Let me know if the new 1.0.1 version works for you. I tested it with several configurations (both Kunos / not Kunos cars/tracks) and it seems to work now, if you accept a small bot stuttering when they are released from pits ;-)
 
I works! Most of the ai do a bunch of hops before leaving the pits which is very funny. Do you have any plans to add a save button while in the pits so when i switch tracks it saves what i had before?
 
I works! Most of the ai do a bunch of hops before leaving the pits which is very funny. Do you have any plans to add a save button while in the pits so when i switch tracks it saves what i had before?
My small trick is unfortunately not enough for some mods (for example AC Legends 60's in Autosport Speedway track still bumping without starting), still have some refinement to find...

What do you mean by saving while in the pits ? The app parameters or something else ?
 
For the saving stuff just anything in the settings. like the "Ai Caution" i lower to .5 bc i want the hypercars to be more aggressive when passing gt3s. but everytime i load in its at .6. It would be great to not have to change it and restart every time i do a new session.

I do have a question. What does the Lateral offset do?

Also after doing a bit more testing i have found that when leaving a replay all the ai slam the brakes and stop turning
 
For the saving stuff just anything in the settings. like the "Ai Caution" i lower to .5 bc i want the hypercars to be more aggressive when passing gt3s. but everytime i load in its at .6. It would be great to not have to change it and restart every time i do a new session.

I do have a question. What does the Lateral offset do?

Also after doing a bit more testing i have found that when leaving a replay all the ai slam the brakes and stop turning
Oh OK I see. Yes I plan to make a kind of savefile system in a future update.

Lateral offset is the amount of lateral move that is applied to the outlapped bot when it is overtaken by a leader.

I do not experience so much with replay, I found it produced strange things if looked during the race. I keep limited to looking at them once saved and after the race so I can't help you much on this...
 
Last edited:
ok so after some more testing in qualifying the game just freezes after a random amount of time at Road America by Lilski and Daytona 2026 by JohnR with 51 cars. Now when i say freezes all the cars stop moving and the time keeps going. Also the United Racing Design cars have a problem passing. Some times they will just hit the car infront of them instead of passing them. The main issue is when doing muiltclass racing and the GTP kills a gt3 on a striaght. I didnt change any of the settings so make sure i didnt brake something. This is all on 3.0preview212. The freezing issue and the replay issue seems to not be a issue in 3.0preview132 but the URD cars still hit the car infront
 

Latest Posts

Back