Page 1 of 1
Posted: 11 Jan 2011, 11:15
Citywalker
This is now only an archive of my earlier half-baked attempts 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. Warning: it only works with the old AI (V1207). Huki’s V1.2 still has some changes in race-code so it’s incompatible. I know because I tried tuning for his AI. Sprinter XL still did a U-turn on ice and already understeered on floors. So it’s old AI only for now.
It’s there:
http://z3.invisionfree.com/Our_ReVolt_P ... p=22000986

The rest of this topic is unchanged, except the last bump-post.

- - - - - old message below - - - - -

http://z3.invisionfree.com/Our_ReVolt_P ... p=10639164
This is what I call the simplified AI. It works for normal cars, high-grip cars, drifters, Real-Life handling cars – you name it.
It currently has two functioning options with constant values that don’t depend on the vehicle. How much more KISS could it be? :)
+ Track AI for all easy-handling cars.
+ Default culling of tail-swing for tail-happy cars.
This makes the first post a good read for general information, and also for deep tweaking if your vehicle is something special.

-----

Hey.

As you know, Huki and Jigebren are making Re-Volt 1.2 from source code. Some time ago I asked Huki whether he can tell me anything about the car AI part of the parameters.txt when looking at the source code. He said it’s cryptic and provided me with the respective code bit and a link to some more side information from the past programmer.

Now, I can proudly present an explanation of how the car AI works and what to tweak in the parameters.txt. Huki said he wanted to double-check this, and so I’ll be glad to have his final approval, but for now, having a bit of a programming background myself, I am sure that I have read it right. And I have waited quite a bit already :) Besides, as UrbanRocker can confirm, I already used this knowledge on a car in his collection.

Tutorial follows:

+ General explanations:
• The AI part of the car parameters is essentially a set of instructions for corrections on top of what the track AI orders the cars to do.
• If the car has less than three wheels in contact with the ground, then the car is considered to be tumbling and the entire car AI section is bypassed.
•• In this case, the car is controlled by the track AI only. (Incidentally, this means that all the more lunatic vehicles, like bikes and some of my Concepts going on two wheels only, need to have technically double wheels with identical positions, to have any benefit from the car AI.)
• If front end is going sideways faster than rear end (or equally), the car is considered to be understeering (sideways sliding).
•• In this case, the AI turns steering wheels more i.e. away from zero straight, and applies throttle inversely proportionally to steering correction intensity or in case of too much sliding applies full brakes.
• If rear end is going sideways faster than front end, the car is considered to be oversteering (excessive powersliding).
•• In this case, the AI turns steering wheels towards sliding direction and over zero straight if necessary, and applies throttle or brakes in the range of full throttle when sliding a little to half brakes when sliding fast.
• If front and rear are going to opposite directions, the car is considered to be in special case of oversteering (spinning around).
•• In this case, the AI behaves similarly to excessive powersliding, but considers spinning speed instead of sliding speed, i.e. the AI turns steering wheels against spinning direction and over zero straight if necessary, and applies throttle or brakes in the range of full throttle when spinning a little to half brakes when spinning fast.

Sadly, I don’t know about the actual units of measurement used for sliding speeds, so the values still need to be adjusted empirically, but at least now we know what to adjust.

