Advertisement

Q. Limitation of the flight space

Started by August 26, 2006 02:51 AM
8 comments, last by Lincoln 18 years, 3 months ago
I'm making a 3D flight simulator. Planes fly and attack each other in it. Now I'm worried how to let them fly naturally. Needless to say, if I control a plane to pursue an enemy plane, it will fly naturally to some extent. But in that way, the aircraft merely flies behind the enemy, or it heads for the enemy and collides when it flies ahead the enemy. I'd like to ask the men who have experienced making flight simulators how to control planes. [Edited by - Lincoln on August 30, 2006 1:41:03 AM]
Been working on SAAFOPS project for over 2 years (http://www.saafop.com or www.combat360.org).

Currently need help porting DX8/7 code to DX9, also integration of dynamic weather and turbulence modelling/classes.

Plenty sub/small sub coding help urgently required. SAAFOPS is based on the original Falcon 4 SP3 code.

Really really need your help please
Advertisement
First thing: use a state based approach for tactics, so you can have a 'pursue', 'intercept', 'attack' mode for your planes.

To make your plane avoid crashing in to it's target:
Instead of having your plane fly directly at the target aircraft, have it chase a point somewhere behind the target aircraft.


For added realism, the 'chase' points distance behind the target aircraft should be based on the difference in vectors between the two aircraft.

Add rules in your state table for situations like: chase plane is in front of target plane. Or chase plane is below target plane. This way you can start adding rules that avoid things like crashes, and dumb tactics. If you add multiple possible responses to any given situation, then you can have enemy AI that behave differently from one another.

Good luck,
Will


------------------http://www.nentari.com
key word - Abstraction

You want a state machine with High Level goals and behaviours ie- attack, evade, waypoint, etc

But below that; to actually avoid diving into the ground you need to worry about flight dynamics. - keep the plane level, attitude managment, avoiding/recovering stalls, etc

I would think that, from the low-level fight managment you want to be able to accept a goal direction vector and speed as inputs.
and that the high level behaviours should be able to output that direction and speed...


you might even want an intermediate layer between Goals and Flight, called Manuvers
consisting of a big database of Real Flight Manuevers from actual pilot training manuals...
how to turn, break turn, speed dive, etc...
Thank you for your advices, everyone!
I tried letting a plane fly in front of a target plane, and was satisfied with the result. Another problem is aircrafts' overlapping. So I'm attempting to give them different targets from one another now. It's rather difficult, but I can maybe. My sim has been completed 50%.
http://www.gamedev.net/community/forums/topic.asp?topic_id=411116
http://img225.imageshack.us/img225/5332/shot1dj6.th.jpg

P.S. The SAAFOPS project is cool, and models are very realistic and beautiful. I'm not be able to create a simulator as high-level as the project.
The second serious problem is that AI planes pursue each other and fly out of the 3D battle field. I want to limit the space of flying inside the boarder, but I don't know how to do. So I want to ask experts how you control planes to fly inside the battle field.
Look at the picture. The battle field is (0,y,0)-(1000f,y,1000f).
Free Image Hosting at www.ImageShack.us
Thanks to ImageShack for Free Image Hosting

[Edited by - Lincoln on August 30, 2006 2:36:43 AM]
Advertisement
I belive that the classic game 'Asteroids' solved this problem rather elegantly:



while(plane.x>1000.0f){
plane.x-=1000.0f
}
while(plane.x1000.0f){
plane.y-=1000.0f
}
while(plane.y
Quote: Original post by Anonymous Poster
I belive that the classic game 'Asteroids' solved this problem rather elegantly:



while(plane.x>1000.0f){
plane.x-=1000.0f
}
while(plane.x1000.0f){
plane.y-=1000.0f
}
while(plane.y


If you want to wrap, I would strongly suggest using the reminder of the division...
Quote: Original post by Steadtler
If you want to wrap, I would strongly suggest using the reminder of the division...


remainder of division? if you mean %modulus operator, doesnt that not operate on floats?
or is there a better way to get remainders without having to juggle/cast the numbers too much?


P.S. sorry for the badly formatted code above, it seems that the 'code' and other various tags are disabled for AP
Thank you,all. This question was solved.

This topic is closed to new replies.

Advertisement