# Reynolds Steering Behaviour and Optimal Control? missile guidance?

This topic is 4114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've been looking at Chris Reynolds' steering behaviours (http://www.red3d.com/cwr/steer/). The seek and arrive behaviours are pretty much the same, except that the seek behaviour wants to reach the target in the fastest time (the velocity when it reaches the target doesn't matter), whereas the arrive behaviour wants to settle at the target (have zero velocity on the target). A naive implementation is to apply a force towards the target, but that can lead to problems - it doesn't take into account the vehicle's velocity tangential to the line between the vehicle and the target, so the vehicle can end up orbiting the target. Instead, Reynolds adds a force which is the difference between the desired velocity towards the target and the vehicle's current velocity. However, even though this results in the vehicle always steering towards the target it's not optimal. The steering force only depends on the vehicle's velocity, but to reach the target quicker, it should apply a larger force to oppose the tangential component of the velocity if the vehicle is nearer to the target. i.e. there's an optimal path to the target that depends on both the vehicle's velocity and location. Similarly, for the arrive behaviour, there is a fudge factor to reduce the acceleration towards the target over a number of time steps. This seemed to me better implemented as a PID control. But we can't simply introduce a PID control there as the location and velocity are coupled (we have a multiple input multiple output control scheme). The problem is that the velocity tangential to the line between the vehicle and the target should be reduced, then the velocity towards the target has different constraints on it (for seek minimum time to target, for arrive minimum time to target but with zero velocity). It's probably overkill for games, but would an optimal control scheme be suitable for this? I've been trying to read up and find an example on how to design and implement optimal control on the internet but can't really find much information. This must be a similar problem for missile guidance in games - how do games implement missile targeting? (or do they even?) Sorry for the rambling post. Thanks! Gary

##### Share on other sites
PID controllers?

http://en.wikipedia.org/wiki/PID_controller

I would look into those if you are searching for a good solution (not optimal, PID don't provide optimal).

For missiles, I think they constantly overshoot their target. Try that, it's easy enough.

There are other ways, It's quite fun to program a missile guidance system. You can also 'predict' where the target will be.

http://members.gamedev.net/oliii/ai_aim.zip

[Edited by - oliii on July 17, 2007 10:12:33 AM]

##### Share on other sites
Hi oliii,

Thanks for the reply. As I said in my post, for the arrive behaviour, to have smooth slowing down towards the target, then introducting a PID controller would be ideal.

The problem is is that this would work nicely in the 1D case; I'd have a PID control dependent on the distance from the target. In the 3D (or 2D) case, you have a component of velocity that is tangential to the line between the vehicle and the target, and a component towards the target.

Reynolds does provide an oversteer to the vehicle, but it's constant, and I want to find the -optimal- amount of oversteer to apply. That depends on the location and velocity of the vehicle towards the target. The amount of oversteer should be greater if I'm moving faster towards the target, or if I'm nearer to the target. And obviously I can't predict the time to reach the target unless I take into account that PID action.

I have a multivariate control situation (http://lorien.ncl.ac.uk/ming/mloop/MULTIVAR.pdf) and was thinking that optimal control (http://en.wikipedia.org/wiki/Optimal_control) would help me reach the target in the fastest possible time (rather than having a guess at the oversteer). I don't suppose you know whether any games actually go to this length? Do you have any resources on prediction? I was thinking I may be able to use a predictor-corrector control.

Cheers,
Gary

##### Share on other sites
Here's what I did, and it's nothing special:

You have a velocity for the missile, and a direction to the target. The force applied should be in the direction that is some ratio C between them.

You don't have to necessarily predict where the target is going to be at some point in the far future, just predict where it is going to be, if its velocity remains constant, at some time L (which anecdotally, I've found 2.5s works well).

Because I was also looking for an optimal general case solution, I ran a series of simulations over about a day. It created a random position and velocity for the target and missile. Then it would try to find an optimal C and L for that scenario. Any scenario where the missile had to travel more that four times the initial distance to the target was considered a failure. The result was that although each of the situations do have an optimal solution, generally the problem does not. The "best fit" that provided a successful hit was C ~ 0.5 and L ~ 2.5.

1. 1
Rutin
36
2. 2
3. 3
4. 4
5. 5

• 11
• 10
• 13
• 98
• 11
• ### Forum Statistics

• Total Topics
632974
• Total Posts
3009654
• ### Who's Online (See full list)

There are no registered users currently online

×