DMagic

[1.4.x - 1.6.x] DMagic's Basic Mods - Basic DeltaV 5.2 and Basic Orbit 8.4[2-12-2019]

Recommended Posts

Doing a quick audit, I'd double check that this does what it's supposed to in a debugger:

https://github.com/DMagic1/KSP_BasicOrbit/blob/12c3411589440381ab1540ebf3e13890ceb9b038/Source/BasicOrbit/BasicExtensions.cs#L34

        public const double AlmostMaxValue = double.MaxValue - 1000;

The distance between adjacent representable values isn't constant for floating point numbers (and grows as the numbers grow), so I would suspect that AlmostMaxValue is getting set equal to double.MaxValue here as the "- 1000" gets lost to a rounding error. That would then cause this check to fail:

https://github.com/DMagic1/KSP_BasicOrbit/blob/12c3411589440381ab1540ebf3e13890ceb9b038/Source/BasicOrbit/Modules/ManeuverModules/BasicManeuvering.cs#L583-L584

				if (dist1 > BasicExtensions.AlmostMaxValue && dist2 > BasicExtensions.AlmostMaxValue)
					return false;

... since the two values being checked are equal. That then allows the code after that to run with dist1 = double.MaxValue.

https://www.exploringbinary.com/the-spacing-of-binary-floating-point-numbers/

Quote

Those Gaps Get Huge

It’s easy to lose feel for the magnitude of these gaps. For example, in the neighborhood of 1e300, which in double-precision converts to 1.01111110010000111100100010000000000001110101100111 x 2996, the gap size is a whopping 2944. This explains why adding 1, 10000, or even

74350845423889153139903124907495028006563010082969722952788592965797032858020218677258415724807817529489936189509648652522729262277245285389541529055119731289148542022372993697134320491714886843511959789117571860303387435343894004407854947017432904150602255272707195641188267440734208

(that’s 2943) to 1e300 still gives you 1e300. (2943 is half the gap size, but the result rounds down to due round-half-to-even rounding.)

 

Share this post


Link to post
Share on other sites

@HebaruSan Yep, I was thinking the same thing. I changed it to double.MaxValue / 10, made it >=, and checked the values individually instead of both at the same time.

I have a handful of other small updates to this and Basic DeltaV that I'll release some time soon.

Share this post


Link to post
Share on other sites
6 hours ago, DMagic said:

@ZobrAA Do you know what the actual closest approach value is when that happens? It looks like some impossibly large value is getting calculated for some reason.

And does the same thing happen if you open the map view?

That number is the max value of a 64 bit floating point value in c#. Basic Orbit should be checking for such a possibility, but it looks like an error could have slipped through.

It's flickering - one second it show right numbers, than glitches, than normalize again and this bug showed only far from the planet in my enlarged Kerbal system. I've failed to find exact situation when it starts to happen.

Share this post


Link to post
Share on other sites

Hey first and foremost, great mods. 

I stumbled upon them and made a switch from KER as I loved the style as well as being a fan of your other mods. 

Secondly, having searched the topic and read the first post, am I correct in saying that TWR in basicDV is the maximum value? If so would there be a possibility in having a secondary based on thrust? It is the only thing I miss from KER

So for example TWR: CurrentThrustSettings TWR (Max TWR currently possible). 

Don't know if I explained that right (if it makes sense) or I am just missing something out. 

Share this post


Link to post
Share on other sites

@rakol That's one of the things I've already changed for Basic dV in flight for the next update. The display for the current stage will show the actual TWR (and thrust), and the max values in parenthesis.

Share this post


Link to post
Share on other sites

Basic Orbit 8.3 and Basic DeltaV 3.2 are available on Space Dock now (GitHub seems a little backed up, so the latest versions aren't posted there yet).

Both have fixes for the toolbar icon being fuzzy in some cases.

Basic Orbit has fixes for the closest approach and radar height calculations.

Basic DeltaV shows the current thrust and TWR for the active stage readout panel in flight.

Share this post


Link to post
Share on other sites

Hi, here is a log: https://www.dropbox.com/s/5sdzcbltobydaoj/saves for LoadingScreenManager.1.output_log.rar?dl=0

Yes it is an odd name but I do see the below in it.

This:

Spoiler

Load(Texture): BasicDeltaV/Resources/AppIcon
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Texture resolution is not valid for compression: 'C:\KSP\KSP 1.4.5.2243 Live\GameData\BasicDeltaV\Resources\AppIcon.png' - consider changing the image's width and height to enable compression

I hope that you can help out with my mission to clean up the log file, as I hope this is a trivial fix. Thanks.

Share this post


Link to post
Share on other sites
19 hours ago, CanOmer said:

Is this mod better than KER on garbage collection issue?

It's footprint is smaller than KER.

I can confirm that these mods work without a hitch in 1.5.

Share this post


Link to post
Share on other sites
22 hours ago, DMagic said:

@CanOmer Yes, but the difference is fairly small unless you have the screen covered with KER readouts.

Yeah.. but with KER you get a overflow of information... that's why i prefer these two mods... because they provide Basic info.. but just the right info at the right time!

Share this post


Link to post
Share on other sites
13 hours ago, MK3424 said:

Yeah.. but with KER you get a overflow of information... that's why i prefer these two mods... because they provide Basic info.. but just the right info at the right time!

It depends. I always setup KER to transparent displays and have only important ones at any given time online. Still, I have this thread marked to use Basic info if that need arise :cool:

Share this post


Link to post
Share on other sites

These mods seem to be fine in KSP 1.5. Let me know if anyone runs into problems.

Basic Delta V is in for a bigger update for 1.5. I haven't tested the existing version and so haven't marked it as compatible.

The next version will have an even more basic mode:

lwskCMK.png

This is the most basic mode, with the new dV and TWR indicators, both with tooltips to show the actual values. There are several other options that include showing the regular panels together with the new dv slider.

And this:

Fb604Fn.png

This looks suspiciously like the new stock maneuver node timer, and it is the stock maneuver node timer. But the stock dv calculations have been completely disabled. Instead Basic DeltaV is feeding its own data into the stock system so that it can still figure out burn times and staging, but without the garbagy stock dv calculator and all of its bugs and quirks.

Share this post


Link to post
Share on other sites

Wow, there is a lot to anticipate )

17 hours ago, DMagic said:

but without the garbagy stock dv calculator and all of its bugs and quirks.

I've seen somewhere recently that stock Dv calculator takes engine thrust angle into account. Was this feature replicated?

Edited by Psycho_zs

Share this post


Link to post
Share on other sites
3 hours ago, Psycho_zs said:

I've seen somewhere recently that stock Dv calculator takes engine thrust angle into account. Was this feature replicated?

The stock dV calculator does seem to do this.

This and KER don't take thrust angle into account by default. For KER there is an option to turn it on, but it is off by default. I don't know why it would be off so I will turn it back on for this. Maybe I'll add an option in the settings file to turn it off if there is some reason to do so.

Edit: Here we are, a new option for the settings window, on by default:

Ly7uo0M.png

Edited by DMagic

Share this post


Link to post
Share on other sites

Version 4.0 of Basic DeltaV is out; get it on Space Dock.

It has been updated for KSP 1.5 and contains many changes.

 

From the bottom:

In the editor there are a few changes. 

  • You can hold the modifier button (Alt) and right click the toolbar to toggle atmospheric mode (on planets that have an atmosphere)
  • A new toggle has been added to account for thrust vectors in all calculations, this function was previously turned off, but is now on by default
  • The vessel simulator calculations are now event-based in the editor, rather than running on a timer; this means that the mod will generally have a lower performance overhead (which was generally small anyway)

 

In flight there is a new "More Basic Mode".

  • New visual indicators for dV and TWR
  • dV information is shown in sliders that appear next to the staging panels
    • The slider displays the current dV for a stage out of a theoretical total dV for the stage
    • Theoretical max dV for each stage is calculated based on assuming all used resourced containers are full, all engines in the stage are active, and all engines are at full throttle
    • It is possible, and expected, for the actual stage dV to sometimes be higher that the theoretical max dV for that stage
  • TWR is shown as a gauge in the lower left corner
    • The value is shown on a log scale from 0 - 100, with intervals at 0, 1, 10, 100; the smaller intervals on the gauge are at the 2 and 5 levels (0.2, 0.5, 2, 5...)
  • Tooltips show the exact TWR and dV values
  • These new displays can be shown alongside the standard readout panels
    • dV and TWR cannot be shown in these panels at the same time, as there would not be space
  • The stage dV can be displayed as text in the dV sliders
  • These displays are also effected by the crew restriction options provided in the stock difficulty settings panel

 

The stock dV calculator can be disabled.

  • All stock dV info will be filled in using Basic DeltaV's values
  • The new KSP 1.5 stock maneuver node functions will still operate as expected
    • Burn time should be accurate based on Basic DeltaV's values
    • Stage indicators will be shown on the little maneuver node dV slider
  • Toggle this function in the stock difficulty settings panel

 

A few performance and garbage allocation improvements have been made.

  • A bug in the KER vessel simulator that was generating excess garbage and performance overhead has been fixed (and a PR sent to the current KER GitHub repo)
  • Garbage allocation for the standard readout panels has been reduced
  • Readout panels now use a simpler, more efficient UI layout
    • This also has the side effect of fixing the little flicker in the readout panels that occurs when anything about the panels changes
  • Fixed a few other minor bugs related to the toolbar button
  • The stock difficulty settings panel has been changed to "Basic DeltaV" rather than "Dmagic Mods" as there are problems with displaying too many mods on the same page

 

And now for some images: :D

Here is the TWR gauge with tooltip alongside the stage function UI:

jAa42ns.png?1

 

These are the dV sliders by themselves with the tooltip for stage 5 showing:

irX7UeZ.png

I do this for free @SQUAD :sticktongue:.

 

This is showing the current stage dV slider only, with the dV value shown in the slider and the tooltip active, alongside the standard readout panels:

ECCVBWV.png

 

And this is the stock maneuver node, doing exactly what it does in stock KSP, but with the stock dV calculator turned off:

Fb604Fn.png

Edited by DMagic

Share this post


Link to post
Share on other sites
1 hour ago, DMagic said:

You can hold the modifier button (Alt) and right click the toolbar to toggle atmospheric mode (on planets that have an atmosphere)

it show/hide the atmospheric tab in the the editor Basic dV setting panel, and doesn't toggle the atmospheric mode (vac/atmo), is it indended?
I still think the mod needs onscreen button/checkbox for toggling vac/atmo, like in the KER :)

 

1 hour ago, DMagic said:

The stock dV calculator can be disabled.

  • All stock dV info will be filled in using Basic DeltaV's values

Is this possible to make the same for the KER? @jrbudda

 

1 hour ago, DMagic said:

dV and TWR cannot be shown in these panels at the same time, as there would not be space

instead of the title and the unit in the dV: 1,090 m/s there can be just numbers 1090/2200 or 1090/1.35

Edited by flart

Share this post


Link to post
Share on other sites
3 hours ago, flart said:

it show/hide the atmospheric tab in the the editor Basic dV setting panel, and doesn't toggle the atmospheric mode (vac/atmo), is it indended?
I still think the mod needs onscreen button/checkbox for toggling vac/atmo, like in the KER :)

Showing/hiding the atmosphere tab is the toggle for turning on/off atmospheric mode. If the tab is open, then it is in atmospheric mode.

