Sign in to follow this  
Starwaster

[0.90] Stock Drag Fix - Mar 19, 2015 (BETA UPDATE)

Recommended Posts

Stock Drag Fix is a simple fix for KSP's aerodynamics problem that also preserves KSP's stock feel. It does not try to be a simulation of real life aerodynamics.

In short, it is a 'stock-alike' solution to the drag problem.

(there, that puts the tl;dr up front)

As the name says, this fixes a problem with KSP's aerodynamic model. To recap, KSP uses mass to approximate cross sectional area.

While this may not be the correct way to implement drag, the premise of this mod is that KSP's drag system is an abstraction of a complex problem

and while not accurate is acceptable enough from a game design point of view.

Actually, it is not really mass based after all. SDF still produces the desired results but for different reasons than I thought....

However, KSP's drag model uses resource mass as well, producing incorrect behavior. Propellant laden rockets have excessive amounts of drag.

For stock Kerbin this isn't so much a problem, but for Real Solar System, it makes getting to orbit much harder because stock KSP applies too much drag, making it seem

(as others have put it) that Kerbin is surrounded by soup instead of air.

Also wrong.....

Freefalling objects in KSP also always fall at the same rate because more massive objects have more drag

which exactly counteracts their increased inertia (more drag; more inertia) whereas in reality their inertia should cause them to decelerate less than a less massive object. (same drag; more inertia)

This plugin neutralizes resource mass while continuing to allow stock aerodynamics to function rather than replacing it. Because of this, other stock game functions continue to interact appropriately. For instance, SAS works properly. MechJeb will also mostly function properly with this plugin in effect. Its handling of rockets and spaceplanes will not be impaired. It may have some problems with reentry accuracy but I haven't tested that enough.

With this mod, you can reach orbit around Real Solar System sized Kerbin with realistic amounts of delta V.

Download:

Source code!

New 1.2 Beta Download!

Stock Drag Fix version 1.2 (EXPERIMENTAL)

  • maximum_drag and minimum_drag are now modified based on part diameter and/or length.
  • unused drag models in stock KSP are now put to use. (CONIC and CYLINDRICAL) Nose cones, some crew capsules are set to CONIC. Any non-CONIC part that can have its length clearly determined via Module Manager config is set to CYLINDRICAL
  • Mass compensation mechanism changed. Part mass is discarded in favor of total vehicle mass. Vehicle mass is cached and recalculated each physics frame.
  • Drag now changes based on vehicle orientation. This WILL break MechJeb landing calculations for the same reasons that FAR breaks them.
  • Mach drag modifier in. (using static SL speed of sound. Yes I know this is wrong)
  • Stock cargo bays (Mk2, Mk3) and KW Rocketry's petal adapter now shield parts contained from drag. This will also affect Deadly Reentry: Parts thus shielded will be recognized as shielded by DRE. KSO cargo bays and other will be added later where possible.

https://github.com/Starwaster/StockDragFix/releases/tag/1.2

Concerning FAR: You should not use this together with FAR. At best they would be ineffectual together. At worst they would conflict with each other as SDF actively seeks to modify fields that FAR depends on being zeroed out so that the stock aerodynamics system is disabled. Also, you probably either don't need this because you have FAR or you want a simpler drag system or find FAR too hard. In either case you definitely need to choose between one or the other and do not try to run with both installed.

88x31.png

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Edited by Starwaster
beta update notification

Share this post


Link to post
Share on other sites

Change Log

Version 1.0 - Release

Version 1.1

- Recompiled for KSP 0.90

- Optimization changes:

- Removed unnecessary checks and computations

- Moved dragScale sanity check to main SDF class. (one time execution)

- Fed some turkey sammich to Cleopatra, The Feral Cat

Edited by Starwaster

Share this post


Link to post
Share on other sites

Ok.

After a little try, it seems to me this "release" was kind of "in a hurry" made (a few mac specific files remains), and not usre but RT2 antenna don't like it that's much, they go where they want out of the vessel they're supposed to be attached on ! And, worth !, no event is logged on flight log :huh:(someone stole my antenna, leaving the vessel uncontrolled and he/she has also hacked the ship computer !).

Perhaps it's weakened the joints in a way or another, making small parts (physically not significant) detach themselves. No, it's only the extended antennas !

You may try with RT2 to see if the same happened to you.

Share this post


Link to post
Share on other sites

Wow, very nice! It's cool to have two mods now that change the aerodynamics, I like it. :-)

Share this post


Link to post
Share on other sites

I've been waiting for this for a long time! I have hated FAR due to the fact that if you point your rocket too far off-center, it flips out and undergoes Spontaneous Unplanned Disassembly.

Share this post


Link to post
Share on other sites
I've been waiting for this for a long time! I have hated FAR due to the fact that if you point your rocket too far off-center, it flips out and undergoes Spontaneous Unplanned Disassembly.

You mean like, reality?

Hey StarWaster can you compare this to FAR? Are you trying to deal with something FAR isn't, or are you duplicating some of what FAR does while leaving the rest alone? Just trying to understand where each sits on the playing field.

Share this post


Link to post
Share on other sites

Whats the difference between this and FAR? Is there any advantages this could have over using FAR?

I left the page open for too long! Whoops!

Share this post


Link to post
Share on other sites

Im massively guessing here but will this make planes go faster but not effect their lift? so it *should* work with mods like KSO and CSS?(space shuttles)

Share this post


Link to post
Share on other sites
Ok.

After a little try, it seems to me this "release" was kind of "in a hurry" made (a few mac specific files remains), and not usre but RT2 antenna don't like it that's much, they go where they want out of the vessel they're supposed to be attached on ! And, worth !, no event is logged on flight log :huh:(someone stole my antenna, leaving the vessel uncontrolled and he/she has also hacked the ship computer !).

Perhaps it's weakened the joints in a way or another, making small parts (physically not significant) detach themselves. No, it's only the extended antennas !

You may try with RT2 to see if the same happened to you.

Cartman...what the hell are you talking about???

I just downloaded from both locations and I see no Mac files, unless they're invisible to me. Or unless you downloaded from Github and are confusing some of the source project files for something Mac-specific.

It's highly unlikely that the mod is doing anything to RemoteTech 2 parts, but I will look into it. I'll uninstall SDF, install RT2, make an RT2 specific save game, launch some stuff then come back and reinstall SDF.

You mean like, reality?

Hey StarWaster can you compare this to FAR? Are you trying to deal with something FAR isn't, or are you duplicating some of what FAR does while leaving the rest alone? Just trying to understand where each sits on the playing field.

Quite often over the past few months I've seen references to 'FAR lite', either with regards to something that was planned or contemplated by Ferram or requested by people that didn't like some aspect or other of FAR.

This isn't 'FAR lite'.

But it is a lightweight solution that approaches the drag problem from an alternate perspective. It tampers with as little of the stock system as possible so that anything that relies on stock behavior will not have its functioning impaired. (much). Things like stock SAS and MechJeb 2.

It doesn't try to be realistic though it is 'more realistic' than current stock behavior. Which is something that I've perceived a need for based on some of the complaints I've seen leveled against FAR over the past year or so.

What it doesn't do (that FAR does)(not a complete list and provided as neutrally as possible. Not pros/cons, etc)

  • Replace mass value with cross sectional value. (probably not likely to change)
  • Alter drag with orientation (which can change the amount of cross sectional presented) (not likely to change in future releases)
  • Alter drag coefficients across subsonic, transonic, supersonic or hypersonic regimes. (might change in future releases)
  • Rip your rocket apart due to aerodynamic stresses that might or might not be accurately modeled. (incredibly unlikely to change in future releases)
  • Provide benefit to Procedural (and other) fairings. (will probably change but requires a lot of coding. But definitely this is doable)
  • Require you to analyze your spaceplane in the SPH with graphs and simulations before you can take your spaceplane out there and actually play the game. (Never going to change. Especially not ever)
  • Be a simulation. (Never going to change. Especially not ever)

So basically, this gives those who want a more realistic drag system a lightweight alternative to what's been available now. It gives them an improved drag system that fits in with stock behavior instead of simulating everything. It's been said that stock drag is based entirely on mass, which is not an accurate statement at all. Stock drag is actually based on the same thing FAR is, which real life drag calculations are based on: Velocity. The faster you're going, the more resistance you meet with from the medium you're traveling through. It uses the same computation but substitutes mass for cross section. Almost certainly to simplify things. The problem as I saw it wasn't that it was using mass (which is certainly wrong, but acceptable from a game design standpoint) but that they were using wet mass. In other words... it's actually ok to use mass. It's just a number. It might not be the right one but it still results in somewhat accurate behavior. As long as it's not wet mass. In stock KSP, if you take a full fuel tank and an empty fuel tank and drop them from the same height, the full fuel tank should hit the ground first. Its increased mass should give it inertia that overcomes drag more than the empty tank does. But by using wet mass, the full tank receives increased drag exactly enough to offset its inertia and they both hit the ground at the same time (more or less). It also means that engines have to work harder to overcome drag than they should. This makes it harder to get to orbit in Real Solar System than they should. Experimental data is that I can get to orbit in RSS now with pretty close to the same delta-V that I would expend if I were using FAR.

Ok, so in summary (the tl;dr), (I'm rambling a bit because I was up late last night and am still a bit sleepy) The key differences are that FAR gives you a simulation of aerodynamics, with all the good and bad that may bring and Stock Drag Fixer only attempts to fix a problem with stock drag. If you want reality (or as close an approximation to it as FAR can give) then you shouldn't use this. You should stick with FAR. If you just want a better drag model that doesn't bring 'soup' to the table, then Stock Drag Fixer will do that for you with its simple, one assed schematic. (Southpark reference. don't read anything into to it. I'm tired, want to go back to bed and can't and I have no idea what that even means... I just liked the sound of it)

Edit: Just re-read that soup thing. Not implying that FAR brought the soup because FAR took it OFF the table. But now, so does SDF.

Im massively guessing here but will this make planes go faster but not effect their lift? so it *should* work with mods like KSO and CSS?(space shuttles)

KSO users would definitely benefit from this over FAR. I tried literally for days to land a single KSO25 shuttle (F5-F9) and even surviving the reentry the KSO25 would go into a nose dive as it slowed to subsonic that was only correctable by shifting its CoM farther back than it should be to be even at all recoverable. (IRL, the space shuttle would go into a 20 degree dive and then flare up at the end, so it's not like there's no precedent in reality, but in the end, I think it was just too complex a shape to be modelled accurately)

Edited by Starwaster

Share this post


Link to post
Share on other sites
If you want reality (or as close an approximation to it as FAR can give) then you shouldn't use this. You should stick with FAR. If you just want a better drag model that doesn't bring 'soup' to the table, then Stock Drag Fixer will do that for you with its simple, one assed schematic. (Southpark reference. don't read anything into to it. I'm tired, want to go back to bed and can't and I have no idea what that even means... I just liked the sound of it)

I'll test this sometime this weekend in between my drinking. Expect a half-sober report by Monday.

Share this post


Link to post
Share on other sites
ok so basically this makes kerbins atmosphere thinner but still at 70km?

No.

The stock drag model bases how much drag you get on how heavy you are. That means a heavy rocket has more drag than a light rocket. Or a rocket with full tanks has tons more drag than the SAME rocket with near empty tanks. (Which is so far detatched from reality as to be bizaro world) What the fix being provided here does is find out how much of the rocket mass is internal resources, like the fuel, and removes that value from the drag calculation, making the drag model treat it like it's empty. That then allows the drag model to base the drag off the part's dry-mass alone. Which isn't realistic, but at least reasonable.

Share this post


Link to post
Share on other sites
ok so basically this makes kerbins atmosphere thinner but still at 70km?

It doesn't affect the atmosphere, it only affects how objects interact with it.

It means that if you take two identical parts, one with fuel and one without, they will both experience the same amount of drag. In stock KSP, a full fuel tank experiences more drag. A rocket will have to expend more delta-V to get get to orbit, two falling tanks fall at the same rate (because the increased drag in the full part exactly offsets the increased inertia)

With this plugin, a rocket experiences the same amount of drag full or empty, which is as it should be. Rockets can get to orbit easier, especially in Real Solar System, where Kerbin (Earth)'s atmosphere extends to 180km instead of 70.

It is a stock-alike solution to a stock problem.

Share this post


Link to post
Share on other sites
Ok.

After a little try, it seems to me this "release" was kind of "in a hurry" made (a few mac specific files remains), and not usre but RT2 antenna don't like it that's much, they go where they want out of the vessel they're supposed to be attached on ! And, worth !, no event is logged on flight log :huh:(someone stole my antenna, leaving the vessel uncontrolled and he/she has also hacked the ship computer !).

Perhaps it's weakened the joints in a way or another, making small parts (physically not significant) detach themselves. No, it's only the extended antennas !

You may try with RT2 to see if the same happened to you.

By the way, I'm going to need some kind of repro information here besides 'someone stole my antenna' or 'try it and see if it happens to you'

I need to know exactly what happened to the antenna and how you got to where the antenna detached itself.

Share this post


Link to post
Share on other sites

Does the stockdragfix folder just go into the gamedata folder? What is the _macosx folder for? do I need to combine them? sorry never seen a mod with this file structure before.

Share this post


Link to post
Share on other sites
Does the stockdragfix folder just go into the gamedata folder? What is the _macosx folder for? do I need to combine them? sorry never seen a mod with this file structure before.

Put StockDragFix in GameData. Ignore the other; I'm not sure what it is, I dont see it when I redownload even. I am on a mac but I assume it's invisible to me. It must be a hidden folder that crept in when I zipped it up. I'll look into eliminating it.

Share this post


Link to post
Share on other sites
Put StockDragFix in GameData. Ignore the other; I'm not sure what it is, I dont see it when I redownload even. I am on a mac but I assume it's invisible to me. It must be a hidden folder that crept in when I zipped it up. I'll look into eliminating it.

K thanks also, when I unzip this I get a message about not being able to copy the encryption on the folder, ive never seen that before. do you know what that means? Is it another unimportant thing?

Share this post


Link to post
Share on other sites
K thanks also, when I unzip this I get a message about not being able to copy the encryption on the folder, ive never seen that before. do you know what that means? Is it another unimportant thing?

As long as you're still able to unzip it, yes. I have no idea what that is. I dont even have a PC I can test on atm. I was hoping to have a new PC by now but I dont think that's going to happen for a long while if ever so I'm stuck on an aging macbook that I installed Monodevelop on :(

folder/file structure of what you want to go in Gamedata is:

StockDragFix/Readme.txt

StockDragFix/SDF_Settings.cfg

StockDragFix/Plugins/StockDragFix.dll

Edit: Found a way to strip out metadata; reuploading. Should fix the encryption message too.

Edited by Starwaster

Share this post


Link to post
Share on other sites

The reaction to this should be particularly interesting to see; it's nice to actually have some competition in the aerodynamics realm. :)

A thing that you might want to mention is that drag-related instabilities are now a thing that players will need to think about, even though this isn't FAR or even FAR-lite. Since drag and (total) mass are now decoupled, the center of drag and the center of mass are no longer necessarily in the same place, and that will allow stability issues to crop up, although I don't think they'll be as severe as the ones in FAR.

Share this post


Link to post
Share on other sites

Giving this a shot FAR always confused me to much (sorry Ferram) will let you know how I go, I use MJ and powered landing we shall see the results

First indications

Using a DennyTX proton without Dragfix first stage jettions at 14000m with Dragfix its 26000m a huge difference and a more realistic result for a first stage burn, MJ had no issues pushing it to the 100km orbit

As predicted MJ had a real problem calculating landing site constantly course corecting and was ontrack for KSC but landed in the ocean 50km south

Edited by Virtualgenius

Share this post


Link to post
Share on other sites

Also on the test result front, seems to mess with MJ's ability to calculate terminal velocity, or somehow changes terminal velocity values. rockets I have built that previously would throttle back during a MJ launch due to terminal velocity now do not. I don not know if the values have changed, or if MJ cannot accurately compute TV because of changes due to this mod, nor do I know how to find this information.

Share this post


Link to post
Share on other sites

This seems pretty neat.

Have you thought about changing lift to be proportional to v2 instead of v1? The linear proportion in stock leads to some unfortunate effects at very fast and very slow velocities. Drag dominates lift at high velocities, meaning a spaceplane can't adjust its trajectory on re-entry, and the opposite is true at low velocities, which I believe leads to infiniglide.

Also, nice job on breaking the aerodynamics fix monopoly!

Share this post


Link to post
Share on other sites
Cartman...what the hell are you talking about???

Off topic but... SOUTH PARK FTW!

Share this post


Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this