app written in lua to make some small adjustments to the AI of AC/CSP
Here is version 1.0 for DumbAI (needs CSP 0.3.0 preview 212 to work , with extended physics allowed)
In short, this app overrides the AC/CSP behavior for pit stop strategies and adds a blue flag behavior.
Used in a qualifying session, DumbAI ensures that bots will go on track after waiting a random amount of time, with the softest tyres compounds and fuel for only 5 laps, to perform a 3-4 laps run. Each bot maintains this loop while the session is not over.
Used in a race session, DumbAI first performs an assessment for tyre strategy then a second one for fuel pitstop strategy, computing the amount of fuel needed for the race, estimating the number of stints needed, according to fuel_cons.ini, the size of the fuel tank, the fuel multiplier set at the start of the race and the lenght of the race.
About fuel strategy, if the fuel consumption rate is not 0, after having computed a first pitstop strategy with a starting amount of fuel at the start of the race, AI checks in "real time" its fuel level so that to stop before there is less than one lap of fuel in the car. Then it recomputes its fuel strategy according to the remaining lap count in the race. This allows bots to adjust the amount of fuel they add in the car as fuel_cons.ini is always a bit pessimistic and the DumbAI computation at the start of the race has a 10% margin (with a random variable to make bots a bit more "individuals" ).
About tyres strategy, the basic behavior is to use the user-defined default tyre compound for the race. It ensures that if raining, the bot will keep the default tyre compound once the track has dried and it has got back to pit to put slick tyres. If tyres wear has been selected by the user, the bot checks in "real time" its 4 wheels and trigger the pitstop when they wear at the same level as the level that leads to a red value in the UI of vanilla AC. Before triggering the pitstop event, the AI checks if a fuel pitstop is not expected for the near next laps so that it can wait a bit with its old tyres to merge both pitstops.
If the user has checked the "mutiple compound strategy" in the UI, AI will know it has to make a mandatory pitstop to change tyre compound during the race, whatever the conditions. In this 1.0 version, until refinement, AI just change its tyre compound at the first available pitstop (either triggered due to tyre wear, refuel or damage). If no pitstop are performed for other reason, AI will make a pitstop just before there is only 4 laps remaining in the race, to change the compound. If it has rained during the race, the alternating of slick and wet tyres is considered as conform to the rules.
If the user has also checked "alternative strategy", as in older version of the app, the bad qualified racers try to make a first run with a softer or harder compound than the others, according to user selected "default" compound. (Fuel strategy adjustments under development ;-) )
DumbAI also checks for damage during the race and triggers pitstop if front or rear body or suspension are too much damaged. AI automatically change tyres and recomputes fuel during this pitstop due to damage.
The blue flag behavior is basically the same as in older version, just a bit optimized both for computing efficience and code simplicity
I hope you'll enjoy the app. I'd like to thank x4fab for his help and for the modifications he added to the lua sdk in the last csp version, to make it possible
There are surely some bugs due to the complexity of the code and the difficulty to test for everything. Please let me know if you encounter them: if you enjoyed the app, your reports will help me to enhance it
