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). Hukis V1.2 still has some changes in race-code so its 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 its old AI only for now.

Its there:

http://z3.invisionfree.com/Revolt_Live/ ... p=22058397

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

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

http://z3.invisionfree.com/Revolt_Live/ ... &p=5309238

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 dont 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.

Some of you no doubt already know that Huki and Jigebren at ORP 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 its 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 Ill 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. 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 dont 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 its 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 its 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 its 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 its 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 its 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 its 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 its 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! ^_^

[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...]

lol I'm lost ( I still have a lot to do in the last day of holidays )

That's very fantastic work :) I'll try to read it later and edit this comment