AIW tight corner fixes

Discussion in 'Track Modding' started by dosequis56, Jul 7, 2022.

Tags:
  1. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    134
    Likes Received:
    50
    I have written a .NET tool that will modify AIW files. Current use is to insert a set of waypoints in-between existing points in tight corners. The tool will compute position and axis for these points so they flow with the existing waypoints they go between. When I go into the game, they have good corridors and I will do some minor tweaks to paths while looking at calculated speed and orientation (NOTE: Orientation has some minor affect on AI speed, at least for an AI driving my car). Next, I run laps in my F1 car with an AI behind the wheel. The AI does pretty well and I can see smoother turn radius through the corner. With some playing around, I get the AI to do good lap times. However, the AI that are NOT driving my car struggle through the corner with the extra waypoints. They stutter on and off the accelerator seeming to be lost. I tried stuff like manually setting AI speed vs. the calculated speed; but this only seem to affect the AI driving MY car. My goal here is to fix tracks like Monaco where the AI cannot get around the hairpin due to the jaggy edges of the AIW path.

    So corridors look good, pathinfo seems good (note, -1, -1 for last two fields), orientation seems good but even if I completely turn the orientation on its head it has very little impact on the AI, calculated speeds look similar to prior values (just more of them).

    My guess is that the AI is doing some calculation assuming fixed spacing of the waypoints. Just strange that the AI driving my car does not.
     
    atomed and davehenrie like this.
  2. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,488
    Likes Received:
    3,423
    Could you upload your AIW File, in that you did add the Waypoints with your Tool?
     
  3. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    134
    Likes Received:
    50
    Here is one version of the AIW. This one isn't the quickest with the AI driving my car, but it shows the issue where the AI driving my car gets through the corner pretty well but the other AI cars do not. Waypoints are inserted at 522 and go through 552
    https://www.dropbox.com/s/trjaaq0bw6r4y50/GPVWC_Montr_2019.AIW?dl=0
    Here is some output from the tool that shows the first waypoint added at 522 (so between the previous waypoint 521 and 522, a new point is added). You can see the adjustments to position, normal and perp in the output (it computes half the numeric distance between the two points it inserts between and updates the new waypoint to be half way between. Seems to work well when I look at corridors etc. Orientation is set to zeros and then adjusted with the AIW editor on rfactor and it seems fine. And again, orientation doesn't seem to hurt AI speed that much, even when I turn it upside down (all set to 9999.0).

    Insert new waypoint at 522 with next=523
    Adjusting X position 522 += 0.48921204
    Adusting Y position of point 522 += 0.009849995
    Adjusting Z position of point 522 -= 2.456482
    Adjusting X position 522 -= 0.00095000025
    Adusting Y position of point 522 += 5.0008297E-05
    Adjusting Z position of point 522 -= 0.00029999996
    Adjusting X position 522 -= 0.0013499856
    Adusting Y position of point 522 += 0.00095000025
    Adjusting Z position of point 522 += 0.0069499984
    Insert [522:(-304.8040,0.5280,1126.4540)] between [522:(-305.2932,0.5182,1128.9100)] and [523:(-306.1646,0.4978,1133.8210)]
    The Next waypoint has id=523 previous=522 next=524
    New point: id=522 previous=521 next=523
    Insert new waypoint at 524 with next=525
    Adjusting X position 524 += 0.43569946
    Adusting Y position of point 524 += 0.010199994
    Adjusting Z position of point 524 -= 2.4556274
    Adjusting X position 524 -= 0.0011999998
    Adusting Y position of point 524 += 0
    Adjusting Z position of point 524 += 0.00014999998
    Adjusting X position 524 -= 0.0053499937
    Adusting Y position of point 524 += 0.0009499998
    Adjusting Z position of point 524 += 0.03565
    Insert [524:(-305.7289,0.5080,1131.3660)] between [524:(-306.1646,0.4978,1133.8210)] and [525:(-306.4270,0.4808,1138.8120)]
    The Next waypoint has id=525 previous=524 next=526
    New point: id=524 previous=523 next=525

    I do NOT modify waypointspan=4.80
    I DO adjust all waypoint indexes in the file that come AFTER my insertion point, including branch IDs.
    I DO adjust number_waypoints=1194
     
  4. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    134
    Likes Received:
    50
    NOTE that this track doesn't need the modification that badly as the AI aren't smooth through this corner; but they do get through there ok. I I started the tool mainly for Monaco.
     
    Hazi likes this.
  5. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,488
    Likes Received:
    3,423
    @dosequis56 I also think that the main Problem is the AI itself. For Example the "stuttered" Acceleration in Corners, that started some Years ago, while it was not there before, neither in rF1 nor in rF2 at the Beginning, is something that opens Doubts about the proper Programming of the AI Code.
    And we, of course, have no clue about the Programming of the AI related Code at all, what makes it hard to judge their Behaviour and we also have the different Physics of Cars, that have a big Influence too.
    And also that the Behaviour of the AI driven Cars is different to the own Car, driven by the AI, doesn't help.
    I fear that some bad Behaviour can only be fixed by the Games Code.
    And as a temporary Solution, in Case of tight Corners for Example, we maybe can use tightened Corridors, to get the Cars around of these.
    Unfortunately this has always to be done with extensive Testing, what makes you being exhausted one Day, when you do it over Years. :D
     
  6. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    134
    Likes Received:
    50
    It does wear you out when you make no progress, especially when it looks so promising but doesn't quite work right.
     
    DaREALMastaD and redapg like this.
  7. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,488
    Likes Received:
    3,423
    That's true.
    I did load your AIW in one of my Online Tools, to visualize the Waypoints, to maybe see something looking wrong, but it looks OK.
    So i think that tighten the Corridors at that Corner (Monaco), maybe is more successfull, to get the AI better driving around of it.
    But as said, it's not only the AIW File that has an Influence in such Cases.
     
    dosequis56 likes this.
  8. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    134
    Likes Received:
    50
    Not sure corridors will help their start-stop behavior. I think it really comes down to the zig-zag path.
     
    redapg likes this.
  9. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,488
    Likes Received:
    3,423
    The "Acceleration on/off" is something that was getting broken in the Code, a long Time ago as said and was never fixed currently.
    My Guess is, that a tighter Corridor maybe reduces that Behaviour too, because the AI should try to keep the Car inside of the limited Corridor.
    But as said, you have to test (test, test, test,.....)
     
    dosequis56 likes this.
  10. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    134
    Likes Received:
    50
    It is a shame that the AI driving my car differs; making it harder to test. If anyone has any idea how to make all AI cars use the same physics that would be great.
     
  11. shiet

    shiet Registered

    Joined:
    Nov 3, 2014
    Messages:
    455
    Likes Received:
    217
    If you change the AISpec values in the AIW file to something like these
    AISpec=(1.0000,0.0000,0.1000,1.0000)
    this will mitigate the on/off behaviour of the pedals. They will use the throttle like a human (slower, progressive presses) and the braking on/off will also be slower.

    dosequis56: making a fastpath is a real struggle if you want it to be really fast not to mention if you want it to "fit" every single car which is not gonna happen with this system currently present in basically every single simulator.
    But you can try something I have success with: when you're in devmode and started your car then press SHIFT+I to switch to AI physics. Now you can drive a car which has the same physics as the AIs use.
    You will notice that there is no FFB and the car is like a big cardboard box on wooden tires. It's pretty hard to crash with this "car" even over 300 km/h if you start to zigzag on the road. :D And it bounces on every small bump on the road causing grip loss.
    It's pretty hard to drive at first and then it's hard to make a good fastpath with it.
    But if you can make it then after that it's easier to modify the waypoints because you can match the calculated and the recorded speeds at almost every single waypoint.
     
    Last edited: Jul 23, 2022
    Gilles Benoit and vava74 like this.
  12. dosequis56

    dosequis56 Registered

    Joined:
    Dec 24, 2021
    Messages:
    134
    Likes Received:
    50
    I have read that AISpec has no affect if the AI setting is 100% or better.
     
  13. shiet

    shiet Registered

    Joined:
    Nov 3, 2014
    Messages:
    455
    Likes Received:
    217
    I can assure you it works with strength over 100%.
     

Share This Page