Welcome Guest [Log In] [Register]
Welcome to Re-Volt Live. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add New Reply
Scratch-Made, Individually Tuned Car AI; Expert AI, proven, for old (and new) AI
Topic Started: Aug 9 2012, 04:38 PM (7,029 Views)
Gotolei
Member Avatar
Let's try something
[ *  *  *  *  *  *  *  * ]
Splitting off of the General Moss thread, I've been having a bit of difficulty with this.

Most of my confusion is the exact definitions of "oversteer" and "understeer" in the context of the AI engine. So far I've just been going off the assumption that 'oversteer = too close to or hitting apex' and 'understeer = hitting outside of turn or braking to avoid said hitting.'
It doesn't specify.. oversteer means put -1 in a cell and understeer means put +1?
What exactly are OverMax/UnderMax and the tweaked values UnderThresh/OverThresh doing, and what behaviors should I watch for?
How do you quantify accuracy on a slippery surface without any walls around?

Does this apply for all versions of 1.2 after and/or including 13.0815?

Also I'm running -dev -gazzasaicar and I'm not getting any text feedback for AI State or anything in Edit Mode: None. Is that a key combo or something?
Didn't know about the other gazza arguments, found on wiki.
Posted Image
Offline Profile Quote Top
 
Citywalker
Member Avatar
Resident Tinkerer
[ *  *  *  *  *  *  *  *  *  *  *  * ]
Okay, time for some Q&A.

Q1: I'm running -dev -gazzasaicar and I'm not getting any text feedback for AI State or anything in Edit Mode: None. Is that a key combo or something?
A1: The data is an unneeded distraction anyway, AI tuning is purely visual. See that yellow circle leading the car? It marks the middle of the next track segment, on the race line. The point is to see how well the car follows that lead. Even walls are irrelevant, everything depends on where the race line was put.

Q2: Most of my confusion is the exact definitions of "oversteer" and "understeer" in the context of the AI engine. So far I've just been going off the assumption that 'oversteer = too close to or hitting apex' and 'understeer = hitting outside of turn or braking to avoid said hitting.'
A2: Swinging the rear too much in a curve and then failing to straighten up, or even rear-ending itself – that is oversteer. Going too straight in a curve and blasting right out of it – that is understeer for Re-Volt AI.

Q3: What behaviors should I watch for?
A3: The tuning values (tuned Threshes with appropriate Max pair) should hit the sweet spot (the “fringe”) between the car oversteering and the car understeering (see question 2) where the car is able to smoothly follow the leading circle i.e. the racing line.
a) Choose the easy runner setup. See whether the car is on oversteer or understeer side of the fringe. If it runs well with that setup, it’s an easy runner and needs no tuning.
B) If it’s not an easy runner then choose the oversteer pair or understeer pair for the Maxes, depending on what the car did with the easy runner setup. Then tune the Threshes to find the fringe (sweet spot where the car smoothly follows the lead / race line).
c) If there’s no fringe (you end up with a value that both oversteers and understeers in different places) then try the powerslide pair or even the normal steer pair. There are very few cars that completely stump the AI (they usually have highly special physics).
d) Also, Re-Volt’s static AI might not be able to cope with both very slow slides and very fast slides with the same car, so cars with very high top speed may need a compromise: tune for low speeds on twisty tracks or high speeds on smoother tracks.

Q4: It doesn't specify.. oversteer means put -1 in a cell and understeer means put +1?
A4: -1 simply makes the next Thresh value lower and +1 makes it higher (for the stepwise fine-tuning). The Max pair is what depends on oversteer, understeer or powerslide/drift behaviour. (I thought the spreadsheet specifically specified that?)

Q5: How do you quantify accuracy on a slippery surface without any walls around?
A5: The same way – observe it following the lead circle and see that it stays within the track section’s AI borders (coloured lines). See question 1, walls are irrelevant.

