Advertisement

Homing Missile AI in 3space with momentum (hard!)

Started by June 27, 2002 07:04 PM
39 comments, last by feral 22 years, 7 months ago
Give the man a break Timkin. He has no idea of your background and just wants to get a point across. He''s been polite throughout. Your first sentence in this thread is much more emotive than anything ''a person'' has said... and in effect is doing just what you are accusing ''a person'' of doing - questioning our understanding of the problem.

Maybe you are having bad day eh?




Stimulate
quote:
Original post by fup
Give the man a break Timkin. He has no idea of your background and just wants to get a point across. He's been polite throughout.



I don't see it that way fup. I have no idea of your background and yet I still treat you with respect and courtesy... as I do with everyone on these forums. Telling someone that they don't understand something because they find a mistake in your work IS discourteous. Clearly they'd have to have some understanding to know it was a mistake. To then persist and suggest that they might understand the maths but not how to apply it is again impolite, unfounded and simply unecessary. It doesn't make for polite discourse... as can be seen by the way this thread has ended up! It would be far better to discuss the situation rather than to make accusations.

quote:
Original post by fup
Your first sentence in this thread is much more emotive than anything 'a person' has said...



Having gone back and re-read that sentence again - to make sure that it couldn't be horribly misconstrued - I cannot agree with you fup. However, if anyone DID take offense to it, I certainly offer my sincere apologies.

To consider my first sentence more closely... I stated that what I was saying was based on what had been written, not on what I thought people did or didn't know. Up to that point there was no evidence in what had been written that anyone had considered the decrease of relative velocity as a solution... and so I see it as perfectly legitimate to suggest that this might have been forgotten about. Note, that I didn't say it HAD been forgotten... only that it seemed to have been forgotten. Secondly, relative velocity IS a fundamental and very basic concept in the physics of multi-body kinematics, so my labelling it as such seems appropriate. If you disagree with me, I would be happy to discuss it further privately.

quote:
Original post by fup
...and in effect is doing just what you are accusing 'a person' of doing - questioning our understanding of the problem.



Again I disagree. It doesn't question the understanding of the problem, but indicates that there is something that may not have been considered as a solution method. Going by what people wrote I am certain that each person that responded understood the question and the problem. I do not believe I made any statements that were - or could reasonably be construed as - impugning anyones knowledge or understanding.

quote:
Original post by fup
Maybe you are having bad day eh?



No, fup, that is not the case. My last post was to point out that people should not make personal comments (with or without the facts) and that having ones mistakes pointed out is NOT a personal attack or criticism. It was intended to help turn down the heat, however I see by your reaction that this was not the affect it had. I'll give some thought as to how else I might have responded... but to be honest, I don't think I would have gotten a different response... I just didn't expect this response from you.

Regards,

Timkin

[edited by - Timkin on July 2, 2002 9:34:46 PM]
Advertisement
quote:
Original post by fup
If I understand your problem correctly, you just need ''seek'' and ''pursuit'' steering behavior. Seek is very easy to implement, pursuit not much harder.

This link will give you the details.

http://www.red3d.com/cwr/steer/






Stimulate


That''s a good link, fup, but I''m not sure if it''s going to help in this case. The movement of boids assumes some flexibility in terms of acceleration/decelleration/etc. that probably can''t be emulated with space fighters (despite what I''ve seen in the Star Wars films).

feral, you say that you need to be able to do this without access to the velocities, which makes sense. The AI wouldn''t know what the velocity or acceleration of the target is, just where it is and where it appears to be going. That means, however, that you can probably have it guess the target''s velocity (perhaps factoring in any knowledge it might have of that ship type), and then you could use that to help you estimate where it''s going and intercept it.

If you''re dealing with a homing missile, you just have it update every X milliseconds or so, continually adjusting its predicted intercept point and then adjusting its velocities to hit that spot. An energy bolt or blind cannon, of course, can only go straight. We did this kind of thing a while back with one of the arcade games I worked on, and it worked out pretty well (though since it was on the ground I had to take gravitational effects into account too).




Ferretman

ferretman@gameai.com
www.gameai.com
From the High, Cold, Snowy Mountains of Colorado

Ferretman
ferretman@gameai.com
From the High Mountains of Colorado
GameAI.Com

quote:
Original post by fup

Also, all Reynold''s steering behaviors work just as well in 3D as in 2D. You just have to be careful of the dreaded gimbal lock, but then I''m sure you''ll have solved that problem already.






