Atmospheric flight

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

Re: Atmospheric flight

Post by WKFO »

What I was looking for was in ShipType.cpp, at line 51; but i still couldn't figure out how to implement it to DynamicBody.cpp
WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Re: Atmospheric flight

Post by WKFO »

Sorry for being illiterate, but I'm stuck. I'm very bad at coding.
https://imgur.com/a/1THkzAS
The linker isn't happy with using external variables. Perhaps they are inaccessible?

Anyway, the point is, even with the kind guidance of impaktor, I couldn't figure it out. Still.
Can someone show me how to read a value from

Code: Select all

/pioneer-master/data/ships/<shipName>.json
as a C++ variable in DynamicBody.cpp?
sturnclaw
Posts: 82
Joined: Tue Sep 18, 2018 12:20 am

Re: Atmospheric flight

Post by sturnclaw »

WKFO: marking a variable as 'extern' causes the linker to not allocate storage for it, under the assumption that it exists in another object file. If you try to link an executable without storage for all external variables, the linker will error, because everything using those variables needs to know where to look for it. While extremely bad practice, you can define a 'global' variable in a header file and provide one definition in a .cpp file somewhere if you want a global variable.
WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Re: Atmospheric flight

Post by WKFO »

I stopped trying the global variables and started using the GetShipType() thingy, like ecraven suggested. Here are new files. should only affect player ship in this state.
https://www.dropbox.com/s/t17h5w0h23hya ... 2.zip?dl=0

Now, if everyone is happy, I just need to debug it because although it compiles, it doesn't run. Just needs some more time. Google tells me I need to initialise stuff before using them.
Last edited by WKFO on Sun Feb 17, 2019 5:20 pm, edited 1 time in total.
WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Re: Atmospheric flight

Post by WKFO »

Dammit, i think i need to get 'the ship' instead of 'a ship' in the code. (get the 'ship' associated with the dynamic body)
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Atmospheric flight

Post by FluffyFreak »

WKFO, you have a Github repository? It makes it much easier to see what'd going on because then you can diff files/everything to see what's changed and the commits you've made.
WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Re: Atmospheric flight

Post by WKFO »

Excarto
Posts: 3
Joined: Sun Feb 17, 2019 5:25 am

Re: Atmospheric flight

Post by Excarto »

Hi WKFO,

I have actually been working on an atmospheric flight model, without realizing that someone else was doing the same. Maybe we can combine our efforts.

My flight model currently has 10 parameters per ship. It simulates lift-induced drag and parasitic drag, aerodynamic stall above a certain angle of attack, directional stability at high speed, and some other effects. You can find it here:
https://www.dropbox.com/sh/052eqd5a3ur0 ... DSI1a?dl=0

I have not figured out how to interface it with JSON yet. Right now the parameters are hard-coded for the Venturestar, which is very airplane-shaped, so it glides pretty well as long as the angle of attack isn't too high.

Since you beat me to it, you can decide if you want to use my model, or just finish it yourself.
impaktor
Posts: 1008
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Atmospheric flight

Post by impaktor »

It might be interesting to see how much "real grounded physics" each of you incorporates.

Ideally, we should keep number of parameters low, i.e. only include those that matter the most, and give each ship distinct properties, or that's my thinking at least. More parameters = more complexity = more that can go wrong, / harder to balance.
WKFO
Posts: 200
Joined: Wed Jun 14, 2017 12:37 pm
Location: Turkey
Contact:

Re: Atmospheric flight

Post by WKFO »

Excarto wrote: Wed Feb 20, 2019 2:19 am Hi WKFO,

I have actually been working on an atmospheric flight model, without realizing that someone else was doing the same. Maybe we can combine our efforts.

My flight model currently has 10 parameters per ship. It simulates lift-induced drag and parasitic drag, aerodynamic stall above a certain angle of attack, directional stability at high speed, and some other effects. You can find it here:
https://www.dropbox.com/sh/052eqd5a3ur0 ... DSI1a?dl=0

I have not figured out how to interface it with JSON yet. Right now the parameters are hard-coded for the Venturestar, which is very airplane-shaped, so it glides pretty well as long as the angle of attack isn't too high.

Since you beat me to it, you can decide if you want to use my model, or just finish it yourself.
I would be happy to combine our efforts once I've taken a good look at it.
Post Reply