3 hours ago, flart said:

instead of the title and the unit in the dV: 1,090 m/s there can be just numbers 1090/2200 or 1090/1.35

No, I don't want to start adding context-less numbers on screen. There needs to be an indication for what they are.

Share this post


Link to post
Share on other sites

Started a new career with this mod, so far it's looking great.

IMHO, the TWR indicator in basic mode needs some tweaking. Log scale up to 100 isn't all that useful because the action usually takes place roughly between 0.3 and 5.

So, 10 would be a reasonable top mark, with more detailed log markings in between.

Also, it would be great to have a total DV figure somewhere at hand.

Share this post


Link to post
Share on other sites

Can you please add an option to still calculate engines that are shut down in current stage? I'm playing with non-zero minThrust, and have to shut down engines when not burning, thus loosing dV calculations.

Share this post


Link to post
Share on other sites

@DMagic, I have a crazy idea for a simple (I hope) modlet. Maybe, you would be interested in making it happen:

Engine Resetter:  on pressing X (cut throttle shortcut) shut down active engines in current stage and reset their 'staged' attribute to false (I hope it would be enough to make current stage stageable again).

It would be an elegant (in Kerbal terms) solution to non-zero minThrust engines.

 

Update: done some testing

In order to reset the stage and its engines the following is needed:

1. set  'state = 0' in engines part's main section

2. set 'Staged = False' in engine part's ModuleEngines*

3. increment 'stg' by 1 in vessel's main section.

Perhaps such action should only be triggered if there are any active engines in current stage with non-zero minThrust. Also exclude any engines that are not capable of shutting down (SRBs, allowShutdown = False)

Edited by Psycho_zs

Share this post


Link to post
Share on other sites

This is not bad, but a little annoying:

The thrust readout toggles between 2 and 3 decimal places all the time...

ycRjDjt.png5Htz6uM.png

Share this post


Link to post
Share on other sites

@Gordon Dry It looks like that might be a floating point problem. Do you know what the actual thrust of the engine on that stage is? It seems to be jumping between something slightly less than 10 and something slightly higher than 10.

@Psycho_zs This kind of edge-case handling is a little out of the scope of this mod. It's also a tricky thing to handle, guessing which engines people are possibly going to use. I take your point about TWR up to 100 isn't all that helpful, though.

Share this post


Link to post
Share on other sites
9 hours ago, DMagic said:

This kind of edge-case handling is a little out of the scope of this mod. It's also a tricky thing to handle, guessing which engines people are possibly going to use

Are you talking about displaying disabled stage calculation, or stage resetter idea? OK, the latter is out of scope, just some idea I suddenly had.

Regarding disabled engines in current stage, there is nothing to guess: just two simple conditions: 1. For current stage calculate only enabled engines. 2. If all engines in current stage are disabled, calculate them all.

The problem with current behavior is that when you shut down engines, dV calculation for current stage is lost and there is no way to bring it back other than start those engines again.

BTW, feature request for Basic Orbit: Field displaying dV sum of all planned maneuvers.

Edited by Psycho_zs

Share this post


Link to post
Share on other sites
6 hours ago, Psycho_zs said:

1. For current stage calculate only enabled engines. 2. If all engines in current stage are disabled, calculate them all.

I actually though it already did that, or something similar to that, I think it does for TWR, but I guess not for dV. That's relatively easy to change, it might not work correctly all of the time, but for most cases I think I have a solution (it works fine with the Kerbal X, at least).

 

6 hours ago, Psycho_zs said:

BTW, feature request for Basic Orbit: Field displaying dV sum of all planned maneuvers.

That's a good idea, too. I need to make some changes to Basic Orbit anyway.

 

I agree this looks more useful:

ItTbyOJ.png

The smaller hash marks are still at the 2 and 5 levels, but the scale only goes up to 10.

Edited by DMagic

Share this post


Link to post
Share on other sites

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.