+ Parameters.txt explained: (Candy Pebbles)
UnderThresh 150.000000
; sideways sliding limiter for steering corrections
; if sum of front and rear sideways speeds is over this, then correct steering
; lower: correct sooner, higher: let it slide
; range: 0 to ?
UnderRange 1415.486572
; steer correction smoothness coefficient for sideways sliding
; steering correction coefficient is divided by this
; lower: sharper corrections, higher: smoother corrections
; range: 1(?) to ?
UnderFront 372.000000
; sideways sliding limiter for throttle corrections, combined with UnderRear
; if front sideways speed is over this and rear sideways speed is over UnderRear, then apply full brakes
; lower: apply full brakes sooner, higher: go with proportional throttle for longer
; range: 0 to ?
UnderRear 335.000000
; sideways sliding limiter for throttle corrections, combined with UnderFront
; if rear sideways speed is over this and front sideways speed is over UnderFront, then apply full brakes
; lower: apply full brakes sooner, higher: go with proportional throttle for longer
; range: 0 to ?
UnderMax 0.950000
; maximum steer correction limiter for sideways sliding
; excessive steer correction coefficient is culled to this
; lower: less intensive corrections, higher: more intensive corrections
; range: 0 to 1
OverThresh 2833.246826
; powersliding and spinning limiter for steering corrections
; if rear sideways speed is that much over front sideways speed, then correct steering
; lower: correct sooner, higher: let it turn
; range: 0 to ?
OverRange 1391.000000
; steer correction smoothness coefficient for powersliding and spinning
; steering correction coefficient is divided by this
; lower: sharper corrections, higher: smoother corrections
; range: 1(?) to ?
OverMax 0.360000
; maximum steer correction limiter for powersliding and spinning
; excessive steer correction coefficient is culled to this
; lower: less intensive corrections, higher: more intensive corrections
; range: 0 to 1
OverAccThresh 10.000000
; powersliding and spinning limiter for throttle corrections
; if front or rear sideways speed is over this, then correct throttle
; lower: correct sooner, higher: let it turn
; range: 0 to ?
OverAccRange 400.000000
; throttle correction bias coefficient for powersliding and spinning
; throttle correction coefficient is calculated with this, resulting in range from full throttle to half brakes
; lower: more bias towards braking, higher: more bias towards throttling
; range: 1(?) to ?

+ Programming explained:

•Check for the number of wheels in contact with the ground.
••If this is less than three, then the car is considered to be tumbling and nothing else is done.

•Check for oversteering or understeering:
••If rear and front are going both leftwards or both rightwards then
•••If rear is sliding faster than the front and the difference is more than OverThresh, then it’s considered oversteering (excessive powersliding and spinning)
••••do something to steering:
•••••calculate steer correction coefficient = part of the difference between rear and front sideways speeds that exceeds OverThresh, divided by OverRange
•••••If it’s still more than OverMax, then cull it to OverMax
••••••result: positive steer correction coefficient in the range of 0.000001 to OverMax
•••If rear is sliding nearly as fast as the front or even slower and the sum of rear and front sideways speeds is more than UnderThresh, then it’s considered understeering (sideways sliding)
••••do something to steering:
•••••calculate steer correction coefficient = part of the sum of rear and front sideways speeds that exceeds UnderThresh, divided by UnderRange
•••••If it’s still more than UnderMax, then cull it to UnderMax
•••••anyway, make this value negative
••••••result: negative steer correction coefficient in the range of -0.000001 to -UnderMax
•••If rear is not sliding much faster than the front (no oversteering) and both rear and front are not sliding fast (no understeering), then:
••••do nothing to steering:
•••••result: zero steer correction coefficient

•Check for spinning out:
••If rear and front are going towards opposite directions then
••• If the sum of rear and front sideways speeds (in different directions) is more than OverThresh, then it’s considered special oversteering (spinning around)
••••do something to steering:
•••••calculate steer correction coefficient = part of the sum of rear and front sideways speeds that exceeds OverThresh, divided by OverRange
•••••If it’s still more than OverMax, then cull it to OverMax
••••••result: positive steer correction coefficient in the range of 0.000001 to OverMax
•••If the sum of rear and front sideways speeds (in any direction) is within OverThresh, then it’s not oversteering (not spinning)
••••do nothing to steering:
•••••result: zero steer correction coefficient

•Adjust steering and acceleration accordingly:
••If it was understeering, i.e. sideways sliding (negative steer correction coefficient), then
•••adjust steering:
••••make steer correction coefficient positive
••••calculate actual steer correction amount = steer correction coefficient * SteerRatio
•••••result: steer correction amount in the range of 0.000001 to (SteerRatio * UnderMax)
••••add steer correction amount to actual steering value (turn more i.e. away from zero straight)
••••if it goes over SteerRatio, then cull it to SteerRatio
•••••result: new steering wheel angle
•••adjust acceleration:
••••calculate throttle correction coefficient = 1 - steer correction coefficient
•••••result: throttle correction coefficient inversely proportional to steer correction coefficient, in the range of 0.999999 to (1 - UnderMax)
••••if front is sliding faster than UnderFront and rear is sliding faster than UnderRear (going sideways fast), then
•••••throttle value becomes EngineRate (apply full brakes)
••••if front or rear or both are still somewhat under control
•••••throttle value becomes [-EngineRate * throttle correction coefficient] (apply throttle inversely proportional to steering correction intensity)
••If it was oversteering, i.e. excessively powersliding or spinning around (positive steer correction coefficient), then
•••adjust steering:
••••calculate actual steer correction amount = steer correction coefficient * SteerRatio
•••••result: steer correction amount in the range of 0.000001 to (SteerRatio * OverMax)
••••subtract steer correction amount from actual steering value (turn towards sliding direction and over zero straight if necessary)
••••if it goes over SteerRatio, then cull it to SteerRatio
•••••result: new steering wheel angle
•••adjust acceleration:
••••use the faster of the two: front sideways speed or rear sideways speed
••••if sideways speed is more than OverAccThresh, then
•••••calculate throttle correction coefficient = difference between sideways speed and OverAccThresh, divided by OverAccRange
•••••if it goes over 1.5, then cull it to 1.5
••••••result: throttle correction coefficient in the range of 0.0000001 to 1.5
•••••throttle value becomes (1 - throttle coefficient) * -EngineRate = in the range of -EngineRate (full throttle) to half EngineRate (half brakes)

Have fun!

-----
CW

[Edited for an important note about the number of wheels contacting ground]
[And edited again, because it turned out that Acclaim has used negative values for throttle and positive values for brakes for some reason...]

Posted: 03 Feb 2011, 15:01
Citywalker
Bump:
Edited for an important note about the number of wheels contacting ground.

-----
CW

Posted: 04 Feb 2011, 01:37
Huki
Ah, this is great stuff. Sorry I've been busy lately, so i couldn't read it sooner. I'm sure this will be very useful for anyone who wants to tweak the AIs.

PS: Few weeks ago I had said in PM that you can toggle on and off "auto-pilot mode" using a key (forgot which key, probably right-shift), if -gazzasaicar command line is used. You should use the command line and also enable Dev Mode or dev version of re-volt for this to work.

Posted: 04 Feb 2011, 08:38
Citywalker
(And how do you enable Dev Mode?)
Never mind, Jig already told me.

-----
CW

Posted: 18 Apr 2011, 13:49
Citywalker
Bump:
Edited again, because it turned out that Acclaim has used negative values for throttle and positive values for brakes for some reason... That was unexpected.

Posted: 17 Aug 2011, 10:53
Citywalker
Bump again.

Well. I think I have spent enough time trying to make Re-Volt’s AI work well with real-life style (RL) parameters. I have been thinking, testing, stumbling, swearing in frustration (yes, I occasionally do that :) ), and source code studying, and in conclusion of a few months I can say that I honestly think that Re-Volt’s AI coding is broken. It handles oversteering condition (rear-end sliding) a bit differently than understeering condition. (Huki, Jig, if you look at the source, can you confirm this?) That’s why it can’t control drifters and can’t do anything on ice. And as the RL style of parameters means a bit more sliding and inertia, the AI is not good with some of the stock cars in RL, regardless of how I have tried to transition the RC AI to RL AI. The conventional logic works for understeering, and for acceleration, but not for oversteering. I rest my case and will soon present the RL Stocks to RVZT with the RL AI that works for most of the cars, but not for all of them. I’m sorry, but Toyeca, Mystery and some others are too tail-happy for the RL AI. The RC AI can control them semi-well only because they are just that easy to control in RC. Just look at what RC Toyeca does in Neighbourhood 1. It swishes and spins out at every opportunity. It’s only saving grace is that it’s very easy to get back to the racing line with that car. (I strongly think that this saving grace is also the main reason why most people prefer it in online races, even if it remains a subconscious reason.) Whereas that same AI approach works well for even Pole Poz (it runs pretty good. Wide, but good) and Candy (good until it swishes its tail. Then it can barely recover at all), and naturally for the good old Volken.