Q6: Why choose the oversteer pair and not the normal steer pair (normal implies, well, normal)?
A6: It’s easier to choose this way. The oversteer pair covers both difficult and simple cars that oversteer with easy runner setup, whereas the normal steer pair is good for only simple cars and some exceptions. There are very few cars that can’t find the fringe with the oversteer pair while finding it with the normal steer pair.

Q7: Does this apply for all versions of 1.2 after and/or including 13.0815?
A7: See the latest alpha’s readme, it says when the AI was made experimental and when it was mostly restored again. Anything after that period, and definitely anything before uses the AI params.

Q8: What exactly are OverMax/UnderMax and the tweaked values UnderThresh/OverThresh doing?
A8: A very detailed answer: there.
A much simpler answer, in the context of the greatly simplified AI tuning method i.e. the “fringe” method:
• Here, OverMax/UnderMax simply determine whether the car compensates towards inside or outside when sliding in a curve. OverMax sets the steering direction when oversteering, UnderMax sets it in understeer situations. Why 1.0/2.0? That comes from the AI code.
• UnderThresh/OverThresh set the threshold for side-sliding speed – side-slide faster and the car compensates, side-slide slower and the car doesn’t bother. The side-slide speed unit is Re-Volt code’s arbitrary unit, that’s why visual tuning is better – the on-screen numbers make no sense (at least to me). Why is the threshold identical for oversteer and understeer situations? First: for the sake of simplicity in tuning. It would be too time-consuming to tune both Threshes separately, and most oversteering cars never hit an understeer situation so the UnderThresh value is not important for them (and vice versa).
• [Advanced info: Second: difficult oversteerers sometimes need to start countersteering before actually starting a rear-swing i.e. while still in understeer situation (high-inertia cars like Skarma’s Skull Car) (that’s why the oversteer Max pair redirects the AI code to use oversteer code also for understeer situations (with negative UnderMax)) and some drifters perform best when balancing a powerslide with compensating more into turn and sometimes alternating with countersteer (with reversed handling of under/oversteer situations (both Maxes negative)).]
• [Advanced info: The fringe is actually the highest side-sliding speed that the car can handle without compensating. Every car handles differently and thus has a different fringe, hence needs a different Thresh. Easy runners never slide, so they need no compensating (hence the 5000 Threshes).]

So, anything/anyone else? <smiles>
All my stuff is available here, and all my videos are available there.
-----
CW
Offline Profile Quote Top
 
gPstr
Junior RC
[ * ]
Just briefly... (no, really - I'll keep it brief)

I had no idea this thread even existed until earlier today. I'd been working off of your older information.

Now I have a better idea what you were asking about on that other thread.

And now I'll have to see if I can sort out this AI stuff. Thanks.


*edit*

And...

As near as I can tell, I still have the same problem. I must be missing something, but I can't see what it might be.

I tried this approach to tuning the AI for the TDR NSX (on 8 on Ice) and got nowhere. I can't get numbers for UnderThresh and OverThresh since the car can't even make it as far as understeering or oversteering, since the AI can't even get the car to move forward, since it doesn't throttle correctly.

So... is there a specific reason that you've negated the OverAccThresh and OverAccRange numbers? Those seem to be the ones that I need to get set first for this car before it can even make it as far as determining whether it understeers or oversteers and I can't see how I can do it any other way. I took it half-step-wise all the way down to 0.00something-or-another with really no notable change in its behavior at any point, since none of that behavior had anything to do with steering - it didn't even make it as far as steering. It just stood on the gas, swung the tail around, straightened it out, stood on the gas, swung the tail around, straightened it out...

Should I just give up on tuning a car that tail-happy on 8-on-Ice? Or is there something to be gained from adjusting the throttle numbers and you just didn't include it in this meant to be simple how to? Or am I just an idiot?

And supporting that last possibility, I need some clarification. In your explanation, you say,
Quote:
 
• 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...

What does this actually mean? What are those numbers representing? They can't be the actual values that are to be plugged into the fields in the parameters.txt, can they? You specify further up that OverMax has to be between 1.0 and 2.0, so how could it be -1.0? So does that represent a (half) step? Then why the 2.0 or -2.0? Two half-steps? That doesn't make sense either.

In the meantime, I think I'll go back to doing something that doesn't make me gnash my teeth. Thanks in advance for any assistance.
Offline Profile Quote Top
 
Citywalker
Member Avatar
Resident Tinkerer
[ *  *  *  *  *  *  *  *  *  *  *  * ]
Okay, first of all – thanks for asking, so I know what remains unclear.

Quote:
 
It just stood on the gas, swung the tail around, straightened it out, stood on the gas, swung the tail around, straightened it out...

That is also oversteer.
A key point that people seem to have difficulty understanding: doing donuts = oversteer in Re-Volt coding. Everything else goes from that.
So try the oversteer pair and don’t worry about the OverAccThresh and OverAccRange numbers.

Quote:
 
with really no notable change in its behavior at any point, since none of that behavior had anything to do with steering - it didn't even make it as far as steering.

Heyyy, it did steer. Just not soon enough.

Quote:
 
So... is there a specific reason that you've negated the OverAccThresh and OverAccRange numbers?

Yes, there is. I wanted to make this method as simple as possible, so anyone could do it by blindly following the steps described <soft laugh>. Even _I_ follow it blindly now, so I don’t have to invent the wheel every time. Still, I’m glad I’m not the only one willing to do deep thinking :)

