I started this project
more than 6 years ago! Wow. It has been a wonderful project to work on and is a constant supply of some real brain storming sessions. I probably could have done this faster if I hit the books and went with some existing algorithms used for racing AI, or followed some preset path. But the thrill of solving the problems keeps me going.
There is a
never ending source of problems within this project too! Years ago it started purely theoretical, building an artificial driver that used references points and approach driving algorithms similar to how us humans drive around the track. I've stuck true to most of my root goals in the process, although in some cases I have loosened up and given in.
Given only the left and right edges of the track I computed a,
reasonable, racing line to follow. I figured out how to mange a virtual controller and even control LFS from another application. Without Live for Speed and the community, my Artificial Intelligence in Racing Simulations would not be where it is today. I'd like to thank Scawen, Victor and Eric.
-------
There are a ton of improvements to be worked on in the project, and last night I simply could not turn my brain off, making it unfortunately difficult to sleep. Here is a list of things I want to tackle, some I may have mentioned, some may be new to you.
-
Corner Detector / Management: Better support for detecting corner entry and exit points, along with one or two points along the corner for speed adjustments. After reading
Going Faster! I wonder if a better approach to the corner would be: *Braking Point, Corner Entry, *Brake/Throttle Transition Point, Corner Apex, *Full Throttle Point, and Corner Exit. Each of the points highlighted with a * would be modified by driver as he learns.
This is just me tossing ideas around, not committing to anything just yet.. Now that I have the track "debug" viewer, it is easier to tune the corner detection algorithm. I already had a break through last night that the center line might be better to use for detection, and I wasn't wrong, but it appears maybe a combination of both center and racing line would be best.
-
Improved RacingLine: The current racing line is good.
Okay maybe that is a stretch, but it is not terrible. A great improvement would be to make the braking zones straight. The driver seems to have the most trouble with spins due to braking at the threshold while turning, something that we humans avoid. After the corners are detected, the racingline processor will know where the straights/corners are, and with a different set of parameters should be able to make a second pass creating a better line. Still won't be the most optimal, for that would need to consider late apex corners and corner sacrificing. But that will wait for future iterations.
-
Wall Detection: If you have ever seen the driver attempt to lap some South City courses, you will have heard some scrapes and even seen the occasional slam into the wall.
Almost like the driver gets cars for free and is immortal. The track edges as defined by the PTH file are good, nice and close to the walls, in a few cases just barely on the wrong side. The racing line can add a safety buffer, but I think the best way to do this is to make a wall detector and only add the safety buffer if there is a wall found within 1-3 meters of the track edge. Should be simple to detect, but a bit time consuming. Results could be useful.
-
Tuning Driving Logic v2: Most of the logic in this state is within the first or second iteration.
I am shocked the driver does fairly well, in most cases slightly better lap times than Live for Speed AI drivers on "Learner" difficulty. But a few things
must be tuned and iterated on. First, threshold braking shouldn't slam on the brakes to 100% and hope the car slows.
Technically I wrote logic to lift, just doesn't always happen as planned. The corner speed is also constant from entry to apex, so if the corner is long and has one spot that needs to be slow, the entire area is slow, great example is turn 1 at BL1. Part of this can be helped with better corner detection, but the other part is slowly applying the throttle earlier than apex, when possible, and finding a way to balance the car closer to the limit. These two areas would greatly reduce lap times, in combination with better corners/racing line, it
might be able to compete with LFS AI on "Quick" difficulty,
maybe.
-
Driving Logic v3: DLv2 was written last year and it seriously demotivated me. Turns out the failures was due to inconsistent lag between getting LFS data and sending controller input.
That happens when you run at 20fps on the best of days, even we humans have a hard time with that. Driving Logic v3 won't be built to drive the race track FAST. Instead, it will aim for precision. Following the racing line, or a different line, precisely. That doesn't mean the driver should go slow, but that it will be precise above quick. The reason for that would be the plan to take DLv3 and build upon it so the "line to follow" gets updated by some other part of the ai decisions (when to pass a car, go into pits, etc) and it will need to be precise so that when given a line with only two car widths between a wall and opponent car, the artificial driver can safely drive between them.
Won't be aiming to implement passing logic for quite some time though.
-
Shift Points: The current up/down shift detection works fairly well for a subset of the cars, although it was primarily tuned for the XRG. The turbo cars and UF1 are absolute failures as they downshift like you would going to get groceries. Really, at about 2500rpm I believe on some cars. The current logic uses the "power band" which is the range from torqueRPM to powerRPM and then extends up/down by a certain percentage. Unfortunately, that isn't how the engine curves work, and in some cars the power band is too large, like the turbo cars where torqueRPM is relatively low and powerRPM is still high, which is why they wait so long to downshift. I still want to avoid giving the data to the driver, but it could be tricky to find a function the performs well on all/most cars given only idleRPM, torqueRPM, powerRPM and maxRPM values. Will keep trying.
Those are the big points and problem areas that I would like to address. Most of them I have ideas for, others I don't yet have ideas for but know they are important enough to keep in mind. Detecting the corners for instance, is a really tricky problem that I've barely scratched the surface of. Detecting the corners on FE1 is very different than the corners on KY1 or AS3, but I'll need the algorithm to do it successfully.