Atmospheric flight

WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Atmospheric flight

Post by WKFO »

I am just a player, and I am by no means a physicist or a mathematician, so please excuse my mistakes and correct them. I didn't see much planning on atmospheric flight, so I thought I could write down some stuff.

Atmospheric flight in Pioneer doesn't really feel atmospheric (I played with lots of flight sims), but I thought we could at least do simple effects.
For example, I think this is how KSP applies lift; it takes the drag applied to the lifting parts and multiplies it with the lift/drag constant and then multiplies it with the part's own lift coefficient or sth. Drag is already calculated with atmospheric pressure and speed, so it is pretty nice and reliable.

I think we can do a similar thing in Pioneer, since we already apply atmospheric drag to ships:

<Lift> = <Global lift/drag constant> x <ship's own lift multiplier> x <current drag> x <AoA multiplier>

We can add a "lift coefficient" property to every ship's JSON file, and those that does not produce lift will just read 0. The bigger the lifting-body area is (maybe blender can help with calculating areas?), the bigger the constant will be, but since ships do not share the same wing/lifting body design, it doesn't have to be really proportional between spacecrafts.

If the AoA (Angle of Attack (the angle between ship's nose and the direction of travel)) is 0, the AoA multiplier will be 1. If there is deviation, it will get lower (maybe until the AoA is about 90 degrees), until it clamps to the lowest value of 0. (No lift - Stall!)

There is another very important mechanic to be implemented: passive aerodynamic stabilization. Atmospheric-flight-capable spaceships must be designed with some sort of passive stabilization, so, even if no controls are touched, the ship should face the direction of travel by itself. We can apply a counter-force that pushes the nose towards the velocity vector.

<Rotational counter-force> = <Deviation in AoA> x <drag> x <passive stabilization constant or sth>

When controls are released (with autopilot not engaged), the ship's flight computer could apply automatic RCS to keep the nose at where the player left it, or it could just leave it be; I am not sure which one would be best. In most cases, the RCS thrusters should be way more powerful than atmospheric forces anyway.

Maybe, atmospheric shielding could reduce (or prevent) lift and passive stabilization.
This whole thing will probably make flying more difficult, and it will also take a lot of testing to find the right constants.

I don't know where (EDIT: Probably in DynamicBody.cpp) and how to code all of this right now, but I thought we could discuss.

Oh... And it will probably screw up the AI and autopilot. We will probably have to make the autopilot less aggressive.

I think Deneb, Wave, Venturestar, AC33 Dropstar, Lodos are the ships we can apply considerable lift, and they will probably have more powerful passive stabilization.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Atmospheric flight

Post by FluffyFreak »

There's been a few previous threads so before going any futher I'll just link to them

viewtopic.php?f=3&t=160&hilit=flight
viewtopic.php?f=3&t=50&p=480&hilit=Atmo ... light#p480
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Atmospheric flight

Post by FluffyFreak »

by the way WKFO, me linking to those threads wasn't meant to stop discussion but just so that you know there's been previous thoughts about it so you can draw from them.

I'm broadly in favour of introducing atmospheric flight control, I just don't know how to do it.
WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Re: Atmospheric flight

Post by WKFO »

I don't know exactly how to do the coding for that, so I'm just trying to experiment when I have free time.

Whatever I wrote above has lots of missing things, in means of realism, but it might just make a good start. ̶B̶u̶t̶ ̶I̶ ̶d̶o̶n̶'̶t̶ ̶r̶e̶a̶l̶l̶y̶ ̶k̶n̶o̶w̶,̶ ̶s̶i̶n̶c̶e̶ ̶I̶ ̶c̶a̶n̶'̶t̶ ̶c̶o̶m̶p̶i̶l̶e̶ ̶a̶n̶ ̶a̶t̶m̶o̶s̶p̶h̶e̶r̶i̶c̶ ̶f̶l̶i̶g̶h̶t̶ ̶d̶e̶m̶o̶/̶t̶e̶s̶t̶ ̶m̶o̶d̶ ̶f̶o̶r̶ ̶P̶i̶o̶n̶e̶e̶r̶.̶ ̶(̶I̶ ̶d̶o̶n̶'̶t̶ ̶k̶n̶o̶w̶ ̶h̶o̶w̶ ̶t̶o̶ ̶c̶o̶d̶e̶,̶ ̶I̶'̶m̶ ̶t̶r̶y̶i̶n̶g̶!̶ ̶M̶a̶y̶b̶e̶ ̶w̶a̶i̶t̶ ̶a̶ ̶f̶e̶w̶ ̶m̶o̶n̶t̶h̶s̶ ̶u̶n̶t̶i̶l̶ ̶I̶ ̶e̶i̶t̶h̶e̶r̶ ̶d̶o̶ ̶i̶t̶ ̶o̶r̶ ̶g̶i̶v̶e̶ ̶u̶p̶.̶)̶

I have looked at FlightGear's flight dynamics code, but it is way too complex; it calculates the motion of every flight control surface individually and applies torque to the main object or something along these lines. It could inspire, but I don't know how right now. We shouldn't start adding lifting body tags to ship models. Not yet anyway.
WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Re: Atmospheric flight

Post by WKFO »

I managed to make a simple lift demonstration, I can share soon. It doesn't have ship-specific lift, it applies the same lift for every craft, because otherwise I have to find a suitable lift value for every ship.
nozmajner
Posts: 1079
Joined: Mon Jul 01, 2013 3:25 pm
Location: Budapest HU

Re: Atmospheric flight

Post by nozmajner »

Hmm. A possible unintended consequence: it might screw with atmo scooping, if it generates too much lift in the denser parts.
WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Re: Atmospheric flight

Post by WKFO »

I thought so, but so far I was busy with just making it work. Never got the chance to test with a gas giant. We will either have to keep the lift low so they won't fly as efficiently as a 737, or pilots will have to do S-turns, like the space shuttle. Or both.

https://aviation.stackexchange.com/ques ... 3889#23889
WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Re: Atmospheric flight

Post by WKFO »

OK, I made a very simple flight dynamics thing but I don't know how to get data from ships' JSON files, so I just used a lot of global constants instead for testing purposes. Ships have lift and some passive aerodynamic flight control now. (The code doesn't check if ships have wings or not, it affects all in this state :))

https://www.dropbox.com/s/5h040y8saj7sy ... 1.zip?dl=0

^^ You can tweak things and help me out with the whole JSON thing maybe ^^
I need to be able to get some data from ship JSON files to tweak everything, but I don't know how to do that.

But I made a demo with global variables:
https://www.youtube.com/watch?v=uLBpRrjQmlk

Some ideas:
  • Increase drag, there is a bit too less drag IMO.
  • Damage hull in case of ultra-g manuevers (also add AoA and G gauges, maybe)
  • Add torque to force ship's nose towards velocity vector (I didn't figure out how to add torque yet)
  • And finally, replace everything with ship-specific values
  • And FINALLY, make sure autopilot doesn't screw up. Oh, well... I never thought of that, it seemed to be doing fine so far.
nozmajner
Posts: 1079
Joined: Mon Jul 01, 2013 3:25 pm
Location: Budapest HU

Re: Atmospheric flight

Post by nozmajner »

This would be so cool to have.

I could put aerodynamic surfaces on the ships, even animated (full extension on both directions I'd guess). Those could even be useful on a ships without any lift, for powered reentries.
impaktor
Posts: 994
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Atmospheric flight

Post by impaktor »

Search "LoadFromJson" in Ship.cpp
Post Reply