Air resistance... in space?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
User avatar
Locane
Fast Inserter
Fast Inserter
Posts: 126
Joined: Fri Jan 04, 2019 8:46 am
Contact:

Air resistance... in space?

Post by Locane »

Can someone help me with why my "The Gulper" ship is so slow, given the thrust, engines, and weight? I have half a dozen other ships that aren't shaped like a giant hammerhead and weigh more that go faster with fewer engines.

The only conclusion I can draw is that the shape of the ship affects the speed. Is more pointed better, somehow? In space?

https://i.ibb.co/sypMTjV/2024-11-21-02-41-38.png
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3067
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Air resistance... in space?

Post by BlueTemplar »

With similar thrust too ? (Which I assume is what matters directly, rather than the number of engines.)
BobDiggity (mod-scenario-pack)
mmmPI
Smart Inserter
Smart Inserter
Posts: 3620
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Air resistance... in space?

Post by mmmPI »

The width of the ship has a strong impact on the maximum speed for the same given thrust and weight, the thinner the faster
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3067
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Air resistance... in space?

Post by BlueTemplar »

Huh, are you sure about that ?

I could imagine that something like this would have been added to give wider ships a better fighting chance against asteroids, but it's still unexpected...
BobDiggity (mod-scenario-pack)
morse
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Fri Oct 16, 2015 9:35 am
Contact:

Re: Air resistance... in space?

Post by morse »

BlueTemplar wrote: Thu Nov 21, 2024 11:09 am Huh, are you sure about that ?
That's absolutely true. I did a little research in the matter trying to find a formula for maximum speed (here). The width of the ship has a much stronger impact on speed than the mass (which is counter-intuitively almost irrelevant).
anossov
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Mar 28, 2019 9:06 pm
Contact:

Re: Air resistance... in space?

Post by anossov »

The formula is in utility-constants.lua:

Code: Select all

    -- drag_coefficient = width * 0.5
    -- drag = ((1500 * speed * speed + 1500 * abs(speed)) * drag_coefficient + 10000) * sign(speed)
    -- final_thrust = thrust / (1 + weight / 10000000)
    -- acceleration = (final_thrust - drag) / weight / 60
    
    space_platform_acceleration_expression = "(thrust / (1 + weight / 10000000) - ((1500 * speed * speed + 1500 * abs(speed)) * (width * 0.5) + 10000) * sign(speed)) / weight / 60",
    
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3067
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Air resistance... in space?

Post by BlueTemplar »

Thanks.

I was hoping to try to see parallels with real fluid drag equations, but the formula being used seems to be non-physical anyway because Wube seems to have confused force and acceleration :

