blah blah
Homing Missile AI in 3space with momentum (hard!)
Argh! Can someone tell me how I post code here plz? (I thought it was something like
My Website: ai-junkie.com | My Books: 'Programming Game AI by Example' & 'AI Techniques for Game Programming'
Argh! Can someone tell me how I post code here plz?
My Website: ai-junkie.com | My Books: 'Programming Game AI by Example' & 'AI Techniques for Game Programming'
Nooooooooooooooooooooooooooooooooooooo!
I guess this''ll teach me to post at 6.30 am!! :0)
I guess this''ll teach me to post at 6.30 am!! :0)
My Website: ai-junkie.com | My Books: 'Programming Game AI by Example' & 'AI Techniques for Game Programming'
lol
Use open square braket Source close square braket
[ "source" ] - No quotations
Lol my third edit, i need to learn how to type... Maybe its to late..
Number 4... Is this even answering what you were asking lol?
[edited by - HunterTKilla on June 29, 2002 2:53:13 AM]
[edited by - HunterTKilla on June 29, 2002 2:53:28 AM]
[edited by - HunterTKilla on June 29, 2002 2:54:16 AM]
[edited by - HunterTKilla on June 29, 2002 2:55:05 AM]
Use open square braket Source close square braket
[ "source" ] - No quotations
lol good luck, teach ya to post at 6:30...oh yeah and to stop souce go [ "/source" ] - Also cut the sqaure quotations
Lol my third edit, i need to learn how to type... Maybe its to late..
Number 4... Is this even answering what you were asking lol?
[edited by - HunterTKilla on June 29, 2002 2:53:13 AM]
[edited by - HunterTKilla on June 29, 2002 2:53:28 AM]
[edited by - HunterTKilla on June 29, 2002 2:54:16 AM]
[edited by - HunterTKilla on June 29, 2002 2:55:05 AM]
yep, thanks. I was close (trying ["code"]) but, as they say... no cigar.
My Website: ai-junkie.com | My Books: 'Programming Game AI by Example' & 'AI Techniques for Game Programming'
Thanks for continuing efforts to help, fup, Im really grateful.
However, Im not sure Ive explained the problem clearly enough (it is complex though).
The solution you give seems to depend on a max speed value for objects; In space they do not have such a value, as theres no friction to provide a terminal velocity due to air resistance.
So you dont have anything to nicely slide into that calculation where you can put max velocity.
Perhaps one thing to do would be that the homing missile controller AI would just decide to accelerate until it reached a "max velocity" which we just decide to give it, for the sake of simplifying the maths.
However, that would hardly be an efficient design of AI, as we''d prefer something that covers distance to target in shortest time, and this is obviously possible only by continuous maximum thrust/acceleration.
But the maths to do that still seem to elude me.
Feral
As an aside, that computation to me seems slightly innaccurate (correct me if Im wrong here, I find this math a bit tricky) because it seems to depend on the time taken to achieve max velocity being much smaller than the time spend at max velocity on the way to the target. Ie, large acceleration compared to speed.
Which is fine, coz your continually updating and revising the estimation though, but perhaps non optimal.
However, Im not sure Ive explained the problem clearly enough (it is complex though).
The solution you give seems to depend on a max speed value for objects; In space they do not have such a value, as theres no friction to provide a terminal velocity due to air resistance.
So you dont have anything to nicely slide into that calculation where you can put max velocity.
Perhaps one thing to do would be that the homing missile controller AI would just decide to accelerate until it reached a "max velocity" which we just decide to give it, for the sake of simplifying the maths.
However, that would hardly be an efficient design of AI, as we''d prefer something that covers distance to target in shortest time, and this is obviously possible only by continuous maximum thrust/acceleration.
But the maths to do that still seem to elude me.
Feral
As an aside, that computation to me seems slightly innaccurate (correct me if Im wrong here, I find this math a bit tricky) because it seems to depend on the time taken to achieve max velocity being much smaller than the time spend at max velocity on the way to the target. Ie, large acceleration compared to speed.
Which is fine, coz your continually updating and revising the estimation though, but perhaps non optimal.
well first off, a missile will have a max velocity due to limited fuel. if you wont have a max velocity because its not true to physics, well not having one is just as bad. though the actual max velocity is dependent upon the start velocity (ie the ship firing the missile).
no matter what the following should always hold true:
1. you know your current velocity
2. you know the targets current position in space
3. you know your position in space
4. you know your direction
5. you have a max velocity becuase of fuel limitations, you may ignore fuel limitations like most games, but even so you should still have a max velocity based on this, else your physics calculations will come crashing down on you as objects exceed a particular speed (since collision will get funky, overflows will start to occer, etc).
the ai is quite simple in homing missils. first off homing missiles are designed to correct somewhat accurate shots, not to be fired in the opposite direction of the taregt. thats the first mistake you make. secondly a missile should never need to stop to go after the target nor apply thrust to slow itself down significently. missiles will pick there target by selecting the closest target within a particular fov. laser guided missiles are have their target chosen by what the ship is locked on to (though the ship must keep the lock). thus the ship must make its initial shot facing the target.
the missile merely updates its thrust vector each time step to face towards the target. the missile has limited directional thrust, thus again wont be able to stop itself as you suggest. you are giving your missiles too much technology and no limits which makes it more difficult to make it seem correct.
target vector: from your current position to the target position
you dont care about the targets trajectory. instead you will find the delta vector from your vector to the target vector. this vector will represent the exact thrust change required to hit the target the next time step. since the missile has limited acceleration abilities, you would scale this vector to the amount of thrust the missile can use to turn. this is then added to the current missile vector to come up with the new vector in which the missile is now turned towards the target within the limits of the missile acceleration ability. this whole thing gets repeated until the missile collides with something. the missile should have a max velocity similar to a ships max velocity to prevent the ship from escaping the missile if the firing ship is traveling at the same velocity as the target.
if your game has real physics, it should be able to handle the vector math required. it also should be able to handle mulitple vectors per object. since you will have a current vector, desired vector, acceleration vector. the acceleration vector represents the difference of the desired and current vector. which is then normalized and scaled to the acceleration the object can handle. this makes the homing missile ai trivial to implement. since you only need to update the desired vector, and the physics engine should take care of everything else automagically.
no matter what the following should always hold true:
1. you know your current velocity
2. you know the targets current position in space
3. you know your position in space
4. you know your direction
5. you have a max velocity becuase of fuel limitations, you may ignore fuel limitations like most games, but even so you should still have a max velocity based on this, else your physics calculations will come crashing down on you as objects exceed a particular speed (since collision will get funky, overflows will start to occer, etc).
the ai is quite simple in homing missils. first off homing missiles are designed to correct somewhat accurate shots, not to be fired in the opposite direction of the taregt. thats the first mistake you make. secondly a missile should never need to stop to go after the target nor apply thrust to slow itself down significently. missiles will pick there target by selecting the closest target within a particular fov. laser guided missiles are have their target chosen by what the ship is locked on to (though the ship must keep the lock). thus the ship must make its initial shot facing the target.
the missile merely updates its thrust vector each time step to face towards the target. the missile has limited directional thrust, thus again wont be able to stop itself as you suggest. you are giving your missiles too much technology and no limits which makes it more difficult to make it seem correct.
target vector: from your current position to the target position
you dont care about the targets trajectory. instead you will find the delta vector from your vector to the target vector. this vector will represent the exact thrust change required to hit the target the next time step. since the missile has limited acceleration abilities, you would scale this vector to the amount of thrust the missile can use to turn. this is then added to the current missile vector to come up with the new vector in which the missile is now turned towards the target within the limits of the missile acceleration ability. this whole thing gets repeated until the missile collides with something. the missile should have a max velocity similar to a ships max velocity to prevent the ship from escaping the missile if the firing ship is traveling at the same velocity as the target.
if your game has real physics, it should be able to handle the vector math required. it also should be able to handle mulitple vectors per object. since you will have a current vector, desired vector, acceleration vector. the acceleration vector represents the difference of the desired and current vector. which is then normalized and scaled to the acceleration the object can handle. this makes the homing missile ai trivial to implement. since you only need to update the desired vector, and the physics engine should take care of everything else automagically.
Hi.
You say you don''t have a max velocity, but no mather
if you have air-resitance (like in the atmosphere) or
friction less space there is always a maxspeed, the
speed of light which cannot be broken (according to
Einsteins theory of relativity).
And as other replyers have said, even in space you have
some practical issues which determines your maxspeed,
like the amount of fuel carried by the missile.
BR
Marten Svanfeldt
Sweden
You say you don''t have a max velocity, but no mather
if you have air-resitance (like in the atmosphere) or
friction less space there is always a maxspeed, the
speed of light which cannot be broken (according to
Einsteins theory of relativity).
And as other replyers have said, even in space you have
some practical issues which determines your maxspeed,
like the amount of fuel carried by the missile.
BR
Marten Svanfeldt
Sweden
quote:
Original post by feral
One of the key points about our game was that it had real physics.
...
A) move to a certain point in space,
AFAIK in real physics, there is no ''certain point in space'' everything is relative

