More Progress!
I've worked quite hard on the project tonight, a lot of really good improvements, but none directly effect the driver behaviors or laptimes, yet. Instead I focused on a way to really see what is going on with the processing of the track data. There hasn't been much issue getting the track edges, especially once I figured out to use the PTH files (thanks to whoever mentioned that). But there had always been an issue with many tracks, actually all other tracks tested besides FE1, that prevented apex from being positioned properly on many turns.
It turns out, after adding some visual processing/debugging help that the issue was only with left hand turns. FE1 "worked" because the Corner Detection only processed apex points for right hand corners. (Apex is found by following racing line from turn exit backwards to nearest track edge). The FE1 chicane starts as a left turn, but ends in a right turn. The bug was me erroneously sending the centerLine to the corner detector when the leftTrackEdge should have been sent.
A quick load of BL1 and three corners look so much better, I can't wait to run Jared on the track. I'm confident some times will be beaten. I will have to toss away any BL1 saved/processed data and that will be a manual process, woot.
Another thing that plagued other tracks was an error getting height at a certain point in the terrain (SMX) data for the track. This is needed to make the lines visible and it seems in some cases keep the driver sane. SO3 had an interesting issue where the driver would slam on brakes and turn for no reason going down the straight. Using the dot product on two vectors that change a large amount in height effects may or may not be a reason. After a fairly good debugging session, and some help from people on my live development stream, it was tracked down to a few issues with the Terrain Quad Tree that was written to speed up line of sight checks.
Finally got to see the quad tree visualized, and woah, it is pretty neat. But it was off centered. After a bit of a hunt I figured out that some code I did to make it a "square" tossed it off center. I tossed the code. Why does it need to be a square? It doesn't! That fixed the issues noticed at SO3, but there were still a few odd balls, that I knew would creep up, triangles would only be inserted into one of the quads if, and only if, one of their vertices landed within the quad area. This lead to an interesting issue where if three points extended beyond, but through, the box, the triangle wouldn't be included.
With a little help from google, I modified the collision test:
If ANY of the triangle vertices (points) are contained within the box, collision.
If ANY of the box vertices (points) are contained within the triangle, collision.
If ANY triangle edge crosses a box edge, collision.
This solves all cases and just needed a PointInTriangle(), PointInBox() and LineToLine() tests, two of which I had already. All problems gone.*
*Actually I have seen exactly 1 failed test location at SO3 while the RacingLine is being computed visually, but it must be a super edge case, and unless I see another case popup, I'm considering this case closed.
I continued on, you thought I was done, and added a way to tweak the parameters of the Corner Detector. The corner detector isn't bad. I haven't really tuned it quite as well as desired. This new track processing visualization/debug state, whatever you want to call it!, has opened new doors. I can push a button an see the results. It occurred to me that the centerLine might be better than the racingLine for detecting corners entry and exit points while the racing line is used for braking and apex points. Seems to work fairly well, but I think the best scenario is some weird mixture of both. Currently I can only tune two parameters: MinimumStraightDistance and MaximumStraightAngle.
Lets see what tomorrow brings. I'll probably do another live stream and I will try to give about an hour notice before starting, if I can. I want to focus on tuning the corner points some more, add some more parameters to tune and maybe even test out BL1 and maybe some other tracks!
Should be lots of fun.
I've worked quite hard on the project tonight, a lot of really good improvements, but none directly effect the driver behaviors or laptimes, yet. Instead I focused on a way to really see what is going on with the processing of the track data. There hasn't been much issue getting the track edges, especially once I figured out to use the PTH files (thanks to whoever mentioned that). But there had always been an issue with many tracks, actually all other tracks tested besides FE1, that prevented apex from being positioned properly on many turns.
It turns out, after adding some visual processing/debugging help that the issue was only with left hand turns. FE1 "worked" because the Corner Detection only processed apex points for right hand corners. (Apex is found by following racing line from turn exit backwards to nearest track edge). The FE1 chicane starts as a left turn, but ends in a right turn. The bug was me erroneously sending the centerLine to the corner detector when the leftTrackEdge should have been sent.
A quick load of BL1 and three corners look so much better, I can't wait to run Jared on the track. I'm confident some times will be beaten. I will have to toss away any BL1 saved/processed data and that will be a manual process, woot.
Another thing that plagued other tracks was an error getting height at a certain point in the terrain (SMX) data for the track. This is needed to make the lines visible and it seems in some cases keep the driver sane. SO3 had an interesting issue where the driver would slam on brakes and turn for no reason going down the straight. Using the dot product on two vectors that change a large amount in height effects may or may not be a reason. After a fairly good debugging session, and some help from people on my live development stream, it was tracked down to a few issues with the Terrain Quad Tree that was written to speed up line of sight checks.
Finally got to see the quad tree visualized, and woah, it is pretty neat. But it was off centered. After a bit of a hunt I figured out that some code I did to make it a "square" tossed it off center. I tossed the code. Why does it need to be a square? It doesn't! That fixed the issues noticed at SO3, but there were still a few odd balls, that I knew would creep up, triangles would only be inserted into one of the quads if, and only if, one of their vertices landed within the quad area. This lead to an interesting issue where if three points extended beyond, but through, the box, the triangle wouldn't be included.
With a little help from google, I modified the collision test:
If ANY of the triangle vertices (points) are contained within the box, collision.
If ANY of the box vertices (points) are contained within the triangle, collision.
If ANY triangle edge crosses a box edge, collision.
This solves all cases and just needed a PointInTriangle(), PointInBox() and LineToLine() tests, two of which I had already. All problems gone.*
*Actually I have seen exactly 1 failed test location at SO3 while the RacingLine is being computed visually, but it must be a super edge case, and unless I see another case popup, I'm considering this case closed.
I continued on, you thought I was done, and added a way to tweak the parameters of the Corner Detector. The corner detector isn't bad. I haven't really tuned it quite as well as desired. This new track processing visualization/debug state, whatever you want to call it!, has opened new doors. I can push a button an see the results. It occurred to me that the centerLine might be better than the racingLine for detecting corners entry and exit points while the racing line is used for braking and apex points. Seems to work fairly well, but I think the best scenario is some weird mixture of both. Currently I can only tune two parameters: MinimumStraightDistance and MaximumStraightAngle.
Lets see what tomorrow brings. I'll probably do another live stream and I will try to give about an hour notice before starting, if I can. I want to focus on tuning the corner points some more, add some more parameters to tune and maybe even test out BL1 and maybe some other tracks!
Should be lots of fun.