But more specifically – the approach works.
1) Even theoretically, almost any steer situation can be corrected at full throttle if steering correction starts soon enough. How soon, is determined by Threshes.
2) The AI coding actually does correct throttling even without the OverAcces. Quote from the other topic with deep technical info:
• 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.

So the AI tried to do the best it could with your car (if you did use the oversteer pair), just the sliding threshold before starting to correct (the Threshes) was too wide.

Quote:
 
What does this actually mean? What are those numbers representing? They can't be the actual values that are to be plugged into the fields in the parameters.txt, can they? You specify further up that OverMax has to be between 1.0 and 2.0, so how could it be -1.0?

Yes, they can. See again the oversteer pair’s description:
•• 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

Specifically: “routed to oversteer code”. RV AI is mathematics, formulae, like any other programming. What’s so perfect about RV is that it has _no_sanity_checks_ anywhere. I can plug a negative value into its AI formulae and the code runs with it, simply going to the opposite case (due to no checking), i.e. in understeer situation with negative UnderMax it calculates with the oversteer code-part and thus reacts like in oversteer.
Why is this necessary? Because of this (quote from my other AI post of Q&A):
• [Advanced info: Second: difficult oversteerers sometimes need to start countersteering before actually starting a rear-swing i.e. while still in understeer situation (high-inertia cars like Skarma’s Skull Car or the original Caterpillar/Digger) (that’s why the oversteer Max pair redirects the AI code to use oversteer code also for understeer situations (with negative UnderMax)) and some drifters perform best when balancing a powerslide with compensating more into turn and sometimes alternating with countersteer (with reversed handling of under/oversteer situations (both Maxes negative)).]

Also, to answer your earlier concern that having Threshes in thousands for one car and in six-decimal-precisions for another car seems unrealistic (quote again from my Q&A):
• UnderThresh/OverThresh set the threshold for side-sliding speed – side-slide faster and the car compensates, side-slide slower and the car doesn’t bother. The side-slide speed unit is Re-Volt code’s arbitrary unit, that’s why visual tuning is better – the on-screen numbers make no sense (at least to me). Why is the threshold identical for oversteer and understeer situations? First: for the sake of simplicity in tuning. It would be too time-consuming to tune both Threshes separately, and most oversteering cars never hit an understeer situation so the UnderThresh value is usually not important for them anyway (and vice versa).

Custom cars can be wildly different in handling, so I have factually encountered both cases: Threshes in thousands for one car and in six-decimal-precisions for another.