Anyway, I''m no great 3space thinker, but if someone were to ask me to design a missile for combat in space (Yeah, that''s likely to happen


Now, we have a light, fast, maneuverable, computer controlled missile, how do we get it from point A (being it''s current position) to point B (being that ship which contains the tentacle-head who made an offensive remark about your mother), how does one program it to actually make tantacle-soup. Let''s take point B as our ''fixed point in space'', now all we have to do is ''stop'', of course point B has the nasty habit of changing it''s movement vector, so we move the same way, if the tracking computer reacts fast enough, the distance between our missile and point B will remain constant, now if we encapsulate this behavior in a module and add an interface to this module (in programming terms, the module being a class, and the interface being its public methods) which we can give instructions to move in a certain direction (let''s say the direction of Point B) it will combine the vector given with it''s auto-sync to move toward point B while matching it''s movement. Maybe this isn''t the most efficient way, and it depends on how high the level of technology is (scanner equipment for example). And given that I''m suffereing from sleep deprivation and not thinking clearly, it may all be a bunch of BS, so please disregard any stupid parts or all of ''em.
Gyzmo
==============================
"Well is the world standard" - The Alchemist
"Not in Canada!" - jonnyfish
Gyzmo=============================="Well is the world standard" - The Alchemist"Not in Canada!" - jonnyfish
No offense intended to anyone, but going by what has been written, you all seem to have forgotten something rather basic about this problem! The only (abstract) action required of the missile is to decrease the magnitude of the relative velocity vector each time step.
The relative velocity vector is trivial to compute. If you want to be nasty and not tell the missile what the targets velocity is, then you can have it estimate it using position observations.
Given the missiles current velocity and the relative velocity vector, the problem of finding the correct control commands to reduce the magnitude of the relative velocity vector is a search/optimisation problem. The two actions that will reduce this magnitude are decreasing the angle to target and/or decreasing the distance to target, where the angle to target is the angle between the current trajectory of the missile and the displacement vector from the missile to the target.
Now, here''s a suggestion to simplify the problem: it''s a space-based missile, it doesn''t need roll, only pitch, yaw and thrust (accelerate).
So, you have 3 control variables: pitch, yaw, thrust.
Choose a small increment of these actions and create a search tree that branches on these actions for the small increment. Perform a search to find the smallest set of actions that generates a decrease in the magnitude of the relative velocity vector.
Trigger this search whenever the target changes velocity (speed or direction).
That should be enough to get your system working.
On the other hand, you could create a system that does this via supervised learning (trial and error).
Cheers,
Timkin
The relative velocity vector is trivial to compute. If you want to be nasty and not tell the missile what the targets velocity is, then you can have it estimate it using position observations.
Given the missiles current velocity and the relative velocity vector, the problem of finding the correct control commands to reduce the magnitude of the relative velocity vector is a search/optimisation problem. The two actions that will reduce this magnitude are decreasing the angle to target and/or decreasing the distance to target, where the angle to target is the angle between the current trajectory of the missile and the displacement vector from the missile to the target.
Now, here''s a suggestion to simplify the problem: it''s a space-based missile, it doesn''t need roll, only pitch, yaw and thrust (accelerate).
So, you have 3 control variables: pitch, yaw, thrust.
Choose a small increment of these actions and create a search tree that branches on these actions for the small increment. Perform a search to find the smallest set of actions that generates a decrease in the magnitude of the relative velocity vector.
Trigger this search whenever the target changes velocity (speed or direction).
That should be enough to get your system working.
On the other hand, you could create a system that does this via supervised learning (trial and error).
Cheers,
Timkin
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement