Author Topic: Atmospheric dynamics?  (Read 5358 times)

0 Members and 1 Guest are viewing this topic.

Offline Unknown Target

  • Get off my lawn!
  • 212
  • Push.Pull?
Atmospheric dynamics?
I remember this being discussed awhile back. I'm still working on my strategy game project and I was thinking it'd be cool if i could mod in some of the planes to Freespace.

Has anything progressed on implementing a basic atmospheric flight model into FS?

 

Offline Aardwolf

  • 211
  • Posts: 16,384
Re: Atmospheric dynamics?
Go bug Nuke, he's done that sorta stuff.

 

Offline SypheDMar

  • 210
  • Student, Volunteer, Savior
Re: Atmospheric dynamics?
From hearsay, BP2 got gravity working. The videos show that it only affects debris because the AI is dumb. I'm gonna guess that it'd work for players.

 
Re: Atmospheric dynamics?
Nah, it was m!m that got it to work.
Did you hear that fellas? She says I have a Meritorious Unit.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Atmospheric dynamics?
Nah, it was a group of talented people working together with m!m deserving the primary credit

And yeah the way we have it set up right now is gravity on debris only

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Atmospheric dynamics?
Nah, it was m!m that got it to work.

and if i remember correctly i had to debug that script for at least one person. he forgot to multiply acceleration by frametime before adding it to velocity, lol.
i did however do this. but i never really got it to play nice with collision detection. also angular physics need work. script is available through my svn repo.
« Last Edit: October 19, 2011, 05:22:08 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline SypheDMar

  • 210
  • Student, Volunteer, Savior
Re: Atmospheric dynamics?
I'll rephrase: BP2 got working gravity. And yeah, kudos to everyone that contributed  :yes:

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Atmospheric dynamics?
i should point out that the thread is more about dynamics, of which gravity is merely only one aspect. youve got newtonian physics as a base and on top of that gravity modeling, atmospheric modelling, computation of lift and drag forces on a solid body, orbital mechanics, and so on to deal with (and thats just whats implemented). i planned to do other things like multiple solid bodies per object, engine performance modeling and control surface modeling as well, but i kinda lost interest after having some serious collision detection issues (for example that crash you get when your weapons hit something).
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Unknown Target

  • Get off my lawn!
  • 212
  • Push.Pull?
Re: Atmospheric dynamics?
I can actually help with some of the necessary equations, at least pointing you to standard ones. I don't; know how much use I'll be but I've made a hobby of designing aircraft.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Atmospheric dynamics?
most of the maths are implemented already. granted there is room for refinement, but at some point it becomes overkill. the main thing that i need to implement is the multiple solid body simulation model (right now only a single solid body per object is allowed) which is just doing the same things on multiple objects and then do a summation of the forces on those solid body objects to get the forces for their representative object. this will provide the framework for things like angular physics control surface simulation.

a craft's physics model will be composed of multiple solid bodies (which can be setup as anything, fusalage, lifting bodies, wings, canards, stabilizers, control surfaces, props, rotor blades, engines, thruster quads etc). it is important to note that the solid body data structure is not geometry but the physics model of a part of a ship. they will each have mass, dimensional cross sections, coefficients of lift and drag and other parameters. they can be bound to subobjects and inherit their rotations, combined with an animation system this will allow for props, variable geometry, canards, and vectored engines. every solid body will have the basic aerodynamics properties, and possibly optional data for things like thrusters (though i may make this a different structure entirely) and control augmentation.

engine simulation should be something else entirely. it will likely be engine technology specific. i want to simulate performance regimes for air-breathing, rocket, and hybrid (engines with atmospheric and vacuum operational modes, like sabre) engines, perhaps also props and rotary wing propulsion (both with torque effects, and variable pitch, and the latter with retreating blade stall and swash) as well. i will probably simulate multiple engines as well. on top of all this id like to simulate a fly by wire system to make flying a ship with a multitude of thrusters and lifting surfaces a little bit easier.

its a lot of work and im not really sure i can commit any time into it. theres also the issue with the collision detection not playing nice with the flight model, and the other one with the ai not knowing how to fly in such a physics rich environment. this has brought up the issue of practicality. while the physics model is sound the interfaces with the other aspect of the game (collision detection and physics) are not so much. the engine likes to do its things in a set way, and when a script tries to change that it can have many unforeseen consequences.

