I've been thinking about the project some more, go figure, and I'm not entirely sure how to proceed. Should I focus one 1 car? If I am going to focus on a single car I'm going to aim for the LX6, even though this entire time has been spent with the XRG. I am contemplating this because there is a fair bit of these little values that pop up fairly often that need to be tweaked for a particular car: shift points, limit detectors, desired steering points, etc. Even the speed at which throttle can be cranked up or off in certain situations.
An initial part of this project was to get the artificial driver to not require this tuning and fiddling, but I don't think that is possible. Every car has different powerbands, shifting points, and even steering changes. To go around a corner with a 100ft radius in the XRG might only take 15 degrees of steering wheel input, while the same 100ft radius turn in the FOX would take 25 degrees. To make matters worse, it is also greatly influenced by the setup.
So do I abandoned the approach, or start making a table of variables that need tuning for each car? When possible I hope to have the artificial driver figure out the value himself, and the entire project I have attempted to do this: shift points are determined by looking at torqueRPM and powerRPM as I've described several times.
---
Since I started driving logic 2.0 this weekend I've also been thinking a lot on how I want to implement this logic. I've already seen the driver modify his braking points and that is pretty damn amazing. I give him over cautious braking distances and corner entry speeds, so he will start very safe and slow. Then he approaches the turn and modifies the braking point because he reaches the entry speed and still has 100 meters of braking distance before the entry. Works perfectly!
Except when it doesn't. See if he keeps modifying his braking point just like that then after 15-16 laps or so he eventually modifies it too far, and this is not a good thing because then he typically falls off the corner. So my immediate thought was to keep several points of reference for the corners. At a minimum there would be the default, safe, and risky braking points, entry speeds and all other corner information about each corner. The idea being that default never changes, it is what originally got computed. Safe is the last known very safe distance/speed/information, and risky is the one that just changed.
The risky information becomes safe after some number of laps of safely making it through the corner without issue or really breaking the limits too far. That will be tricky to code. The unfortunate thing about this is it will slow down his learning by a significant amount. Luckily what I saw with the first tests modifying the braking distance it only took about 10 to 15 laps before he went from 1:17s to 1:06s with a fairly incomplete set of driving logic.
I need to find a balance. Just modifying the value each lap is unsafe but counting safe laps before modifying the value will slow his "learning" of the track. I don't like to think of this as him learning, because he isn't really learning anything, just modifying his information about the track.
---
The other thing I've been thinking about, related to focusing on a single car or not, is whether I should modify how the driver deals with corners. A few days ago I modified his steering behavior by changing one value, instantaneous drop of 1.25 seconds per lap in most cars, finally allowing him to get closer to the racing line he created. The idea is to follow some idea of "turn points", that would belong in the corner information. Each corner would have some number of these points, about 5 or 10, which would describe the location of the racing line. Instead of finding a point on the racing line 10 meters, 50 meters or 100 meters ahead of the car, the driver would look at those 5 or 10 turn points to know where the line is in that particular corner.
This would actually be a significant change, even though the desired behavior would be very similar. This change should keep him on the racing line, at least for the most part, but would do it in a different way.
If you think of turn one at FE1, and split it into 10 sections from the entry of the turn to the exit of the turn, each section crossing perpendicular to the racing line (maybe centerline) then each of these sections would be a "turn point". Each section would contain information like:
PositionOfRacingLine This is where the driver ultimately wants the car
LeftTrackEdge The furthest to the left of the track, no more space.
RightTrackEdge Ditto for the right edge.
AimingPoint A position that the driver uses to modify the steering behavior, this is the location he attempts to steer towards
With that information I could then later add more:
PositionOfDefensiveLine
PositionOfPassingLine
... etc ...
The primary idea here would be to have the driver modify the AimingPoint of each of these corner sections / points which should make it so I don't need to modify that steering value for each car, because in theory the driver would move the AimingPoint left/right depending on how close he was to the racing line when he crossed that section, making him turn more or less next lap(s) if he was far away.
This wouldn't be very hard to write, but it would take a fair bit of time to deal with. Along the lines of this idea would be to make the driver change his logic along a straight portion of track so that he goes straight for the entry point of the next corner. Unfortunately, some of the straights are not so straight, so that doesn't quite work and adds a bit more complexity that I really didn't want! I'm not entirely sure I will add this turn section/points logic to Driving Logic 2.0 or not, but I'm sharing my thoughts as I have them, as I always have.