Anyway, we knew that the Re-Volt AI can’t handle tail-happy cars, now I think we know why.

Posted: 22 Aug 2011, 03:15
jigebren
It handles oversteering condition (rear-end sliding) a bit differently than understeering condition.
Well, that sounds quite logical to treat oversteering and understeering differently as they are two different cases... So what's disturbing you exactly? If you have something in mind already, we need more details. Do you have an idea (or maybe just a presumption) about what could be wrong in the oversteering processing, and why it gives unexpected result?
Otherwise, it's hard to guess whether this tail-happy behavior is the result of a broken oversteering processing, or because the Car AI parameters are not optimal for some cars (at least on some surfaces), or because the AI route selection sometime fails, leading the car to a sudden change of direction (as it sometime seems for toyeca in nhood1).

Posted: 22 Aug 2011, 08:25
Citywalker
In understeer, it calculates steering correction (tempI = (steer * CTRL_RANGE_MAX) >> 16), then decreases the steering angle by that correction (tempI = pPlayer->controls.dx - tempI). This works well, i.e. the steering angle in understeer condition changes according to the car’s angle from the racing line.
In oversteer, it calculates it all in a single go (tempI = ((pPlayer->car.SteerAngle - steer) * CTRL_RANGE_MAX) >> 16). Result: the steering angle in oversteer condition becomes fixed to a value (8 or 16 mostly) and doesn’t change according to the car’s angle from the racing line.
Try with WolfR4 in dev mode, with some drifty car and the gazza option. See what the dx does in oversteer.

Posted: 23 Aug 2011, 17:32
Huki
Citywalker @ Aug 22 2011, 08:25 AM wrote:In oversteer, it calculates it all in a single go (tempI = ((pPlayer->car.SteerAngle - steer) * CTRL_RANGE_MAX) >> 16). Result: the steering angle in oversteer condition becomes fixed to a value (8 or 16 mostly) and doesn’t change according to the car’s angle from the racing line.
Hmm the shift by 16 only occurs for the Playstation case, not for PC. Does that change anything in your theory? Also, the understeer code seems to be changing directly the left/right input (dx), while only oversteer uses the SteerAngle in it's calculation.

Posted: 24 Aug 2011, 09:33
Citywalker
Warning: a long post.
Hmm the shift by 16 only occurs for the Playstation case, not for PC.
Well, I don’t think it changes my theory. The point is probably that:
the understeer code seems to be changing directly the left/right input (dx), while only oversteer uses the SteerAngle in it's calculation.
Where does the SteerAngle come from? I think it’s a variable that stores the current steering wheel angle, but the understeer code works perfectly with just dx itself, so there’s no need for it in oversteer, either. Oh, before you scream:
Well, that sounds quite logical to treat oversteering and understeering differently as they are two different cases...
The only difference between treating understeer and oversteer is handling the acceleration / brakes. Steering wheel is (i.e. should be, see below) turned smoothly towards the racing line in both cases. And the acceleration / brakes code works perfectly, in both cases.

The point is that, IMO, the use of SteerAngle in oversteer AI code is the source of error.

In the following explanation, I took the other condition than what I quoted in the above post, i.e. I now took plus calculations, not minus calculations. This is easier to explain and understand.

This is what the code currently does:
Understeer:
[The car is sliding left, i.e. dx is already positive and should become more positive.]
tempI = Int(steer * CTRL_RANGE_MAX)
tempI = pPlayer->controls.dx + tempI
pPlayer->controls.dx = (char)tempI

Oversteer:
[The car is spinning left, i.e. sliding right, i.e. dx is already positive and should become more positive.]
tempI = Int((pPlayer->car.SteerAngle + steer) * CTRL_RANGE_MAX)
pPlayer->controls.dx = (char)tempI

