Need help with game

mad_max
Unregistered
 
Post: #1
Guys, i really need some help here. we are a group of people trying to make a game which has spaceships in it. as part of the AI team, i was asked to develop so reactions for some situations, of these reactions, the case when a spaceship is "locked on" by an enemy ship, the locked on ship will try to become the hunter from being the hunted, how? i thought of some reactions, such as, turning around the enemy ship in any random direction(left, right, up or down) and at some point when the position is appropriate shoot the enemy. let us take this specific case, i searched a lot for how to make maneuvers for jet fighters, you know as these fighters can do things like that, but I couldn't find any helpful materials, what i want to know is that how a maneuver like the one i described earlier can be done? that is to say, i want to know the details for such thing is terms of math and physics, and also from a pilot's point of view, you know if a jet fighter's pilot wanted to do a maneuver like this, what should he do, like increasing the speed or accelerating, the turn rate and radius, you know stuff like that in order at some point he can become the hunter, this means that at some point he will be able to point the nose of the fighter at the enemy, lock on it, and shoot, and we have to take into account that the enemy will not remain still, it will chase the hunt, so to what extent should this go on? coz we dont want the ships to keep looping for ever chasing each other without being able to shoot the other down.
I dont know I guess that i said too much, but please guys, if any body knows how to do that, or knows any tutorials or resources, please let me know.
Member
Posts: 283
Joined: 2006.05
Post: #2
If you're part of the AI team, surely the "maths and physics" are someone else's responsibility? I mean, if someone else is designing the space ships, you can't really do the AI until you know, say, where the thrusters are, and how powerful each one is.

Well, you could do something more generic that suits any configuration, but I bet that would be much harder.

Anyway, do a search for "pursuit algorithms" or something. I saw some cool ones a while ago, which were illustrated by little Java demos, but I can't find them now.
mad_max
Unregistered
 
Post: #3
well, you are 100% right, maths and physics ARE the game engine's team responsibility not mine, and I was asked to make a formula that can be applied in any case, you know what i mean, it will be something like this:
if(m_bLockedOn)
{
accelerate();
incOrientation();
shoot();
.
.
.
.
}
but don't you think that in order to design such a thing i must know what are the maths and physics involved both from programmer's and pilot's points of view?

and a last word, please do find the stuff you talked about!!Rasp
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
Depends on how complicated you want to make it. If you want really fancy physics, it gets complicated. I made a prototype of a space game a while back that used a fixed 6 thruster configuration to fly the ships. I implemented an autopilot that would allow a squadron of ships to fly around with you in a fairly tight formation. It was only 300-ish lines of Ruby code, but it was quite mathematically dense. If you don't know how to use the equations of motion, you've got a long way to go to figure this out. Implementing a combat AI on top of this would involve even more work.

If you simplify the flight model down to turning and a forward velocity, you could simplify the work a lot, but dogfights won't be as fun.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Member
Posts: 283
Joined: 2006.05
Post: #5
Here is the thing I was thinking of. Those links in that list are all Java demos. Mostly 2D, but I'm sure there must be a few shared principles. And if not, they're at least cool to look at.

The page also links to OpenSteer, which might be worth a look.
mad_max
Unregistered
 
Post: #6
Skorche Wrote:Depends on how complicated you want to make it. If you want really fancy physics, it gets complicated. I made a prototype of a space game a while back that used a fixed 6 thruster configuration to fly the ships. I implemented an autopilot that would allow a squadron of ships to fly around with you in a fairly tight formation. It was only 300-ish lines of Ruby code, but it was quite mathematically dense. If you don't know how to use the equations of motion, you've got a long way to go to figure this out. Implementing a combat AI on top of this would involve even more work.

If you simplify the flight model down to turning and a forward velocity, you could simplify the work a lot, but dogfights won't be as fun.