final_thrust is already an acceleration because it is force (thrust(N)) divided by mass (probably kg) (abusively named weight here)
(and roughly divided, with an additional 1kg (or maybe 1t?) constant, I guess to avoid division by 0 issues ? shouldn't matter much otherwise)
following the well-known F=ma equation.

The issue is that this acceleration then gets divided by mass again in the final acceleration step, as if it was a force instead (because confusingly named 'thrust' too ?),
resulting in physically-nonsensical, unit-inconsistent, squared-masses (alongside with regular masses) in the final acceleration equation.

----

Otherwise, the speed squared and non-squared for drag (plus a constant) seem roughly like fluid drag equations at regular and low speeds respectively :
https://en.wikipedia.org/wiki/Drag_(phy ... g_equation
https://en.wikipedia.org/wiki/Drag_(phy ... okes'_drag
(Note A, the cross-sectional area, an equivalent for width here.)

Not sure about that 10kN constant, I can't think of a constant force like this always opposing the direction of speed... it might make sense if you wrongly treat acceleration as force like above and so it would be like the weight of a vertically rising (but not falling) planet-near object (as long as the distance moved is small compared to the distance center of the planet).
Last edited by BlueTemplar on Thu Nov 21, 2024 12:40 pm, edited 4 times in total.
BobDiggity (mod-scenario-pack)
mmmPI
Smart Inserter
Smart Inserter
Posts: 3620
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Air resistance... in space?

Post by mmmPI »

BlueTemplar wrote: Thu Nov 21, 2024 11:09 am Huh, are you sure about that ?
Yeah sorry about the lack of sources, it was pointed out some refs,
this was linked in other thread too : https://www.desmos.com/calculator/eykhbatbn6
to make a practical use of the functions, it's possible to configure how many thrusters / width / weight / fueling and it gives the speed
mmmPI
Smart Inserter
Smart Inserter
Posts: 3620
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Air resistance... in space?

Post by mmmPI »

BlueTemplar wrote: Thu Nov 21, 2024 12:31 pm Not sure about that 10kN constant, I can't think of a constant force like this always opposing the direction of speed... it might make sense if you wrongly treat acceleration as force like above and so it would be like the weight of a vertically rising (but not falling) planet-near object (as long as the distance moved is small compared to the distance center of the planet).
I think this is the 10km/s drift that exist in the game "to prevent platform to get stuck"/"to mimick the gravity effect"; it will be -10km/s constant when leaving a planet, but +10km/s constant when past the mid point of a travel, as then the gravity of the destination would "pull" the platform.

It's not super scientific sorry.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3067
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Air resistance... in space?

Post by BlueTemplar »

No, it's yet another effect, for one thing, it's in the opposite direction from the drag constant the last half of the journey.
Last edited by BlueTemplar on Thu Nov 21, 2024 12:45 pm, edited 2 times in total.
BobDiggity (mod-scenario-pack)
mmmPI
Smart Inserter
Smart Inserter
Posts: 3620
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Air resistance... in space?

Post by mmmPI »

BlueTemplar wrote: Thu Nov 21, 2024 12:40 pm No, it's yet another effect, for one thing, it's in the opposite direction from the drag constant the last half of the journey.
Yes that is what happens in the game, it accelerate the ship toward the destination, or it gives it a base speed of 10km/s whereas if you stop a ship in the first half of the journey, it will be a -10km/s base speed, because the ship will be attracted back from origin.


This means a ship going full speed (unthrotteled) has a 20km/s speed differential between first and second half of journeys
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3067
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Air resistance... in space?

Post by BlueTemplar »

I know, but that seems to be on top of this effect, and again, opposite to it the last half of the journey (always negative).
EDIT : actually, it will be opposite to it in the first half of the journey too, if your speed ever becomes negative !

The drag constant also gets divided by 60 masses, and gives acceleration, not speed.
BobDiggity (mod-scenario-pack)
mmmPI
Smart Inserter
Smart Inserter
Posts: 3620
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Air resistance... in space?

Post by mmmPI »

BlueTemplar wrote: Thu Nov 21, 2024 12:45 pm I know, but that seems to be on top of this effect.

The drag constant also gets divided by 60 masses, and gives acceleration, not speed.
I haven't done any analysis, i just repeated the same thing to make sure there was no misunderstanding, but i have no clue about the validity of my first and then repeated statement, it's only a thought and may very well be wrong. I can only say i haven't found cases where the desmos graph was giving me a wrong answer, and i used it quite a bit.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3067
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Air resistance... in space?

Post by BlueTemplar »

Well, for the screenshot example above at least, assuming drag is in kN (???), this drag constant would be -10 MN (regardless of ship), compared to the 1200 MN of displayed thrust, hardly noticeable ?
(EDIT : The lack of units in the formula here is really annoying...)

(It might just be another constant to ensure no divide by zero errors ?? But why not just 1 ??)

P.S.: It would matter for much smaller ships though - a single normal engine seems to have a minimum thrust of 9.9 MN ?


EDIT 2 : Disregard all of the above, trying to reason about it like this is probably invalid anyway due to thrust in the game following F=m²a, while drag is following F=ma...

EDIT 3 : Or is it the weight / 10000000 bit which can be neglected for most intents and purposes ?? Again, without knowing which units are actually used, it's kind of hard to judge...

(The bit about the drag constant slowing you down in the last half of the journey instead of speeding you up still holds though.)
BobDiggity (mod-scenario-pack)
jdrexler75
Inserter
Inserter
Posts: 42
Joined: Sat Nov 28, 2020 5:27 pm
Contact:

Re: Air resistance... in space?

Post by jdrexler75 »

The "drag" is probably meant to be gravity, pulling you towards the closest planet... that said, there's of course nothing even remotely realistic about space platform orbital mechanics so it's all down to game design choices instead. Trying to figure out how to massage it so that it matches some real life physics is futile.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3067
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Air resistance... in space?

Post by BlueTemplar »

Yet again, all the 3 drags (v^2, |v|, constant) act in a way to accelerate in the direction opposite to your speed, that's what the

Code: Select all

* sign(speed)
and

Code: Select all

- drag
are about.

And they will all 3 be opposite the planetary 'pull' (which does not show up in the above equation) if your speed is negative on the first half of the trip (because the 'pull' is negative there), or positive on the second (because the 'pull' is positive there).
BobDiggity (mod-scenario-pack)
User avatar
BraveCaperCat
Filter Inserter
Filter Inserter
Posts: 251
Joined: Mon Jan 15, 2024 10:10 pm
Contact:

How to fix "Air resistance... in space?"

Post by BraveCaperCat »

The equation is intended for acceleration (m/s^2) right?
With the assumption that we're calculating acceleration, not force or speed - this equation would do much better:
SpacePlatformAcceleration = Force * Mass
Creator of multiple mods, including Quality Assurance - My most popular one. Expect multiple modding-related questions, answers and other posts.
morse
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Fri Oct 16, 2015 9:35 am
Contact:

Re: Air resistance... in space?

Post by morse »

jdrexler75 wrote: Thu Nov 21, 2024 3:24 pm Trying to figure out how to massage it so that it matches some real life physics is futile.
Well, there are some hints. We see three components to the drag force: the one that correlates with the speed linearly, the one that correlates quadratically, and a constant one. The air friction is a tricky thing, but in schools it's usually taught as speed-linear at subsonic speeds and speed-quadratic at supersonic. The devs probably decided to go with both (I would also find it hard to determine the speed of sound in vacuum). The constant component would look like a dry friction, which indeed doesn't depend on speed. It was probably added to the game for the platforms to stop quicker. Without the constant component the stopping time will extend into infinity. The decision to adjust the thrust for mass is strange. They probably decided that it's bad that the top speed ends up not depending on mass and put it in there. But it clearly shows that the mass is still almost irrelevant to the top speed: it goes into formula with incredibly small coefficient. To have the same drop of speed you'll get by making your platform twice as wide, you'd have to make it 10000 as heavy (at which point your platform will just stop moving, because there seem to be a hard cap on mass/thrust ratio when the platform just refuses to fly).
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3067
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Air resistance... in space?

Post by BlueTemplar »

Ah yeah, that's a great way to try to compare things, thanks ! (In which units though ??)
The constant component would look like a dry friction, which indeed doesn't depend on speed. It was probably added to the game for the platforms to stop quicker.
That might be, if the 'stop' (in-between planets) was at 0 speed. But it's at ±10 km/s speed.

Which made me realize something :
The way this is actually implemented is probably like this (because it's simpler) (most of the previous discussion would then be irrelevant) :
There's an interplanetary medium / æther that flows towards the closest planet at a fixed speed of 10 km/s (it's 0 at the planets).
The ships velocity in the above-mentioned formula is relative to that medium, not to the planets, so it's not the displayed speed, which is offset accordingly (unless at a planet, where the offset is 0).

So the 3 drags have no effect when stopped relative to the medium (0 or ±10 km/s of displayed speed).
And the constant part of the drag indeed makes the velocity (relative to the medium, not the displayed speed) reach 0 quicker.
(I'm not 100% sure about that though, couldn't we observe the same thing if it was just rounding the speed at N decimal points ?)

The combination of first constant drag and then æther flow would be what prevents extreme platforms to even start flying ?
BobDiggity (mod-scenario-pack)
morse
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Fri Oct 16, 2015 9:35 am
Contact:

Re: Air resistance... in space?

Post by morse »

BlueTemplar wrote: Fri Nov 22, 2024 10:42 am relative to the medium
By just adding flat ±10 km/s after all the calculations you will get exactly that. For the purposes of this "friction" we can just ignore that shift. It doesn't matter relative to what the speed must reach zero, since the force of friction is calculated based on that very same relative speed. If there is no constant component, then at near-zero speeds the drag will also be near-zero, and the sequence will never converge.

The only place when the 10 km/s shift enters the calculations is when the "aether flow" changes direction, when you cross the middle, turn around, or arrive at the destination. At this point the game probably instantly changes the "relative speed" to keep the "absolute speed" the same.
Post Reply

Return to “Gameplay Help”