Quote:
 
You specify further up that OverMax has to be between 1.0 and 2.0, so how could it be -1.0? So does that represent a (half) step?

Okay, I understand that the two things can get mixed up: -1.0 / +1.0 Maxes in parameters txt as the calculation factor for RV AI code, and -1 / -+1 in spreadsheet as the calculation factor for the spreadsheet’s formula. And I’m sorry, but the -1 / +1 input method in spreadsheet is just so simple to use (both for the tuning people and for me when writing the spreadsheet formula) that I couldn’t find a better (less confusing) way there.

So, I hope I made things a bit more clear now.
All my stuff is available here, and all my videos are available there.
-----
CW
Offline Profile Quote Top
 
Citywalker
Member Avatar
Resident Tinkerer
[ *  *  *  *  *  *  *  *  *  *  *  * ]
Just a bump, because I cannot edit my first post currently:

N.B.: A key point that people seem to have difficulty understanding: doing donuts = oversteer in Re-Volt coding.
All my stuff is available here, and all my videos are available there.
-----
CW
Offline Profile Quote Top
 
gPstr
Junior RC
[ * ]
Thanks for the reply.

Unfortunately though, as near as I can tell, it's just not possible with this method to make a rear-heavy RWD car handle on ice. I've been working both with the TDR NSX and with my new FV1, which isn't quite as heavy in the rear, but still shares that basic weight distribution, and the basic problem.

With a couple of the pairs, I can step it down to the point at which it no longer simply swings back and forth, but then what it does is drives straight (thus avoiding oversteer) until it's running out of track and has no choice but to turn, then it goes into the tail swings. With the powerslide pair, I can get it to a point at which it at least minimizes the swings - it goes so carefully and corrects so aggressively that it swings in diminishing arcs until it can go straight again for a bit before it has to turn again and starts swinging again. The problem with that though is that those numbers, on any other track, just make it drive head-first into every wall. Alternately, I can (and did) find numbers that work quite well on other tracks, but they're completely useless on ice.

I suspect that if it's even possible to get it to work on ice (and it might not even be possible) it'll require skewed threshes, since that particular geometry never really does steer simply - the whole trick to driving it is to balance its tendency to understeer at speed with its tendency to oversteer under braking, and if you get it balanced correctly, you make the corners by powersliding through them. That's just too many different things for the AI to deal with on ice. Though I do have to say I'm pretty impressed by how well it does it elsewhere. It's still not perfect - it struggles with quick hairpins, but it's pretty impressive all in all, and certainly better than I could do otherwise. Jumping off from those numbers, I've been experimenting a bit (and had a bit of success) with skewed threshes and some other things, but haven't found anything really notable yet.

On another note, do you know what it is that gazzasaiinfo returns when it flashes "understeer" or "oversteer?" Is that the perceived state of the car at the beginning of whatever it is that the car does? I ask because it caught me off guard the first time I was watching it and it flashed "understeer" as the car was whipping around 180 degrees and crashing into the inside wall. That's not, by any stretch of the imagination, understeer, so all I can assume is that the game read it as understeering at the beginning of that and the resulting oversteer was an overcorrection. All I saw was oversteer though.

And yeah - I've noted that you advocate visual tuning over that input, and it's possible that that sort of thing is exactly why. But still... I do this sort of thing intuitively - that's how I learned to tune - by driving the cars and watching how they behave and changing numbers and seeing how that changed their behavior. So it's potentially significant if what I saw as nothing but oversteer is, one way or another, tied to "understeer" as far as the game is concerned.

And... that's all I've got at the moment. Again - thanks for the response. I've been wanting to sort out this AI business for years now. Your early posts on the subject were the first real useful insight I got into them, but they weren't enough to give me enough of a basis to intelligently change things. I'm finally getting to the point at which I can change some things and have at least some sort of idea of what sort of behavior to expect, so I then know what to watch for and see if I'm right or wrong.

