Jump to content

[1.3.X - 1.6.X] Speed Unit Changer - More units for your speed - Ap & Pe on your Navball


lttito

Recommended Posts

I just made a PR, updating the .gitignore file. Basically, I added a couple of lines so that when I do commits, I won't mess up your configs.

Let me know if/when you accept it, so I can pull it down and send you a few more PRs

@lttito Pinging you about this (forgot to in original post)

Edited by linuxgurugamer
Link to comment
Share on other sites

@lttito

I made a PR this afternoon with the following changes:

Changes

  • Replaced the StringBuilder code with simple concatenation for speed. The old code is still there, but commented out. See below for explanation
  • Added configurable significant digits
  • Moved toolbar code into same DLL (saves 7 k, and no need to multiple DLLs)
  • Added simple settings page which can disable the toolbar button in a save

 

Explanation

I recently was running some tests on various methods of string concatenation with regards to speed.
While StringBuilder is definitely the cleanest in terms of readability, it has a significant performance impact, especially when used in conjunction with String.Format.
I found that the StringBuilder is the slowest of the methods, and since this gets called at least 20x a second, it actually was causing problems for me on my big install, where I have about 220 mods installed. In some places you actually were using both String.Format AND StringBuilder, which was adding a lot of overhead.
See the following for the results of my testings:

Beginning timing tests

  • Timing results: Operator + Time: 551 ms/1_000_000 calls
  • Timing results: String.Format Time: 995 ms/1_000_000 calls
  • Timing results: StringBuilder Time: 653 ms/1_000_000 calls

Completed timing tests

 
 
 
Edited by linuxgurugamer
Link to comment
Share on other sites

20 hours ago, linuxgurugamer said:

@lttito

I made a PR this afternoon with the following changes:

Changes

  • Replaced the StringBuilder code with simple concatenation for speed. The old code is still there, but commented out. See below for explanation
  • Added configurable significant digits
  • Moved toolbar code into same DLL (saves 7 k, and no need to multiple DLLs)
  • Added simple settings page which can disable the toolbar button in a save

 

Explanation

I recently was running some tests on various methods of string concatenation with regards to speed.
While StringBuilder is definitely the cleanest in terms of readability, it has a significant performance impact, especially when used in conjunction with String.Format.
I found that the StringBuilder is the slowest of the methods, and since this gets called at least 20x a second, it actually was causing problems for me on my big install, where I have about 220 mods installed. In some places you actually were using both String.Format AND StringBuilder, which was adding a lot of overhead.
See the following for the results of my testings:

Beginning timing tests

  • Timing results: Operator + Time: 551 ms/1_000_000 calls
  • Timing results: String.Format Time: 995 ms/1_000_000 calls
  • Timing results: StringBuilder Time: 653 ms/1_000_000 calls

Completed timing tests

 
 
 

Good work.
I expect this weekend to include some code to show m/s and selected unit on the navball (as it is done currently for AP/PE on orbit mode) or something like this

Link to comment
Share on other sites

  • 3 weeks later...
33 minutes ago, HebaruSan said:

The 1.7.0 download seems to be missing the main folder that goes in GameData, so users would have to create it themselves. Any chance of a re-upload?

Thanks for letting me know.

Updated zip on spacedock and dropbox

Link to comment
Share on other sites

4 hours ago, TheKurgan said:

ok... so does this just go in any random folder I wish to create? I have never seen a mod that doesn't have a folder...

if the Zip does not contain a gamedata folder please re download the Zip file. It should contain It now

Link to comment
Share on other sites

2 hours ago, TheKurgan said:

 

Ah, yes, the dropbox version has the proper folder structure. The SpaceDock one doesn't. 

I updated it.. I'll try it to be sure is the correct one

EDIT: Have to put version number 1.7.0.1 on spacedock because it doesnt let me put the same version number. Should be correct now

Edited by lttito
Link to comment
Share on other sites

19 minutes ago, lttito said:

I updated it.. I'll try it to be sure is the correct one

EDIT: Have to put version number 1.7.0.1 on spacedock because it doesnt let me put the same version number. Should be correct now

There is a trick with spacedock needed to delete the current file.  First, upload a new file, the. Look at the change log where you can delete older files, delete the bad file,  Then upload the correct file WITH THE SAME VERSION NUMBER, and finally go back into the changelog and delete the temporary file

Link to comment
Share on other sites

  • 9 months later...
32 minutes ago, JJJacksonTyler said:

Is it locked to m/s while in an atmosphere? I use this with RSS and that works out perfectly, since the last official RO release is 1.3.1. I can't see to get NMI/MPH to display until I am already in space -- within the atmosphere, the navball seems locked to m/s. 

Actually if I remember correctly, it should be the opposite. On atmosphere It should allow you to change from m/s to other units (since that is the purpose of the mod) :wink:

Link to comment
Share on other sites

1 hour ago, JJJacksonTyler said:

It seems to be finicky with FAR, but from what I can gather -- FAR allows me to see MPH in atmosphere, while Speed Unit Changer allows me to see MPH in orbital mode once in space!

as FAR as I'm concerned (pun intended), FAR conflicts somehow with SUC because both try to write the speed at the same time. Maybe that's your problem.

Link to comment
Share on other sites

I love this mod, but there are a few settings I'd like to see added:

  • Option to replace AGL (Above Ground Level) altitude with ASL (Above Sea Level),
  • Option to replace Altitude with secondary speed unit, for example I could display both Knots and Mach,
  • Option to increase precision of speeds, so that Mach could display three decimal places (0.785) rather than two (0.79).
Link to comment
Share on other sites

  • 2 months later...
On 11/6/2018 at 4:18 PM, Shaun said:

I love this mod, but there are a few settings I'd like to see added:

  • Option to replace AGL (Above Ground Level) altitude with ASL (Above Sea Level),
  • Option to replace Altitude with secondary speed unit, for example I could display both Knots and Mach,
  • Option to increase precision of speeds, so that Mach could display three decimal places (0.785) rather than two (0.79).

I'll try to make some changes to fulfill your request as soon as I have some spare time.

 

7 hours ago, francentu3456 said:

hello lttito on Speed Unit Changer version 1.7.0 the conversion and wrong you have to make it more precise here is the example 1 km / hour = 0.27777777778 meter / second corresponds to 3 seconds and 600 Millisecond in Kerbal Space Program version 1.6.0.2395 2+2=4 not 3 :) update 

Sorry, but I couldn't understand you... Speeds are calculated always from m/s, in which KSP works, to the desired unit, and not the other way around. Maybe you're requesting more precision, something I would do, but still have no clue on what are you referring to with 2+2=4 not 3, sorry.

Link to comment
Share on other sites

  • 2 weeks later...
53 minutes ago, Modding Maniac said:

Since this mod is dead, how can i modify my base game to be EXCLUSIVELY in MPH

just take this mode and put it on MPHs because base game and all calculations are on m/s and the only thing this mod does is converting the speed when is shown in the navball.

Anyway, I'll try to update it tomorrow to show more precision for speed as it is done for altitude.

Link to comment
Share on other sites

  • 1 year later...

It's still working on 1.9.1. This is and afirmative, not a question.

Just installed and using.

The only micro thing is that when you start a flight, it shows all decimals, you need to click on icon to open close config to it respect what you put there. But this is not a problem.

Edited by Climberfx
Link to comment
Share on other sites

  • 1 year later...
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.

×
×
  • Create New...