Extension to Reynold's Seek Steering Behavior

Started by
3 comments, last by CuppoJava 18 years, 10 months ago
Hi, I'm just programming some simple AI for my game engine, and I read over Craig Reynold's page on Steering Behaviors. http://www.red3d.com/cwr/steer/gdc99/ That's the URL for anyone interested. I highly recommend the read, most of it is quite intuitive and its really useful for anyone looking for some motion control algorithms. Anyways, as for the Seek behavior is there a way to extend it to take into account a minimum velocity? ie. I never want the vehicle to go below a certain velocity. Thx for your help. And especially to Oliii for pointing me to craig's page in the first place. -Cuppo
Advertisement
It should be quite straight forward. The equations he uses are 'made up', and not based on anything really accurate. They just feel right. I adapted his stuff for tank steering (can't strafe), and I just had to come up with a decent approximation.

for the equations with minimum velocities, I guess you'll have to experiment. It's a very open system.

A simple guess,

velocity = truncate (velocity + acceleration, max_speed)

replaced by

velocity = truncate (velocity + acceleration, min_speed, max_speed)

but limiting with minimum velocities might cause problems (collision responses, ect..).

Everything is better with Metal.

Thx for the response oliii,
His equations are made up? So they're not really accurate or guarantee anything in particular, ie. shortest path or shortest traversal time?

Well I guess that's still enough for a game, the problem that I see with limiting the minimum velocity, is for this situation:

If the plane is currently facing North, and the target was directly Behind it.
It would be unrealistic for the plane to slow to a crawl and then accelerate in the other direction. It would have to turn. I was hoping their was some simple code to do this.

I cooked up some code, but its quite messy with conditional statements all over the place.

-Cuppo
That's my understanding. It's a relatively accurate way of doing things, but for the seek pattern, it seems not very physiologically accurate. For the reach pattern, that's more like it.

As for moving a plane towards a aim point, it's like steering a car towards a similar aim point (say, an apex).

That will depends on the physical properties of the vehicle. For a car driven by an agent, you could come up with throttle and steering inputs given the car velocities, grip of the car, turning radius and braking force / engine force required to reach the target (that will generate centrigugal force), so that you drive on the limit. For planes, you can do the same, but the constraints are different.

His agent code is mostly for very basic pedestrians, who have little constaints (they can move quite hapily sideways, abd backward), and are limited only by max acceleration, and max velocities.

That's where his movement equations came from.

For my tank, I adapted that slightly because a tank can't strafe, and that gave me very simple tank A.I. good enough for games.

Anyway, whatever the type of agents, what you require from the agent, is his position, velocity, and the behaviour system will give you attract points, a repulse(?) point, that you pass to the vehicle so that the vehicle constraints can use that to generate new dynamics all by itself.

That's what I use anyway. A set of attractors and repulsors point / collision planes / whetever, passed to the vehicle by the A.I. behaviour controllers, and the A.I. driver use that, with the vehicle dynamics, to steer the vehicle away from danger, and towards the goals.

Pedestrians would do like in the docs, tanks would do it slightly differently, planes would do it another way. Depending on the distance, influence, and attraction of the control points / collision planes / ect..., and the vehicle limits, you steer, brake, accelerate, ect...

That's just my way of thinking. His system is great, but I don't think it's ment to be taken litteraly for more complex vehicles.

VEHICLE -----(position, speed, direction)---> BEHAVIOUR ---(attract point / repulse point / collision planes)---> DRIVER ---(steering / throttle / brakes)---> VEHICLE.



Everything is better with Metal.

Okay,
I'll do a bit more tweaking then and see what I come up with.
At least this basic extensible framework is setup now so I don't need to worry about that.

Thanks again oliii.
-Cuppo

This topic is closed to new replies.

Advertisement