Stimulate





I note that you can avoid "gimbal lock" if your engine supports quaternions. I personally don''t understand the things myself, but have a nice library of functions someplace that translate to/from angles so that I don''t have to....






Ferretman

ferretman@gameai.com
www.gameai.com
From the High, Cold, Snowy Mountains of Colorado

Ferretman
ferretman@gameai.com
From the High Mountains of Colorado
GameAI.Com

quote:
Original post by fup
Give the man a break Timkin. He has no idea of your background and just wants to get a point across. He''s been polite throughout. Your first sentence in this thread is much more emotive than anything ''a person'' has said... and in effect is doing just what you are accusing ''a person'' of doing - questioning our understanding of the problem.

Maybe you are having bad day eh?




Stimulate





I have to agree, Timkin....you kinda heated up the discussion a bit quick given the level of the remark "a person" made. He probably could have said it better, but text is pretty darn "hard".

(Said the ferretman fresh from his camping trip having returned to a swamped forum...)





Ferretman

ferretman@gameai.com
www.gameai.com
From the High, Cold, Snowy Mountains of Colorado

Ferretman
ferretman@gameai.com
From the High Mountains of Colorado
GameAI.Com

seems i offened you when i did not intend you. the main statement i disliked was how you felt that my methodolgy was flawed based on the units not matching. saying that the vector outputted has nothing to do with the vectors used to create it ahve nothing to do with each other further shows you dont seem to understand how things are being looked at with my algorithm.

i will explain it again, hopefully i will do this correctly this time and that ppl understand this method works, and there is no use of bad math anywhere (ie mismatching units).

relevtive velocity: the velocity reletive to something. derived by translating one objects trajectory to another then taking the distance of that vector. useful to get one object to mimic another''s movement, since velocity and direction would match. not required though since we want to just hit a point relevtive to our origin.

i choosed to translate the targets position into missile space. this is a vector that points in the direction of the target and contains the distance to the target. otherwise known as the force required to be applied to the center of the space to reach the target. in other words we place the missile at the origin by translating the target by the missiles position. this is done by subtraction. we will call this the target force. anyone who used a 3d api and a camera understands the different spaces you can have (world, model, camera). thus i created a missile space to make things easier.

now with the force required to move a stationary missile to the target, we can then calculate the actual force required. this is done again through translating the missile force (ie trajectory) force into the target force space. since vectors can be thought of points in space, this will work quite nicely. again subtraction is the key to the magic. now we have the desired vector (force). this is the force when applied the missiles force vector the missile will be located at the target.

we will take a quick jump to spacecraft design. space vessels gennerally will have three thrusters located on each of the three axises relative to the ship. they may be rotated, but their force lines will all intersect a center point on the ship. this can be comapred to the 3 space vector which can be considered the percentage of thrust each of the thrusters will output. being that this must work in reality, there are really 6 thrusters*(see note1) on the ship. depending on if the thrust is in the relative negative of positive direction on the axis will determine which of the 2 thrusters on the axis will be fired. now that is cleared up for those who think the physics may be wrong based on the outcome of the forces.

now we have the force required to reach the target we need to scale it. this is because the missile has finite force it can apply at an instance (ie its acceleration). thus we normalize the desired vector and then multiple by the acceleration. this gives the thrust that the ship will apply. since the missile already has force in another direction, the ship wont instantly follow (or face) the target. make sense?

maybe i explained it wierd this time (though i think the terminlogy will make more sense). at least this explaination shows different concpets being brought together (ie translations form different spaces). i hope i did not reverse any naming conventions like which space hwat was translated into. it does not really matter because if you reverse one of them, the other or both the only bad thing that will happen is you will get the oppisite force. thus you would need to multiple the vector by -1. its easy to see if you coded it wrong since the missile will always head away from the target. the main gotcha.

note1: will be more depending on if the position of the thrusters. since only 6 are required full 6 degrees of movement, but more are required to allow rotation as well. also sometimes depending on ship design more may be required because the thrusters can be placed exactly on the axis due to a curved hull. theory is the same, but you have to then split the axis force between the thrusters that generate thrust on the axis.


Advertisement
quote:
That''s a good link, fup, but I''m not sure if it''s going to help in this case. The movement of boids assumes some flexibility in terms of acceleration/decelleration/etc. that probably can''t be emulated with space fighters (despite what I''ve seen in the Star Wars films).