In understeer, the dx becomes itself plus (steer * CTRL_RANGE_MAX), i.e. not too much different from itself, i.e. it’s smoothly corrected, because steer is usually in the range of 0 to 1, because it is culled to UnderMax which is usually within 0 to 1.
BUT:
But in oversteer the dx becomes ((pPlayer->car.SteerAngle + steer) * CTRL_RANGE_MAX), which mathematically means (SteerAngle * CTRL_RANGE_MAX) plus (steer * CTRL_RANGE_MAX), i.e. whatever the SteerAngle is, it is multiplied by CTRL_RANGE_MAX and thus the resulting dx almost always exceeds CTRL_RANGE_MAX. Only if (pPlayer->car.SteerAngle + steer) is less than 1, only then the resulting dx is somewhere between 0 and CTRL_RANGE_MAX where it should be. In all other cases it becomes CTRL_RANGE_MAX and stays there until oversteer condition ends. The result: spinout, which ends quickly enough with e.g. RC Bandit so the AI can then recover with understeer corrections, but a more slidey car makes a 100-180 degree spinout before the spin stops and then it’s too late for understeering to kick in. And as steer is usually in the range of 0 to 1, because it is culled to OverMax which is usually within 0 to 1, the only time when the oversteer AI works properly is when the (mysterious?) SteerAngle is within 0 to 1 and even then it must not be more than the space that the steer itself leaves for it in that 0 to 1 range, otherwise the result of (pPlayer->car.SteerAngle + steer) exceeds 1 and then its following multiplication by CTRL_RANGE_MAX results in dx sticking to CTRL_RANGE_MAX.
And that is just a simple oversteer case when the wheels are already turned to kill the spin. Usually, though, the car enters the oversteer condition directly from an understeer condition, i.e. the wheels are still turned left when the car spins left. In that case the SteerAngle (if it is indeed the steering wheel angle) is still negative and oversteering AI works properly only if the SteerAngle doesn’t exceed the value of -(steer), i.e. somewhere within 0 to -1, otherwise the result of (pPlayer->car.SteerAngle + steer) is still negative and the resulting dx is also negative, i.e. the car turns MORE into spin instead of killing the spin.
In any case, that leaves a veeeery tiny range for the SteerAngle where oversteer AI actually works, because the dx is seen to move in the range of -127 to +127.

Long explanation made short: the AI programmer wanted to take a shortcut of typing or possibly a shortcut of thinking, and tried to consolidate the understeer idea of two lines:
tempI = Int(steer * CTRL_RANGE_MAX)
tempI = pPlayer->controls.dx + tempI
into a single line for oversteer:
tempI = Int((pPlayer->car.SteerAngle + steer) * CTRL_RANGE_MAX)
and failed to do it properly, or just made an error of thinking by bringing in the SteerAngle.
Anyway, oversteer part of the AI is broken, badly.

What should be done, is this: use the understeer code parts of steering correction for oversteer, too.
The oversteer code becomes as follows:
// Process oversteer ?
else if (steer > ZERO)
{
// Adjust steering
#ifndef _PSX
tempI = Int(steer * CTRL_RANGE_MAX);
#else
tempI = (steer * CTRL_RANGE_MAX) >> 16;
#endif
if (pPlayer->car.Body->FrontPointVelDotRight < ZERO) // Spinning right
{
tempI = pPlayer->controls.dx - tempI;
if (tempI < -CTRL_RANGE_MAX)
tempI = -CTRL_RANGE_MAX;
pPlayer->controls.dx = (char)tempI;
}
else // Spinning left
{
tempI = pPlayer->controls.dx + tempI;
if (tempI > CTRL_RANGE_MAX)
tempI = CTRL_RANGE_MAX;
pPlayer->controls.dx = (char)tempI;
}

This way the dx will follow the angle of car from racing line in oversteer too, just like it currently does for understeer.

Posted: 24 Aug 2011, 19:04
jigebren
Hmm, it seems that Huki and I are not the only one thinking hard here. ;)

Well, I did a few tests and I think you'll be interested to know that for example the toyeca on market2 never reach the oversteer case. Each time it's sliding (on ice or before the sliding door), it's understeering (just for info, some cars like zipper easily reach both states).
I think we agree toyeca behaves quite badly in this track, but now it means we can't incriminate oversteering management for that.