And whenever my brain is tired of doing that, this method really does seem to work. Except, possibly, for rear-heavy RWDs on ice... :D
Offline Profile Quote Top
 
Citywalker
Member Avatar
Resident Tinkerer
[ *  *  *  *  *  *  *  *  *  *  *  * ]
Quote:
 
it goes so carefully and corrects so aggressively that it swings in diminishing arcs until it can go straight again for a bit before it has to turn again and starts swinging again. The problem with that though is that those numbers, on any other track, just make it drive head-first into every wall. Alternately, I can (and did) find numbers that work quite well on other tracks, but they're completely useless on ice.

That’s what I have seen with some of the most tricky vehicles, too. The problem comes from the fact that RV’s AI is static. See more below.

Quote:
 
the whole trick to driving it is to balance its tendency to understeer at speed with its tendency to oversteer under braking,

Exactly, RV’s static AI cannot do that – it monitors absolute slide speeds, instead of monitoring something like e.g. rotational speed. This means it starts correcting relatively too early at fast speeds (if the Threshes are set for lower speeds) or relatively too late at slow speeds (if the Threshes are set for faster speeds).
I’ve encountered these problems with 1) vehicles having a wide driving speed range (very fast top speeds), 2) vehicles having a wide side-sliding speed range (drifters).
So no, I guess you cannot make these cars drive well on both ice and tarmac, and drive perfectly in both sharp and fast corners. But, they can be made decent, as you already did.

Quote:
 
I ask because it caught me off guard the first time I was watching it and it flashed "understeer" as the car was whipping around 180 degrees and crashing into the inside wall.

I’m only guessing at the actual situation here, so I considered two possibilities:
1) If “understeer” just flashed on and then remained on, with numbers also stopping steady, until the car hit the inside wall, then the track zone probably ended before the car reached the wall. RV’s AI goes into “special” hard-coded recovery mode when outside track zones, and IIRC it also stops displaying any changes through gazzasaiinfo then. So the car _was_ in some remnant of understeer (front wheels sliding faster than rear wheels), but slid off the track before the AI could do anything, and then the AI went dumb;
2) If “understeer” flashed intermittently, i.e. “understeer” and “oversteer” showing alternately then it was a borderline case of a) front and rear side-sliding speeds being nearly zero and also near Threshes (with very low Threshes), or B) just the Threshes being too low for the particular car’s very good steering response. In both cases, even a slight correction pushed the situation to the other *steer side, resulting in a jittering steering response with no effective correction, and then it again slid off the track zone before the AI could do anything, and then the AI went into dumb recovery mode without showing what it did anymore (happening to show the “understeer” line as the last jitter).

Well, that’s the best I can do in a “dial a GP for a diagnosis” situation :)

Quote:
 
Your early posts on the subject were the first real useful insight I got into them, but they weren't enough to give me enough of a basis to intelligently change things.

Well, was this still too vague? :) (see “+ Parameters.txt explained: (Candy Pebbles)” and “+ Programming explained:”) I wrote a step-by-step description of what the AI code does, there. Everything else AI-wise from me stems from that, actually.
:/ OTOH, it _did_ take me a couple of years to get to the FringeAI myself :)

P.S. I looked at your FV1’s parameters.txt: please, edit the old comments in its AI section. _I_ know by the Max pair’s values that you used the powerslide pair there, but for others all the “easy runner” comments are confusing. Or simply remove the comments altogether if that’s easier for you.
All my stuff is available here, and all my videos are available there.
-----
CW
Offline Profile Quote Top
 
gPstr
Junior RC
[ * ]
Citywalker,Friday, Jan 16 2015
15:33
This means it starts correcting relatively too early at fast speeds (if the Threshes are set for lower speeds) or relatively too late at slow speeds (if the Threshes are set for faster speeds).
I’ve encountered these problems with 1) vehicles having a wide driving speed range (very fast top speeds), 2) vehicles having a wide side-sliding speed range (drifters).

Yeah - I think the problem with this particular geometry is that the margin for error is very small, and the point at which the error can be made varies with speed. With the additional weight in the back, it has a natural tendency to understeer. In order to get a tight controlled turn, you really need to at least lift off the throttle for a second, to shift some weight to the front and get enough traction to overcome the understeer. But if you shift just a bit too much weight to the front, the rear loses traction, and then that additional weight in the rear makes it just that much more likely to come whipping around. Basically, by the time the rear end starts to come around, it's already too late. It's possible to get it pretty well balanced on normal surfaces, because there is still some margin. I suspect that, as far as the AI is concerned, there's literally no margin on ice - as soon as the rear starts to let go at all, it's already too late. I can barely manage to get it around a full lap of 8 on Ice without sliding out somewhere myself.

Quote:
 
Well, was this still too vague? :) (see “+ Parameters.txt explained: (Candy Pebbles)” and “+ Programming explained:”) I wrote a step-by-step description of what the AI code does, there.

That's pretty much what I have, and what I was referring to. That appears to be a later version of the one I have (I happened across it on a forum - maybe this one - and copied it to a text file. That would've been a couple of years ago or so). It's most of the same phrasing though, and the same Candy Pebbles example. And I've poured over it so many times that I've got most of it memorized.

I'd hesitate to say that it's "too vague." It's a reasonably clear communication of what you understood about the AI at the time (which was far, FAR more than I did). Its shortcomings are simply the things that were not understood - what the numbers specifically denote, what sort of ranges they have, that sort of thing. Combined with my lack of patience for blindly flailing away at things I don't understand, it just didn't provide enough of a basis for me to really make any progress on sorting out how the AI actually works.

It was like getting a recipe that just listed all the ingredients and some possible ranges of proportions. Since I didn't even know what the ingredients were before that, it did help, but I still had no idea if I needed a cup of this or an 1/8 teaspoon or anything anywhere in between.

The fringe tuning thing helps a lot, not simply by providing a method for tuning, but by isolating the most significant numbers, which gives me an opportunity to set up some constants, so then I can play with some of the other numbers and stand a better chance of sorting out their meaningful ranges and such. Hopefully.

I didn't even consider deleting the comments on the AI. I just tabbed them out of my way and called it good with that. I guess I could update it - it seems hardly worth the effort though. I would think that anyone who doesn't recognize those as your default comments isn't going to gain anything useful from poking around in those numbers anyway. But yeah - I suppose I could do that.

*edit* - and it's done.
Offline Profile Quote Top
 
Citywalker
Member Avatar
Resident Tinkerer
[ *  *  *  *  *  *  *  *  *  *  *  * ]

Quote:
 
I suspect that, as far as the AI is concerned, there's literally no margin on ice

Exactly, that’s what I call “too narrow fringe” or “no overlap” in the tutorial.

Quote:
 
Since I didn't even know what the ingredients were before that, it did help, but I still had no idea if I needed a cup of this or an 1/8 teaspoon or anything anywhere in between.

Yeah, well, with Re-Volt it’s like make-your-own-nutty-cake in some ways :), with no sanity checks anywhere (not only AI). It’s how I got to negative Maxes, really – I just got a flash of inspiration and tried it.

Quote:
 
I would think that anyone who doesn't recognize those as your default comments isn't going to gain anything useful from poking around in those numbers anyway.

Well, the AI tuning tutorial (the latest shorty one with the spreadsheet) was written _specifically_ to allow dumb following of steps to reach a meaningful result, so thanks for clearing the comments.
(I even considered a way to make this fully automatic somehow, but I couldn’t find good automatics to replace human visual assessment of tuning results...)
All my stuff is available here, and all my videos are available there.
-----
CW
Offline Profile Quote Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
DealsFor.me - The best sales, coupons, and discounts for you
« Previous Topic · Car Tutorials · Next Topic »
Add New Reply