Steve, Reynold''s steering behaviors are a series of behaviors he developed independently of the boids code. They are for game agents with mass, position, max velocity, acceleration and, if required, a limited turning rate. If the OP is having difficulty seeing how Reynolds ideas may be applied then I believe a guy from Bullfrog did a much better write up (with source) for some conference or another. (unfortunately I don''t have the link though). If you already knew this Steve (and you probably do), then forgive me for teaching you how to suck eggs ;0).

How did your camping go anyway? Good weather? (we had to buy a new tent after the first night in Scotland!)

Timkin: I guess everyone must be misunderstanding everyone else. I was not offended by your comment, I was trying to show how easy it is for readers to take something the wrong way - as I believe you have with ''a person''s remark. Sometimes text is just not enough! I''ve noticed a lot of times, especially if one wakes up grumpy, other peoples remarks can be taken as impolite, patronizing, insulting ones intelligence or whatever but when read again in a different frame of mind they are clearly not, or sometimes just an attempt at humour which has been misunderstood. I''m sure most of us have all had the same experience at some time or another. Anyway, thats my 2cs worth. Let''s all kiss and make up ;0) xx




Stimulate
quote:
Original post by a person
i disliked was how you felt that my methodolgy was flawed based on the units not matching.



You keep accusing me of this ''a person'' and yet it''s simply not true. You''ve got your back up at being corrected and now you''ve managed to get mine up by persisting with this unfounded claim.

You feel I have demeaned your methodology and you insist on demeaning me by continually explaining in laymens terms something that I told you ages ago I understand. Your statements that I don''t understand mathematics nor how to apply it are ludicrous, insulting and patronising.

If you want to continue to insist that I don''t understand your method, or your mathematics, go ahead... it matters nought in the long run. Enjoy your time here at GD, ''a person''.


Goodbye,

Timkin.
quote:
Original post by fup
That''s a good link, fup, but I''m not sure if it''s going to help in this case. The movement of boids assumes some flexibility in terms of acceleration/decelleration/etc. that probably can''t be emulated with space fighters (despite what I''ve seen in the Star Wars films).


Steve, Reynold''s steering behaviors are a series of behaviors he developed independently of the boids code. They are for game agents with mass, position, max velocity, acceleration and, if required, a limited turning rate. If the OP is having difficulty seeing how Reynolds ideas may be applied then I believe a guy from Bullfrog did a much better write up (with source) for some conference or another. (unfortunately I don''t have the link though). If you already knew this Steve (and you probably do), then forgive me for teaching you how to suck eggs ;0).



Actually, the main point I was trying to get across was that steering behaviors often remove all consideration of instant turns, instant acceleration, and the like. I was mostly trying to get across that using them "straight", as it were, could be problematic. I didn''t say it well though.

quote:

How did your camping go anyway? Good weather? (we had to buy a new tent after the first night in Scotland!)



We did great! Cleared a lot of trees and downed wood and generally had a fine time. The weather was great, though perhaps a tad chilly on the first night.






Ferretman

ferretman@gameai.com
www.gameai.com
From the High Mountains of Colorado

Ferretman
ferretman@gameai.com
From the High Mountains of Colorado
GameAI.Com

Hi all!

Thank you all very much for your help, and the multiple approaches posted. I think Ive finally understood a few different ways, in fact, of tackling the problem, so thanks very much for persevering and explaining things.

I havnt had a chance to implement anything yet - wont have for a while, quite busy, but I do understand the cores of the various methods given, which I didnt previously, so Im confident things will work.

One comment regarding reynolds steering behaviours - how do his agents actually change direction? From his vechile model on the site, I got the impression they turn like things in atmosphere or road, ie, if you turn 10 degrees to the left, your velocity turns 10 degrees to the left with you, as opposed to in space, where you turn 10 degrees to the left, and are no longer facing along your velocity.
This is why I found the steering behaviours and associated code not as useful as they may have been.. no matter!


>You feel I have demeaned your methodology and you insist on
> demeaning me by continually explaining in laymens terms
> something that I told you ages ago I understand.

Im not very good at some of the maths stuff expressed, so Im grateful for the fact that he explained it in laymans terms.
Im also thankful for all the help you (timkin) gave too.
(and everybody else!)
thanks again,

feral


This topic is closed to new replies.

Advertisement