well, i don't want to make it that fancy, i just want a single ship, when it's locked on, to take an appropriate reaction, and this doesn't apply to all ships, just only for those more intelligent ships. Another thing, i do know how to use equations of motion, but I'm not a jet fighter pilot, thought that i made my point clear, i need to know the theoretical part, then i'll implement it using my own way. thank you.
Sage
Posts: 1,482
Joined: 2002.09
Post: #7
mad_max Wrote:well, i don't want to make it that fancy, i just want a single ship, when it's locked on, to take an appropriate reaction, and this doesn't apply to all ships, just only for those more intelligent ships. Another thing, i do know how to use equations of motion, but I'm not a jet fighter pilot, thought that i made my point clear, i need to know the theoretical part, then i'll implement it using my own way. thank you.

Sorry, I really didn't mean to sound snooty if that's how I came off. I muddled your post and maximile's in assuming that you were asking for help on the physics side.

I'll have to take a look at some of those papers, the applets are quite interesting. Inspires me to pick up my space game again.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Member
Posts: 23
Joined: 2006.12
Post: #8
I'm not sure how complicated you're intending your evasion and counter attack measures to be, but I'll assume something on the simple side. ( Assuming fighter A is chasing fighter B, and that this is a top down perspective game. )

Let's say, 50% of the time fighter B simply moves in the same direction as fighter A. ( Attempting to outrun fighter A.) 20% of the time, the fighter could make a drastic turn between 45 and 90 degrees left or right to get away from fighter B. Now that last 30% of the time is where fighter B would attempt to turn the tables on fighter A by doing one of several things: fighter B could hit the brakes as fast as possible and hope that fighter A speeds in front of him; fighter B could make two fast turns in opposite directions and hope to catch fighter A off guard; or fighter B could just make a complete 180 and head directly towards fighter A.

As you can see these are all evasive type moves. You would want to make a check every run of the game loop and see if fighter A is within a 90 degree field of vision of fighter B. If so, change fighter B so that he is now in "attack mode" and chasing after fighter A, essentially changing fighter A into the hunted.

Also, that last 30% of special tactics, could have as many branches of special moves as you wanted, those were just the first ones I thought of.
Edit-Oh, and if your ships have any sort of special moves like cloaking, or disabling another ship, this last 30% is where you'd want to attempt maneuvers like that too.

I don't know, just an abstract idea. Hope it helps.
mad_max
Unregistered
 
Post: #9
well, Jaden, thank you very much, really your reply was very helpful, i can say that it made things much more clear, and man if you have any other good ideas, please let me know, I'll appreciate that. Another thing, I really would ask a question here: what do you think is better, making these reaction as a series of function calls, like accelerate() or deaccelerate(), incOrientation(), you know stuff like that, or making the ship move according to some equation that has acceleration, velocity, turn rate and radius...etc, i dont know but i think that giving the ship a predefined equation will be useless, dont u agree with me?
mad_max
Unregistered
 
Post: #10
Skorche Wrote:Sorry, I really didn't mean to sound snooty if that's how I came off. I muddled your post and maximile's in assuming that you were asking for help on the physics side.

I'll have to take a look at some of those papers, the applets are quite interesting. Inspires me to pick up my space game again.

man it's ok, nothing happened, you dont have to be sorry for ne thing. Cool
mad_max
Unregistered
 
Post: #11
come on guys!!!
don't yo have any new ideas??
Sage
Posts: 1,403
Joined: 2005.07
Post: #12
about what?
your thread has an extremly undescriptive title.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Moderator
Posts: 508
Joined: 2002.09
Post: #13
mad_max Wrote:come on guys!!!
don't yo have any new ideas??

We have tons of ideas, but they all point to certain death...

"When you dream, there are no rules..."
mad_max
Unregistered
 
Post: #14
unknown Wrote:about what?
your thread has an extremly undescriptive title.
Smile first of all, I didnt write that title, maybe the moderators did change my title. the other thing, you can bother your self and read the post, maybe you can understand what I'm talking about, and what kind of ideas I need!!! Annoyed
mad_max
Unregistered
 
Post: #15
Taxxodium Wrote:We have tons of ideas, but they all point to certain death...
what do u mean by "they all point to certain death" ???
Thread Closed