Advertisement

AI Movement and Acceleration

Started by August 05, 2008 02:40 PM
4 comments, last by IADaveMark 16 years, 3 months ago
I'm currently creating a football simulation and I've implemented the steering behaviors that are in the book AI Game Programming by Example into my simulation. I've got a simple seek behavior working properly, except for the acceleration and deceleration. It takes the players awhile to get up to maximum speed which is kind of unrealistic because humans can reach top speed fairly quickly compared to other vehicles. I'm wondering what I need to adjust to take that acceleration and deceleration into account using the methods in the book. I didn't see an acceleration property or anything, or maybe I just missed it or forgot about it. Any help would be greatly appreciated. *EDIT - I've converted all the code into C# just in case that matters. Actually I think I just answered my own question. I was looking through the source and found that acceleration is calculated by SteeringForce / mass. So if I adjust the mass it should affect acceleration and deceleration. I'll have to check that when I get home.
The simple acceleration->velocity->position motion model(like a rocket thruster?) is not appropriate for humans.

Humans have feet which effectively attach to the ground(really high static friction) then they change shape(leg joints) to move one foot in front of the other in turn.
This lets them stop nearly instantly, since no sliding is involved, he simply stops changing the shape of his leg position. And they can get moving again nearly instantly too, I'd say an acceleration comparable to gravity, since running is just falling forward, right?

Don't model the character as a hovercraft, because he isn't one.
Advertisement
Tell ya what... you start running full speed ahead and see if you can stop the instant someone tells you to. Same with changing direction.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Well I've got it almost to where I want it accept that when I arrive to the ball position, the players overshoot it and then slowly decelerate *past* the point to where they should arrive. In order to stop when told, humans need to decelerate a bit before they stop completely. I'm trying to get my players to do this and I thought that's how the arrive steering behavior worked, ie. decelerate before the arrival point so you don't overshoot it. It doesn't seem to be working that way and I'm having a hard time figuring out why. Any ideas?
Quote: Original post by ponyboy32
I'm trying to get my players to do this and I thought that's how the arrive steering behavior worked, ie. decelerate before the arrival point so you don't overshoot it. It doesn't seem to be working that way and I'm having a hard time figuring out why. Any ideas?


Roughly speaking, the speed at which you approach the target should be proportional to the distance to the target. This means that as distance to target approaches zero, your movement speed will approach zero, and thus you will finish exactly on the point you require (at least, after you fix the division-by-zero crash). Generally this combines with a clamp on top speed to have an actor travel at full speed until they reach a certain distance from the target, where they begin to slow down.

Craig Reynolds

Check them all out, but this one in particular is on-topic.

Arrival

The code is available in Java.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

This topic is closed to new replies.

Advertisement