In fact I now have the feeling that no steering correction is really needed, as the correction can lead to a worse outcome (for example before the sliding door in market2). I tried to totally remove the under/oversteer correction, and weirdly the AI behavior rather seems to improve (tested in nhood1 and market2). On the other hand I think a throttle correction is still needed, and I believe it should be heavier than the current one. I have to do some other tests about it.

Don't hesitate to point me out the most interesting cars and tracks to test, btw.
And feel free to email me directly (you can include Huki as a copy) for further discussion/test results.

Posted: 25 Aug 2011, 08:50
Citywalker
Sorry, no e-mail, only PM and forums. Don’t ask, there are reasons for that.

“In other news,” I think your idea of removing the steering corrections and keeping the throttle corrections is superb.
I can suggest the following “interesting cars and tracks” :)

Cars:
• Try the semi-pros and pros in the Real-Life Stocks Pack (at RVZT), as these have higher inertia, lower friction and less enginerate. Totally difficult to handle for the current AI.
• Also Toy Copter 2 in Concepts Pack 2 (RVZT) – totally different steering scheme, and currently zigzags at straights.
• Caterpillar in Challenge Pack 2 (at RVZT) – very high turning inertia, impossible to control for the current AI.
• And this (pick parameters.txt before running the game):
https://www.yousendit.com/download/ZUd2 ... bHp2Wmc9PQ
A wheelie-popper. Amazingly, the RC version goes very well, but I haven’t been able to make it behave in RL version.

Tracks:
• Neighbourhood 1 as a generic test for curves and sudden jolts at high speeds.
• Neighbourhood 2 as the most varied stock course surface-wise – if they go perfectly there, they go perfectly most anywhere I think.
• Naturally, Test Course 5 - Ice Speed (RVZT) (ice is tc5 in this pack) – ice all the way.
• Mines of Alderon (RVZT) for hardcore – lots of jumps and turns. Most customs are not very good there, I think.
• Oh, and SS Route Re-volt – baaad track AI. The ultimate test, really :D

And I have tried removing steering corrections via parameters.txt as well, earlier (just made all 5 thresholds to 50k), but then throttle corrections are lost, too, so back then I concluded that the approach was not good. Now, if you can keep the throttle corrections intact, I think we may have a winner AI here :)

Posted: 17 Oct 2011, 08:01
Citywalker
news! News! NEWS!

The current best version of the tutorial:

1) The simplest AI is no AI:
Easier vehicles don’t need car AI at all. They run just fine with only track AI.
• Cancel out UnderThresh and OverThresh with a value of 50000. Ignore the rest.
Like this:
UnderThresh 50000
...
OverThresh 50000

2) If the vehicle is a bit difficult and has problems on ice or is just excessively tail-happy, then give it a tail-swing delimiter:
• Make OverAccThresh 50000 (no messing with acceleration) and OverRange and OverMax both 1 (for simplicity), and make OverThresh 50. That’s a good golden rule for all tail-happy vehicles that I have tried. Then see how the car does in the Supermarket 2 track (on ice and elsewhere).
Like this:
UnderThresh 50000
...
OverThresh 50
OverRange 1
OverMax 1
OverAccThresh 50000
If you still manage to find some car, for which OverThresh 50 is not good for some reason, then determine a better value from the range of 100 to 0, using the half-step method below. But usually 50 is a good balance between coping with ice and starting to miss some turns.

3) And then there are special cases.

3a ) If the vehicle just doesn’t steer at all with UnderThresh 50000, then use this:
UnderThresh 0
UnderRange 1
UnderFront 50000
UnderRear 50000
Cancel out OverThresh with 50000, and then find the highest UnderMax that lets the vehicle reach top speed, using the half-step method below (with range 0 to 1), on the track TC6 Concrete. Let the car run and see whether it swings or runs straight.
For example, Sprinter XL runs well with UnderMax 0.187500, although it’s incompetent on ice like this.

3b ) If the vehicle can’t hold a straight line with UnderThresh 50000 and can’t do it with UnderThresh 0 and UnderMax 0.000001 either, then the 1207 AI needs to be twisted beyond all recognition to run that vehicle, and I haven’t found a good method for that yet. I’ll be trying, though ;)