for example the game likes to see the velocity in a pre-defined range, exceeding this will likely cause the actual velocity to be capped in the engine. there are reasons why such a cap are desirable. for example doing an operation on a very small number and a very large number may result in a floating point error. if you load the tethys mission with my atmospheric flight mod, the moon in question is very large for the freespace grid. it displaces almost the entire area of useable space. while a low orbit is possible any large impulse of thrust will throw you out to a point where the physics really start to get shakey. your ship shakes a lot because the accuracy has gone to distances of greater than a meter. so while orbital mechanics works on very small scales, it is not really all that playable. flight confined to the atmosphere is far more playable because velocities are kept well within a sane range.

of course you got games like orbiter that use moving frames of reference to allow the current state of physics variables to remain within acceptable limits, and when they exceed them, the frame of reference is altered to compensate. not quite sure how to implement something like that into freespace. it may actually pay off to come up with a new game engine entirely.
« Last Edit: October 20, 2011, 08:02:16 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 
I'm less hopeful now of seeing this concept actually working. As much as I'd like the atmospheric flight model idea (and the others Nuke mentions) to work unhindered, I get the impression that it's a little bit too much of a lost cause to be worthwhile doing, unless a certain "compromise" could be found that provides an acceptable experience for most players.

What Nuke mentioned above about orbital mechanics reminds me a little of what razorjack tried to attempt about four years ago with his planetary engine that would feature seemless space-atmosphere transitioning. He said that it was impossible or nearly impossible to implement due to too much "bug chaos" (afterwards he went on to make his own freeform flight space sim: http://www.simerge.com/blog/).

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
freespace design assumptions never intended for an object to be able to go very fast or very var. you actually see this kinda thing in many a game engine, ksp, space combat, etc. they all have the "world" as the frame of reference and that doesn't work for very large scales in velocity and position. there are ways around it but they aint easy, and making them work in freespace using scripting and without major code revisions is a laughable idea. of course i dont see any harm in turning the engine into a flight simulator, provided the world is kept small enough.
« Last Edit: October 20, 2011, 06:19:21 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Unknown Target

  • Get off my lawn!
  • 212
  • Push.Pull?
Nuke it sounds like you're going full on real, maybe in real time; it seems like it'd be easier if you started from a more approximated state? At least that way it could be implemented quicker, maybe? I don't know. :)

  

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
you could do it that way. but i think its more fun to do a more realistic approximation. setup is somewhat hard now. of course its really just taking measurements of cross sectional area on all 3 planes and then measuring volume of the object in question, and then fudge a density to figure out mass. there are a few fudge factors, center of mass, center of drag, center of lift, Cl, Cd, etc. doing multiple instances of that shouldnt be too hard, id i think it would be possible to do a nice gui based editor for this right in the game. you would likely be presented with a model, and can then create bounding boxes around all the parts of the model, set the variables for those and save. i did the measurements in max for all the test cases(i believe there are instructions in the table comments), but i can see how complex and tedious that can be.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Unknown Target

  • Get off my lawn!
  • 212
  • Push.Pull?
Well realistic doesn't necessarily mean...realistic. It might be spot on with the numbers, but I think what's more important in this case is focusing on the "feel"; that way you can have a rough approximation but still feel like you're "flying". For instance, you don't actually need to take the cross sectional area, you just need to develop a standard factor and then scale ships off of that; so if a basic aircraft in a mod has a drag factor of 1, and a large zeppellin has a factor of 1000, you can use that as a range; rather than writing the code to figure out actual values, you can write something that's more interpretive and can be adjusted on the fly by modders; sort of like how the dampening factor works currently in tables.

That being said, I've been thinking I'd like some sort of external interface that interprets model-naming conventions in modelers to mean different things; for instance, for wings you could have each of them labeled "wing" and a calculation that roughly places the center of lift. The average distances of all the CoLs are added up to produce the average CoL of the aircraft; the summation of all these forces acts against a table-defined value of weight (mass x gravity, right?), which is then calculated against a table-defined minimum flight speed (stall speed); as speed goes up, lift goes up by some number (don't know if there's a ratio or equation for this off the top of my head, though I suspect there is), and once the two match then the plane is able to "fly" at that minimum speed. Control sluggishness can be set with similar numerical modifiers; all of this is easily changeable with relatively very visible effects, staying true with the overlying simplicity but underlying complexity that is modding the Freespace engine.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
using cross sections is a very elegant solution i think. i use 3 to represent each orthogonal plane. then i take a normalized vector which represents the direction of airflow in the object's frame of reference. i use the components of this vector as a scaler which is multiplied by their respective cross section (plane is perpendicular to the vector component, for example the xz cross section is multiplied by z), then use the sum of all 3 scaled cross sections to compute the total area perpendicular to airflow. so that a zeppelin trying to move sideways will experience more drag than trying to move straight ahead. its actually only a few lines of code to get one of the variables in the drag equation. really the hardest thing to compute is air density, because it has to analyze the atmospheric model against your altitude. velocity is just a matter of getting the magnitude of the velocity vector and Cd is your fudge factor.

i like the solid body structure because all objects have drag and all objects have lift. its just a matter of how much, a fuselage is designed for low drag and a wing for high lift. but a fusalage can produce lift and a wing can have low drag at certain angles of attack. so i like using the same data structure for both. i considered using it for engines as well but i think it would be better to handle that with a different structure. some engines would have a fixed performance and others may depend on atmospheric density or operational modes.

iirc lift increases by 11% per degree of angle of attack up to the stall angle, then drops off in a curve and eventually becomes zero. this slope geometry is typical of all known airfoils. i think theres a spreadsheet on my svn which graphs out the performance of a wing with a certain variable set. here it is

« Last Edit: October 23, 2011, 10:49:13 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Unknown Target

  • Get off my lawn!
  • 212
  • Push.Pull?
Sounds like you've got it going with the cross section, I agree I think you should do it. Your idea for using the same structure for all components of the airframe is sound, though it sounds like you're not factoring in lift that is not generated perpendicular to the ground plane.

What I'd really like to see is a good, tight integration of the tools for using these features. If you've used X-Plane, it's kind of close but very cumbersome. I'd like to see a smooth integration between development of aircraft and the development of the flight model; I think it would benefit both sides.

I made these awhile ago when I was designing my own aircraft, they are meant to be used in conjunction with one another. Dan Raymer's "Simplified Aircraft Design for the Homebuilder" was my main resource for knowledge and equations, though I also have and have flipped through his textbook "Aircraft Design: A Conceptual Approach". Then of course I used the Internet. :)

This is a sketching method for iterating aircraft layouts, roughly factoring in centers of gravity and centers of lift.
http://dl.dropbox.com/u/15050025/AircraftDesignTutorial_by_JordanPelovitz.pdf

This is a spreadsheet to calculate the necessary areas for wings, tails, etc. It also calculates moments, and centers of lift.
http://dl.dropbox.com/u/15050025/AircraftConfigurationWizard%20by_JordanPelovitz.xls

It's a little buggy, and I don't think the section for a standard tail is done quite right; pretty sure you can use the third lifting surface instead, and give it a lift amount of zero.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
lift is always perpendicular to both the direction of airflow and the x axis. i think you can get the cross product of the 2 (normalized) vectors and reverse it to get a lift vector, this can be multiplied by the lift force to generate force in the proper direction. of course i didnt like the results of that method. so i think im doing this by rotating the airflow vector into model space and then just using trig functions in 2d on the yz plane to compute the aoa, i then take a 0'1'0 and rotate it about the x axis by aoa and scale that vector by the lift force. i figure its a good enough approximation.

you really should get an svn client and pull my atmospheric flight model, its loaded with awesome maths.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Unknown Target

  • Get off my lawn!
  • 212
  • Push.Pull?
If you're splitting up the calculation of the overall center of lift then the lift is not always perpendicular to the x axis of the aircraft. A rudder generates no lift or  the same lift in both directions; slanted vertical stabilizers will produce lift at, say, 45 degrees from the x axis of the aircraft. Also some aircraft (a lot) have dihedral, which means that the individual lift of each wing is slightly offset; this I'm pretty sure is what produces yaw/roll coupling.

Example of what I'm talking about with slanted vertical stabilizers:


A lot of the math you're using is pretty hard for me, but I'd love to play with your implementation and help to make improvements; especially in regards to tool integration and providing aircraft models. :) Could you PM me the details, please?

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
just enter the url in my siggy (or more specifically, this) into your svn client, tortoise works fine. you should be able to check it out right into your freespace 2 directory and it will create the mod heirarchy for you.

the current flight model only uses a single solid body so far, so the lift angle is always perpendicular to x, it does not currently simulate lateral lift from the vertical stabilizer (though horizontal aoa is computed) or horizontal stabilizer. in fact there are no torque physics at all aside from rotational thrust and momentum. thats one of the reasons i want to move to a multiple solid body system.

im actually not sure how id go about determining the direction of lift from an arbitrary solid body. i might give every solidbody an orientation matrix, so that airflow may be put into its frame of reference, and then just consider up (in that frame of reference) to be the initial direction of lift, this would be rotated by aoa (in that reference frame), this would then be brought into the models frame of reference. i may also give every object both horizontal and vertical lift attributes and just use the model's frame of reference. this would work for computing the lift caused by an aircraft's fusalage, though this is typically only a small contribution to the overall lift. still it would make simulating a v-tail difficult. best solution might be to do both. most of the time your wings and stabilizers will be aligned to an orthogonal plane, so the matrix would default to identity and you could just omit it from the tables.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN