Posted: 09 Aug 2012, 22:13
Hi.
This is what is called the "Expert AI" at RVZT.
It makes the Re-Volt AI run difficult vehicles in slippery places better than they do with original stock AI parameters, and it runs decently some vehicles that no AI (V1207 or V1.2) has ever been able to run before.
I was told that my tutorial was too mathematical and hard to understand.
Okay, I’ll make it simple.
You don’t have to read all this long post, if you don’t want all the background info.
All you need for tuning is this:
• The spreadsheet that automates the calculations (xls and odt, also usable via e.g. Google Docs): here;
• The track for tuning the Expert AI: “8 on Ice” here;
• Latest V1.2, or WolfR4 by Jigebren: here.
The spreadsheet includes short instructions and a simple way to find the right AI values: input “1” or “-1” and test the result.
WolfR4 is needed for refreshing the car in-game, so you see the tuning results (or use Re-volt V1.2 and press Ctrl+R in-game).
N.B.: A key point that people seem to have difficulty understanding: doing donuts = oversteer in Re-Volt coding.
Happy tuning!
- - - - - deep technical information below - - - - -
Latest edit:
Huki’s latest V1.2 AI (beta 0815) uses the car AI part of parameters.txt in the old way again, so you can use this tutorial for both the old AI (V1207) and the new AI (V1.2). The same tuning result works for both versions, so you’re good to go in any case. The only difference is that Huki’s v1.2 AI has better crash recovery and route selection. Edit: no, the tuning value is different, and Huki's AI has a sharp excessive countersteer happening sometimes that breaks the car's flow. So it's possible for V1.2 in principle, but not perfect.
Well, thanks anyway, Huki.
This tutorial makes the Re-Volt AI run difficult vehicles and slippery places better than they do with original stock AI parameters, and it runs decently some vehicles that no AI (V1207 or V1.2) has ever been able to run before.
For best results, read also the latest finding down below (“I think I found a simple and effective place to tune the Fringe AI into Expert AI.”).
• Foreword:
All my earlier attempts were half-baked, because I was trying to do the same thing that Huki was trying earlier: find a single AI that runs everything imaginable. But this is simply impossible. Instead, I now present a method of tuning a scratch-made car AI for any individual vehicle so that it runs decently anywhere, including ice. The secret is to find a fringe value between two opposite types of bad behaviour for that specific vehicle – with that value, the vehicle runs well.
• Proof of concept:
I also have a hands-on proof of the method: there’s a link in the bottom of this post, with an AI showcase pack of the most varied lot of vehicles that I could find – most of my own racing collection, hand-picked for maximum variety of different handling effects. See for yourself, and also try racing them, so you see what the AI actually accomplishes.
And logical proof: I found why the original AI usually oversteers on ice – OverMax range is wrong. It has to be between 1.0 and 2.0, not between 0.0 and 1.0. With OverMax less than 1.0, the steering correction is mathematically too small and the car never countersteers when entering the tailspin with wheels turned maximum into curve. Result: steering locked into spin. I tried OverMax 2.0 for maximum countersteer effect and everything countersteers correctly now (even with just track AI), thus the AI can finally be properly tuned. Yay!
Now, on with the method.
• Start with the easy runner option (copy this into parameters.txt):
UnderThresh 5000.000000 ; switched off, it’s an easy runner
UnderRange 1 ; for simplicity
UnderFront 0 ; must be 0, otherwise vehicles don’t move
UnderRear 0 ; must be 0, otherwise vehicles don’t move
UnderMax 1.0 ; easy runner, no need for tuning
OverThresh 5000.000000 ; switched off, it’s an easy runner
OverRange 1 ; for simplicity
OverMax 2.0 ; easy runner, no need for tuning
OverAccThresh 5000 ; switched off for simpler tuning
OverAccRange 0 ; not used now, because OverAccThresh is switched off
The last 5 values can be left as-is, they mainly control route-selection.
• Tune on the track "8 on Ice", using Time Trial option.
For this, use the command line switch -gazzasaicar to run the game and select Edit mode / None. (Hint: hold RCtrl key if you want to control the vehicle yourself).
To refresh the car, use WolfR4 button of [Refresh Car Info]. This also requires the CHANGELING cheat code to be active.
Or in V1.2, press the R key.
• If the vehicle runs well with this, then congratulations, you have an easy runner and nothing else needs to be done
• If the vehicle is not running well, then a suitable value has to be found for UnderThresh and OverThresh (both will have the same value). I call this a fringe value, because it’s between two types of bad behaviour, for example everything higher makes the vehicle oversteer and everything lower makes it understeer. Every vehicle has that fringe (some have it wider, some have it narrower), and every vehicle runs decently on all surfaces with that value.
• Find the stable fringe, going stepwise from 5000 down to a value between the bad behaviour and the opposite bad behaviour, always halving the step. For example, if a vehicle oversteers, then decrease the value until the vehicle no longer oversteers. If it has started understeering instead, then increase the value again until it no longer understeers. If it has started oversteering again, then decrease the value again. Go back and forth like this, always halving the step, until you find a value that’s between oversteering and understeering, so that the vehicle runs smoothly through the track. That’s the fringe for that vehicle.
On example of Candy Pebbles: 5000, (- step 2500 =) 2500, (- step 1250 =) 1250, (- step 625 =) 625, (- step 312.5 =) 312.5, (+ step 156.25 =) 468.75, (- step 78.125 =) 390.625, (+ step 39.0625 =) 429.6875, (+ step 19.53125 =) 449.21875), (+ step 9.765625 =) 458.984375. That’s where the AI is balanced for this car.
If this seems too complicated to calculate, then don't worry, use the spreadsheet template here (xls and odt, also usable via e.g. Google Docs).
• Caution:
Difficult vehicles can’t be made perfect everywhere, because Re-Volt’s static AI can't always cope with both ends of speed range if the car has very high top speed. But everything can be made _decent_.
And a tip: make two runs with each good value you find, because the result may be unstable sometimes. If a value is good for two runs in a row, then it's a sure good value.
• Depending on what the vehicle does, you will need to use four types of UnderMax/OverMax pairs. The stepwise tuning process remains the same.
Different handling types:
•• If the vehicle oversteers, then tune to no more oversteer, but not yet understeer.
UnderMax -2.0 ; oversteering, routed to oversteer code
OverMax 2.0 ; oversteering, countersteers in curves
•• If the vehicle understeers, then tune to no more understeer, but not yet oversteer.
UnderMax 1.0 ; understeering, turns more into curve
OverMax -1.0 ; understeering, routed to understeer code
•• If the vehicle needs to powerslide into curve (drifters, hovercrafts), then tune to no more tail-swings, but not yet too much countersteer.
UnderMax -2.0 ; powerslider, countersteers for balance
OverMax -1.0 ; powerslider, turns nose more into curve
•• If the vehicle needs to slide sideways into curve (copters), then tune to no more excessive left-right swing, but not yet going too straight.
UnderMax 1.0 ; side-slider, pushes sideways into curve
OverMax 2.0 ; side-slider, countersteers for balance
•• Problematic vehicles:
If tuning for oversteer or powerslide and getting no stable fringe (it still oversteers when slow and already understeers when fast), then try tuning for normal steer.
UnderMax 1.0 ; normal steer, turns into curve if sliding out
OverMax 2.0 ; normal steer, countersteers if spinning out
You can also try the oversteer pair for a problematic powerslider, and vice versa.
• And that’s it. Once you get the vehicle to run smoothly through first part of “8 on Ice”, you can go test it on other tracks of your choice and fine-tune it further if you want.
• And lastly, the proof-of-concept pack of vehicles: get it here.
These are all tuned for smooth run through Supermarket 2, and then verified in 12-car race on Neighbourhood 2 and 1.
What’s included in the proof-of-concept and why some are special cases:
Volken: stock easy runner. Easy runner, no need for tuning. Good with 5000.000000.
Sprinter: stock problem child on ice. Tuned for oversteer. Good with 937.500000.
Candy: stock RWD. Tuned for oversteer. Good with 458.984375.
Panga TC: stock roll-over in turns. Tuned for oversteer. Good with 546.875000.
Rotor: stock flipping in turns, not even intended for AI. Easy runner, no need for tuning. Good with 5000.000000.
Clockwork 1: not even intended for racing or AI. Tuned for oversteer. Good with 1250.000000.
Clockwork 2: not even intended for racing or AI. Tuned for oversteer. Good with 937.500000.
Clockwork 3: not even intended for racing or AI. Tuned for oversteer. Good with 937.500000.
Clockwork 4: stock fast and tiny. Tuned for oversteer. Good with 1093.750000.
Ufo: not even intended for AI. Tuned for oversteer. Good with 625.000000.
8-Legs Jr.: custom on asymmetric chassis. Easy runner, no need for tuning. Good with 5000.000000.
Rawdog: custom leaning car, handling changes in mid-turn. Easy runner, no need for tuning. Good with 5000.000000.
BiWheel: custom unstable turn-on-a-dime. Easy runner, no need for tuning. Good with 5000.000000.
RL Burnout Toyeca: custom RL body-dragger. Tuned for oversteer. Good with 468.750000.
(Special case: old AI node selection code gets confused at start line, but starts after a reposition.)
Caterpillar: custom with mega inertia. Tuned for oversteer. Decent with 468.750000.
(Special case: high inertia makes it oversteer on tarmac and understeer on ice. Currently balanced between those two. Could be tuned better for tarmac, but goes straight on ice then.)
Fast Traxx: custom slow climber. Easy runner, no need for tuning. Good with 5000.000000.
Plymouth RR Wheelie: custom wheelie-popper. Tuned for understeer. Decent with 310.058594.
(Special case: its physics hates any collisions. Also, old recovery mode can’t handle the car – as long as it stays in race mode, it goes well.).
Ghost Car: custom go-through-things, based on Mystery. Easy runner, no need for tuning. Good with 5000.000000.
Heavy Metal: custom super-heavy. Tuned for understeer. Good with 312.500000.
HoverTech: custom hover, technically a full-drifter. Tuned for powerslide. Good with 1850.585938.
(Special case: static AI can’t handle its different sliding at different speeds. Understeers a bit when fast and oversteers a bit when slow.)
K22a Virus: custom overpowered RWD. Tuned for oversteer. Good with 468.750000.
RL Komatsu930e: custom RL heavy tail-happy. Tuned for oversteer. Decent with 312.500000.
(Special case: static AI can't cope with so different handling when slow and when fast: oversteers when slow, understeers at high speed. Could be tuned better for slow speeds, but goes straight in fast curves then.)
Nomster RC: custom soft-suspension 4WSteering. Easy runner, no need for tuning. Good with 5000.000000.
Motocross Rider: custom superlarge leaning. Tuned for understeer. Good with 4.882813.
(Special case: actually tail-happy, but too large for most tracks, thus understeers with track AI. Now has nervous, but precise steering.)
Mowmaster: custom RWSteering body-pusher. Tuned for understeer. Good with 214.843750.
(Special case: old AI node selection code gets confused at start line, but starts after a reposition. Also, static AI can't cope with so different handling when slow and when fast: oversteers when slow, understeers at high speed. Not perfect, but best that static AI can manage.)
Piaggio Vespa: custom understeering leaning. Tuned for understeer. Good with 390.625000.
Police Sidecar: custom asymmetric CoM, straight on wheels. Tuned for oversteer. Good with 312.500000.
Slideout: custom supersmall. Easy runner, no need for tuning. Good with 5000.000000.
Stuntman BMW: custom asymmetric CoM, leaning on side. Easy runner, no need for tuning. Good with 5000.000000.
Suppressor APC: custom heavy nose-heavy. Tuned for oversteer. Good with 625.000000.
T-Bucket: custom insanely fast. Easy runner, no need for tuning. Good with 5000.000000.
(Special case: static AI can't cope with so different handling when slow and when fast: oversteers when slow, understeers at high speed. Not perfect, but best that static AI can manage.)
RL Chibi Fatbax: custom RL supersmall. Easy runner, no need for tuning. Good with 5000.000000.
Toy Copter 2: custom with realistic copter steering. Tuned for side-slide. Decent with 25.634766.
(Special case: recovery handling is reversed, thus sometimes sticks to wall.)
Thunder Tiger: custom soft-suspension typical buggy. Tuned for oversteer. Good with 614.013672.
(Personal note: huh, it has a _really_ narrow fringe due to its spring action!)
Race Unibike 2: custom sharp-steering leaning. Easy runner, no need for tuning. Good with 5000.000000.
This is what is called the "Expert AI" at RVZT.
It makes the Re-Volt AI run difficult vehicles in slippery places better than they do with original stock AI parameters, and it runs decently some vehicles that no AI (V1207 or V1.2) has ever been able to run before.
I was told that my tutorial was too mathematical and hard to understand.
Okay, I’ll make it simple.
You don’t have to read all this long post, if you don’t want all the background info.
All you need for tuning is this:
• The spreadsheet that automates the calculations (xls and odt, also usable via e.g. Google Docs): here;
• The track for tuning the Expert AI: “8 on Ice” here;
• Latest V1.2, or WolfR4 by Jigebren: here.
The spreadsheet includes short instructions and a simple way to find the right AI values: input “1” or “-1” and test the result.
WolfR4 is needed for refreshing the car in-game, so you see the tuning results (or use Re-volt V1.2 and press Ctrl+R in-game).
N.B.: A key point that people seem to have difficulty understanding: doing donuts = oversteer in Re-Volt coding.
Happy tuning!
- - - - - deep technical information below - - - - -
Latest edit:
Huki’s latest V1.2 AI (beta 0815) uses the car AI part of parameters.txt in the old way again, so you can use this tutorial for both the old AI (V1207) and the new AI (V1.2). The same tuning result works for both versions, so you’re good to go in any case. The only difference is that Huki’s v1.2 AI has better crash recovery and route selection. Edit: no, the tuning value is different, and Huki's AI has a sharp excessive countersteer happening sometimes that breaks the car's flow. So it's possible for V1.2 in principle, but not perfect.
Well, thanks anyway, Huki.
This tutorial makes the Re-Volt AI run difficult vehicles and slippery places better than they do with original stock AI parameters, and it runs decently some vehicles that no AI (V1207 or V1.2) has ever been able to run before.
For best results, read also the latest finding down below (“I think I found a simple and effective place to tune the Fringe AI into Expert AI.”).
• Foreword:
All my earlier attempts were half-baked, because I was trying to do the same thing that Huki was trying earlier: find a single AI that runs everything imaginable. But this is simply impossible. Instead, I now present a method of tuning a scratch-made car AI for any individual vehicle so that it runs decently anywhere, including ice. The secret is to find a fringe value between two opposite types of bad behaviour for that specific vehicle – with that value, the vehicle runs well.
• Proof of concept:
I also have a hands-on proof of the method: there’s a link in the bottom of this post, with an AI showcase pack of the most varied lot of vehicles that I could find – most of my own racing collection, hand-picked for maximum variety of different handling effects. See for yourself, and also try racing them, so you see what the AI actually accomplishes.
And logical proof: I found why the original AI usually oversteers on ice – OverMax range is wrong. It has to be between 1.0 and 2.0, not between 0.0 and 1.0. With OverMax less than 1.0, the steering correction is mathematically too small and the car never countersteers when entering the tailspin with wheels turned maximum into curve. Result: steering locked into spin. I tried OverMax 2.0 for maximum countersteer effect and everything countersteers correctly now (even with just track AI), thus the AI can finally be properly tuned. Yay!
Now, on with the method.
• Start with the easy runner option (copy this into parameters.txt):
UnderThresh 5000.000000 ; switched off, it’s an easy runner
UnderRange 1 ; for simplicity
UnderFront 0 ; must be 0, otherwise vehicles don’t move
UnderRear 0 ; must be 0, otherwise vehicles don’t move
UnderMax 1.0 ; easy runner, no need for tuning
OverThresh 5000.000000 ; switched off, it’s an easy runner
OverRange 1 ; for simplicity
OverMax 2.0 ; easy runner, no need for tuning
OverAccThresh 5000 ; switched off for simpler tuning
OverAccRange 0 ; not used now, because OverAccThresh is switched off
The last 5 values can be left as-is, they mainly control route-selection.
• Tune on the track "8 on Ice", using Time Trial option.
For this, use the command line switch -gazzasaicar to run the game and select Edit mode / None. (Hint: hold RCtrl key if you want to control the vehicle yourself).
To refresh the car, use WolfR4 button of [Refresh Car Info]. This also requires the CHANGELING cheat code to be active.
Or in V1.2, press the R key.
• If the vehicle runs well with this, then congratulations, you have an easy runner and nothing else needs to be done
• If the vehicle is not running well, then a suitable value has to be found for UnderThresh and OverThresh (both will have the same value). I call this a fringe value, because it’s between two types of bad behaviour, for example everything higher makes the vehicle oversteer and everything lower makes it understeer. Every vehicle has that fringe (some have it wider, some have it narrower), and every vehicle runs decently on all surfaces with that value.
• Find the stable fringe, going stepwise from 5000 down to a value between the bad behaviour and the opposite bad behaviour, always halving the step. For example, if a vehicle oversteers, then decrease the value until the vehicle no longer oversteers. If it has started understeering instead, then increase the value again until it no longer understeers. If it has started oversteering again, then decrease the value again. Go back and forth like this, always halving the step, until you find a value that’s between oversteering and understeering, so that the vehicle runs smoothly through the track. That’s the fringe for that vehicle.
On example of Candy Pebbles: 5000, (- step 2500 =) 2500, (- step 1250 =) 1250, (- step 625 =) 625, (- step 312.5 =) 312.5, (+ step 156.25 =) 468.75, (- step 78.125 =) 390.625, (+ step 39.0625 =) 429.6875, (+ step 19.53125 =) 449.21875), (+ step 9.765625 =) 458.984375. That’s where the AI is balanced for this car.
If this seems too complicated to calculate, then don't worry, use the spreadsheet template here (xls and odt, also usable via e.g. Google Docs).
• Caution:
Difficult vehicles can’t be made perfect everywhere, because Re-Volt’s static AI can't always cope with both ends of speed range if the car has very high top speed. But everything can be made _decent_.
And a tip: make two runs with each good value you find, because the result may be unstable sometimes. If a value is good for two runs in a row, then it's a sure good value.
• Depending on what the vehicle does, you will need to use four types of UnderMax/OverMax pairs. The stepwise tuning process remains the same.
Different handling types:
•• If the vehicle oversteers, then tune to no more oversteer, but not yet understeer.
UnderMax -2.0 ; oversteering, routed to oversteer code
OverMax 2.0 ; oversteering, countersteers in curves
•• If the vehicle understeers, then tune to no more understeer, but not yet oversteer.
UnderMax 1.0 ; understeering, turns more into curve
OverMax -1.0 ; understeering, routed to understeer code
•• If the vehicle needs to powerslide into curve (drifters, hovercrafts), then tune to no more tail-swings, but not yet too much countersteer.
UnderMax -2.0 ; powerslider, countersteers for balance
OverMax -1.0 ; powerslider, turns nose more into curve
•• If the vehicle needs to slide sideways into curve (copters), then tune to no more excessive left-right swing, but not yet going too straight.
UnderMax 1.0 ; side-slider, pushes sideways into curve
OverMax 2.0 ; side-slider, countersteers for balance
•• Problematic vehicles:
If tuning for oversteer or powerslide and getting no stable fringe (it still oversteers when slow and already understeers when fast), then try tuning for normal steer.
UnderMax 1.0 ; normal steer, turns into curve if sliding out
OverMax 2.0 ; normal steer, countersteers if spinning out
You can also try the oversteer pair for a problematic powerslider, and vice versa.
• And that’s it. Once you get the vehicle to run smoothly through first part of “8 on Ice”, you can go test it on other tracks of your choice and fine-tune it further if you want.
• And lastly, the proof-of-concept pack of vehicles: get it here.
These are all tuned for smooth run through Supermarket 2, and then verified in 12-car race on Neighbourhood 2 and 1.
What’s included in the proof-of-concept and why some are special cases:
Volken: stock easy runner. Easy runner, no need for tuning. Good with 5000.000000.
Sprinter: stock problem child on ice. Tuned for oversteer. Good with 937.500000.
Candy: stock RWD. Tuned for oversteer. Good with 458.984375.
Panga TC: stock roll-over in turns. Tuned for oversteer. Good with 546.875000.
Rotor: stock flipping in turns, not even intended for AI. Easy runner, no need for tuning. Good with 5000.000000.
Clockwork 1: not even intended for racing or AI. Tuned for oversteer. Good with 1250.000000.
Clockwork 2: not even intended for racing or AI. Tuned for oversteer. Good with 937.500000.
Clockwork 3: not even intended for racing or AI. Tuned for oversteer. Good with 937.500000.
Clockwork 4: stock fast and tiny. Tuned for oversteer. Good with 1093.750000.
Ufo: not even intended for AI. Tuned for oversteer. Good with 625.000000.
8-Legs Jr.: custom on asymmetric chassis. Easy runner, no need for tuning. Good with 5000.000000.
Rawdog: custom leaning car, handling changes in mid-turn. Easy runner, no need for tuning. Good with 5000.000000.
BiWheel: custom unstable turn-on-a-dime. Easy runner, no need for tuning. Good with 5000.000000.
RL Burnout Toyeca: custom RL body-dragger. Tuned for oversteer. Good with 468.750000.
(Special case: old AI node selection code gets confused at start line, but starts after a reposition.)
Caterpillar: custom with mega inertia. Tuned for oversteer. Decent with 468.750000.
(Special case: high inertia makes it oversteer on tarmac and understeer on ice. Currently balanced between those two. Could be tuned better for tarmac, but goes straight on ice then.)
Fast Traxx: custom slow climber. Easy runner, no need for tuning. Good with 5000.000000.
Plymouth RR Wheelie: custom wheelie-popper. Tuned for understeer. Decent with 310.058594.
(Special case: its physics hates any collisions. Also, old recovery mode can’t handle the car – as long as it stays in race mode, it goes well.).
Ghost Car: custom go-through-things, based on Mystery. Easy runner, no need for tuning. Good with 5000.000000.
Heavy Metal: custom super-heavy. Tuned for understeer. Good with 312.500000.
HoverTech: custom hover, technically a full-drifter. Tuned for powerslide. Good with 1850.585938.
(Special case: static AI can’t handle its different sliding at different speeds. Understeers a bit when fast and oversteers a bit when slow.)
K22a Virus: custom overpowered RWD. Tuned for oversteer. Good with 468.750000.
RL Komatsu930e: custom RL heavy tail-happy. Tuned for oversteer. Decent with 312.500000.
(Special case: static AI can't cope with so different handling when slow and when fast: oversteers when slow, understeers at high speed. Could be tuned better for slow speeds, but goes straight in fast curves then.)
Nomster RC: custom soft-suspension 4WSteering. Easy runner, no need for tuning. Good with 5000.000000.
Motocross Rider: custom superlarge leaning. Tuned for understeer. Good with 4.882813.
(Special case: actually tail-happy, but too large for most tracks, thus understeers with track AI. Now has nervous, but precise steering.)
Mowmaster: custom RWSteering body-pusher. Tuned for understeer. Good with 214.843750.
(Special case: old AI node selection code gets confused at start line, but starts after a reposition. Also, static AI can't cope with so different handling when slow and when fast: oversteers when slow, understeers at high speed. Not perfect, but best that static AI can manage.)
Piaggio Vespa: custom understeering leaning. Tuned for understeer. Good with 390.625000.
Police Sidecar: custom asymmetric CoM, straight on wheels. Tuned for oversteer. Good with 312.500000.
Slideout: custom supersmall. Easy runner, no need for tuning. Good with 5000.000000.
Stuntman BMW: custom asymmetric CoM, leaning on side. Easy runner, no need for tuning. Good with 5000.000000.
Suppressor APC: custom heavy nose-heavy. Tuned for oversteer. Good with 625.000000.
T-Bucket: custom insanely fast. Easy runner, no need for tuning. Good with 5000.000000.
(Special case: static AI can't cope with so different handling when slow and when fast: oversteers when slow, understeers at high speed. Not perfect, but best that static AI can manage.)
RL Chibi Fatbax: custom RL supersmall. Easy runner, no need for tuning. Good with 5000.000000.
Toy Copter 2: custom with realistic copter steering. Tuned for side-slide. Decent with 25.634766.
(Special case: recovery handling is reversed, thus sometimes sticks to wall.)
Thunder Tiger: custom soft-suspension typical buggy. Tuned for oversteer. Good with 614.013672.
(Personal note: huh, it has a _really_ narrow fringe due to its spring action!)
Race Unibike 2: custom sharp-steering leaning. Easy runner, no need for tuning. Good with 5000.000000.