Tools you may need:
• For having the AI run the vehicle as a single car on a track: Re-Volt command line switches -dev and -gazzasaicar, then “Time Trial” or Editor: None option. (In-game: hold right Ctrl key to control the car yourself.)
• Track TC6 Concrete from this pack:
http://rvzt.zackattackgames.com/main/co ... +Ice+Speed.
• Whatever you use for mathematics :) I use a spreadsheet, some may use Calculator and Notepad.


And the half-step method:
• Set for yourself the adjustment range, e.g. from 0 to 1.
• First root value is in the middle of the range, i.e. 0.5
• First step is half-way from root value to edge of range, i.e. 0.25.

• Try the root value.
• If it fits, then you’re lucky :) You’re done!

•• If it’s too high, go lower by step (0.5-0.25=0.25).
•• Halve the step (0.25/2=0.125).
•• Try the new lower value.
•• If it’s too high, go lower by step again (0.25-0.125=0.125).
•• Halve the step (0.125/2=0.6125).
•• Try the new lower value.
• Go like this until you find a value that works. If you want, you can then continue upwards from that point to refine the value.

•• If the root value was too low, then go higher by step (0.5+0.25=0.75).
•• Halve the step (0.25/2=0.125).
•• Try the new higher value.
•• If it’s too low, go higher by step again (0.75+0.125=0.875).
•• Halve the step (0.125/2=0.6125).
•• Try the new higher value.
• Go like this until you find a value that works. If you want, you can then continue downwards from that point to refine the value.

That’s it. Have fun!

Posted: 24 Oct 2011, 08:14
Citywalker
A word about the Supermarket 2 ice in general: this is the absolute trickiest course that can be! It is not just a patch of ice, but an icy road with higher surface grip at roadsides (the snow areas). Ask any driver – this is the worst that can happen. As soon as the car touches the roadside, its one side gets better traction than the other side and all handling is thrown out of whack. In Re-Volt Supermarket 2, the car usually happens to get a good speed boost from snow and then it can’t compensate for that because it reaches the more slippery ice. The only way to get a clean pass there is to never touch the snow, i.e. clean entry, clean racing arc, clean exit. Tough to do for anyone, especially AI. Still, it _is_ possible if you get the good borderline UnderMax value from the TC6 track. I did it for both turn-on-a-dime BiWheel and half-drifter Nissy.

Just 10 short accelerations (including the first with no steering, to determine the top speed), and Candy Pebbles (!) can take Supermarket 2 ice with grace.

Posted: 14 Dec 2011, 10:29
Citywalker
Bumped for clean-up:
I joined two posts into one tutorial for the simplified AI, re-wrote the tutorial for more clarity, and the first post now links to it.
Short, simple, works.

Posted: 21 Dec 2011, 08:52
Citywalker
Bumped for more help:
+ Now states the exact number of AI runs for a good result.
+ It turns out the UnderMax value is the same for old V1207 and new V1.2 AI, but the V1.2 AI will likely far surpass everything this procedure can offer. So simplified AI is mostly intended for the old 1207 AI.
+ Also includes a default fallback value that runs anything decently (not always awesomely).

Posted: 31 Dec 2011, 12:54
Citywalker
And bump again:
+ I found a way to kill the tail-swing of tail-happy cars, with the same procedure.
The result is an absolute rail-handling AI. Only... does this kill all the fun too? :ph43r:

Again, first post links to the tutorial and, well, now this one links, too:
http://z3.invisionfree.com/Our_ReVolt_P ... p=10639164

Posted: 07 Jan 2012, 09:29
Citywalker
Okay, it seems that the KISS principle is the best principle. So I edited the tutorial. Trust me, it’s even simpler now ;)

Again, first post links to the tutorial and this one links, too:
http://z3.invisionfree.com/Revolt_Live/ ... &p=5309238

Posted: 21 Mar 2012, 10:02
Citywalker
Bump:
Two functioning options with constant values that don’t depend on the vehicle. How much more KISS could it be? :)
+ Track AI for all easy-handling cars.
+ Default culling of tail-swing for tail-happy cars.

This makes the first post a good read for general information, and also for deep tweaking if your vehicle is something special.

Again, first post and this post link to the tutorial itself:
http://z3.invisionfree.com/Our_ReVolt_P ... p=10639164

Posted: 22 May 2012, 08:25
Citywalker
So, the newest AI runs cars exactly the same way no matter what I put in the AI parameters. Huki once said something about making the AI drive any car well, no matter the AI parameters, so I think he has (semi?) silently done just that – stopped accounting for the AI params. And he also introduced some new params there, so, basically, I think V1.2 has lost all backwards compatibility with the old AI. And I can’t really do anything, because V1.2 doesn’t react to anything I do there. I can’t help the newest AI. Even where it has difficulties (like Skarma’s Skull Buster which works nice in old AI, but not in the newest V1.2).
Anyway, Huki is officially on his own now. I can’t help him, he has to get this AI thing in line without me providing helpful tweaks.
Basically, I feel like everyone wanting to change the AI to suit the car and not vice versa, are shut out until Huki releases some detailed info or makes the old/new AI a switch. Darn.
This means that I hereby officially state that all my AI tweaks are intended for the old AI and all complaints please be sent to Huki.
That is all.

Posted: 30 May 2012, 04:08
Huki
Hmm I had already answered about the recent AI changes, but I guess it's not easy to find among numerous other posts. I'm quoting it here:
hi&#045;ban wrote:Also, i've realised there are also some new lines in the AI section:
What are they for?
We had added those for testing purposes in some earlier release. Now they're not used anymore so you don't have to worry about them. We'll be removing them in the next release.
hi&#045;ban wrote:And out of curiosity what's going on with the AI? my cars now have some problems taking sharp turns...
Well, we're still trying different things with the steering correction. In this particular release, we've setup some generic correction that works for any car (the Under / Over values in the parameters file are not used). It has decent results most of the time, but it also makes certain sharp turns impossible (the same problem you've seen). Keep in mind that it's not finished yet.

By the next release, we'll decide whether to keep parameter based correction or detect instabilities and correct automatically, but for now you should use an older version to tweak the AI parameters...
So well, I don't think the trouble with turning you mentioned is specific to Skarma's car.. all cars have that problem because of the unfinished generic correction (for oversteer). FYI, we had started afresh since the last release and the current code is in fact safe (oversteer correction doesn't cripple the steering anymore), and it's quite close to the original code.

Anyway, in a few weeks we'll know how everything works out with the new AI (both jigebren and I are short on free time currently, so things go slowly). And if we find there is still a problem, we can always switch back to the old manual correction.

Posted: 30 May 2012, 21:39
Citywalker
because of the unfinished generic correction (for oversteer)
Well, in the old AI the problem seems to be that if the car enters the oversteer (tail-slide) condition with wheels turned max into curve, the OverMax of up to 1 is mathematically too small to let the wheels turn past straight zero to the other side to compensate. I increased the OverMax to 2 and tried, and OverSteer started working. Just to give a hint, Huki (or maybe that is what you found out already?)
(A test of that effect, albeit a bit twisted like my hacks usually are, is there (along with how to tune it for other cars): http://z3.invisionfree.com/Our_ReVolt_P ... p=22000509)
And if we find there is still a problem, we can always switch back to the old manual correction.
Well, you should allow manual correction in any case, because you just _cannot_ hard-code the game for every possible vehicle out there. It’s an unrealistic goal, both logically (you can never know everything that someone has or will use in their cars) and time-wise (distribute the time of AI tweaking between car-makers and AI-tweakers who generally know best the cars in question anyway).
(Yes, I’m occasionally falling into the same trap with my AI tweaks (find some single thing that runs everything), but I always end up with a procedure to tune for specific cars.)

Posted: 09 Aug 2012, 22:16
Citywalker
This is now only an archive of my earlier half-baked attempts 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. Warning: it only works with the old AI (V1207). Huki’s V1.2 still has some changes in race-code so it’s incompatible. I know because I tried tuning for his AI. Sprinter XL still did a U-turn on ice and already understeered on floors. So it’s old AI only for now.
It’s there:
http://z3.invisionfree.com/Our_ReVolt_P ... p=22000986

The rest of this topic is unchanged, except the first post.