Jump to content

[1.05] Fusebox - electric charge tracker and build helper. 1.52 released 24th Jan 16


Ratzap

Recommended Posts

I can confirm that there is a definitely a memory leak problem present in 0.9 that was not present in 0.8f

Ok, now we're getting somewhere. Thanks, a direct comparison will be faster to find than generally reading through - although 0.9 is a fair bit changed over 0.85f, still, less than everything is good.

I've been spending time trying to understand where the VAB lag with large rockets comes from and how to deal with it. I'm not sure if any of you are interested but I'm going to tell you anyway ;)

Unity3d (and thus KSP) have 2 routines that mods inherit to do their work: Update() and OnGUI(). Update() is called once per frame only and it cannot call anything which works on the GUI (ie draws things) - this makes it useful as a controller/timer. OnGUI() is called multiple times per frame based on how many events there are, it is the piece which can create windows and display things. Now the lag comes when a flood of events makes every mod installed run it's OnGUI() per event - unfortunately just moving the mouse is an event along with many other things. Skipping OnGUI() calls is not viable because your window then disappears for the frames it didn't run on - flickering ensues. Plus if those events were actually directed at your window (say a click to open the settings) your mod would miss it and settings doesn't open. So what I've done now is leave the pieces of the GUI which must be seen and need to react to events exposed to every event and set Update() to tell the mod 3 times a second that it should run a full frame calculation. This keeps the windows displayed, GUI items reacting to input and seems to cut the lag down considerably.

I'm thinking of trying a few other things to filter down the events but it might not be worth it. If the calculations to decide if I need to render a frame take as long as rendering it, it's not worth bothering.

I was planning to do the next release in 0.24 since it's close and I still have a bunch of things to look at but if I find the memory problem I'll drop an interim DLL into this thread.

Link to comment
Share on other sites

I have a feeling that most of what people are seeing is C# behaviour. The runtime won't GC unless it needs to or if you change scene (ie VAB to center). I found 2 items that could be declared static that came in between 0.8f and 0.9 but they couldn't possibly account for filling up multi GB of memory as they were never instanced anyway. I left a 0.9 running for 3 hours (only toolbar and squad with it), it grew certainly but it didn't crash and it grew because the GC simply did not run until I changed scenes. There are also a number of people talking about not using foreach with unity3d (and a number who say it's fine) so I can look at refactoring anything with a foreach - buuut those were all in place in 0.8f and earlier.

I still can't get it to change the line spacing of the font either. It's a KSP skin with 15 pixels of height per line and no way to change how it fits together. You can only control the style of the font: normal, bold etc.

I just ran this version for a couple of hours, it stays rock steady on memory usage (again, just FB, toolbar and squad), you might want to try it. If you do, remove your config.xml

https://dl.dropboxusercontent.com/u/71576136/KSP/Fusebox.dll

Edit: Aw crud, they pushed the new version. All work on hold for a bit while the dependency mods update.

Edited by Ratzap
Link to comment
Share on other sites

Hi, just a small bug report.

When the game is paused the 'bat current' level will count down as if it is still being drained.

edit: so, apparently it DOES drain battery while paused. paused the game with full battery, came back and resumed to find a dead battery.

Edited by Sacru
Link to comment
Share on other sites

edit: so, apparently it DOES drain battery while paused. paused the game with full battery, came back and resumed to find a dead battery.

Yep, that'll be a KSP bug, you might want to report it. Not all oddities with Fusebox are it's fault ;)

Any chance of making some sort of optional .cfg for RSS's darktimes? Or does it already scale properly?

That would be a major piece of work because why just RSS? Why not any made up solar system of any scale. I'll put it on the list but waaaaay down the bottom ;)

In other news, 23.5 seems to have calmed down so I'll probably get a 'bugfix and new libs' release out soon.

Link to comment
Share on other sites

I've rebuilt my dev setup with 0.23.5 compatible compiler (mono 4 from Unity 4.3.4), DLLs etc and recompiled the WIP Fusebox. In the process I found that the reason a bunch of mods are no longer being supported is because their authors have not updated them. To avoid problems in Fusebox, the knockon effect is that I have to drop support for them until such time as their authors update.

Aviation lights

Near Future

Remote Tech 2

SCANsat

will not be supported in the next release. I know it's a bummer but I can't afford to link to old libs which in turn can introduce bugs into my mod especially having spent a lot of time recently getting performance up and refactoring against possible memory leakage.

Link to comment
Share on other sites

So far in 0.95:

Lag reduction (only 3 frames per second are calculated but all events are rendered)

Some refactoring to reduce object creation but loops not changed.

Users can edit config.xml to manually change font style and colours (see unity3d documentation).

Launch clamps added as a filter.

Engine alternators shown in VAB by default, filter if you don't want to see them.

Darkness time for landed vessels shown on the darkness calculator - assumes no orbital inclination and a circular orbit.

No longer opens for EVA Kerbals.

F2 behaviour should be consistent.

I checked back the last 3 pages, I think that's about everything right?

Link to comment
Share on other sites

I'm still noticing lack of part/mod support in the drainage indicated (like it doesn't show the 0.04 that electrical life support takes in the Mk1 pod from TAC). Rather than try and support everything, keep what you got - which is sometimes good enough - but in the case of when its wrong give us a way to manually enter the drain amount. It's not really hard to calculate drainage amount - the change to power remaining as you swap around power parts is what Fusebox is great for showing.

Also, I'm not sure if this is possible in build mode but a more advanced addition to the mod would be the ability to place the "sun" some place around the craft. The sun could be just an arrow showing the general direction of sunlight. Then let us see exactly how much solar power we would be generating with our panels. Otherwise, right now you can place 4 panels at 90 degrees around a circular fuel tank and Fusebox will tell you you're generating the maximum amount of power from all of them - which is impossible because at least two will always be facing away from the sun. Also the further from the sun you are the weaker the panel charge is so figuring out how many panels you need for that probe to Eeloo can be tough I would think (haven't even left Kerbin's SOI yet so just assuming).

Link to comment
Share on other sites

So far in 0.95:

Lag reduction (only 3 frames per second are calculated but all events are rendered)

Some refactoring to reduce object creation but loops not changed.

Users can edit config.xml to manually change font style and colours (see unity3d documentation).

Launch clamps added as a filter.

Engine alternators shown in VAB by default, filter if you don't want to see them.

Darkness time for landed vessels shown on the darkness calculator - assumes no orbital inclination and a circular orbit.

No longer opens for EVA Kerbals.

F2 behaviour should be consistent.

I checked back the last 3 pages, I think that's about everything right?

All sounds ok. Don't worry about dropping support for mods which haven't been updated - the onus is on them to keep up. You can't be expected to update this and still maintain support for things that haven't been updated for months.

One thing, if it's not too late - could you make it so 'hidden' is the default? Well, not hidden, but closed-because-you-clicked-the-toolbar-button.. I've forgotten the word for that right now :| Or at least keep settings persistent - every time I switch to a ship or back or load one, the window is open and in the same place.

That would then be all I can think of to make this lovely little mod a million times more awesome.

EDIT: one question - are the engine alternators supported in flight too? When the engine's running, obviously...

Edited by ObsessedWithKSP
Link to comment
Share on other sites

I'm still noticing lack of part/mod support in the drainage indicated (like it doesn't show the 0.04 that electrical life support takes in the Mk1 pod from TAC). Rather than try and support everything, keep what you got - which is sometimes good enough - but in the case of when its wrong give us a way to manually enter the drain amount. It's not really hard to calculate drainage amount - the change to power remaining as you swap around power parts is what Fusebox is great for showing.

Also, I'm not sure if this is possible in build mode but a more advanced addition to the mod would be the ability to place the "sun" some place around the craft. The sun could be just an arrow showing the general direction of sunlight. Then let us see exactly how much solar power we would be generating with our panels. Otherwise, right now you can place 4 panels at 90 degrees around a circular fuel tank and Fusebox will tell you you're generating the maximum amount of power from all of them - which is impossible because at least two will always be facing away from the sun. Also the further from the sun you are the weaker the panel charge is so figuring out how many panels you need for that probe to Eeloo can be tough I would think (haven't even left Kerbin's SOI yet so just assuming).

I'd forgotten about TAC, I can chuck that in as he's updated it for 0.23.5. I'd considered modelling the position of the Sun to show accurate panel figures in the VAB but it'd be a huge piece of work and slow things down massively. I'm afraid that is one thing that will remain 'builder beware'. With the stock rebalancing mod, I'd thought about panel strength given that I have the darkness calc with a body picker already. It's something I might add in a future version.

All sounds ok. Don't worry about dropping support for mods which haven't been updated - the onus is on them to keep up. You can't be expected to update this and still maintain support for things that haven't been updated for months.

One thing, if it's not too late - could you make it so 'hidden' is the default? Well, not hidden, but closed-because-you-clicked-the-toolbar-button.. I've forgotten the word for that right now :| Or at least keep settings persistent - every time I switch to a ship or back or load one, the window is open and in the same place.

That would then be all I can think of to make this lovely little mod a million times more awesome.

EDIT: one question - are the engine alternators supported in flight too? When the engine's running, obviously...

Minimized as a saved config item, sure, that won't take long. I'll leave it open by default but if you minimize it and change scenes (which forces the save) it'll remember it. As to engine alternators, I'm looking at that right now as they are showing some bizarre behaviour. Some work and some don't, looking at the part.cfg files for engines some have "hideFlow = true" and I'm wondering if that is masking the generation.

Link to comment
Share on other sites

looking at the part.cfg files for engines some have "hideFlow = true" and I'm wondering if that is masking the generation.

I believe "hideflow = true" fixes the NaN/ElectricCharge bug. I would rather that weren't changed as it has some pretty serious knock-on effects if encountered. Also, thanks for the saved-as-close feature, much appreciated :)

Link to comment
Share on other sites

I believe "hideflow = true" fixes the NaN/ElectricCharge bug. I would rather that weren't changed as it has some pretty serious knock-on effects if encountered. Also, thanks for the saved-as-close feature, much appreciated :)

It looks like it's something to do with some engines using ModuleEnginesFX instead of ModuleEngines (which gives the newer particle effects). I've added ModuleEnginesFX and stock engines are working but novapunch still don't. It's weird but it's also 3:40am - time to sleep.

Link to comment
Share on other sites

how 'bout not supporting any of them in particular but instead, an API author's can use to add their parts to your list?

That could probably be done with callbacks but due to the nature of KSPs plugin system it would just mean the burden of version checking and linking would fall on them. There is just no escaping the fact that C# is a strongly typed language and it enforces it right down to runtime blocks. Which is not such a bad thing given the use it's being put to but it does make dependencies between objects important and KSPs plugin scene is very fluid. That said, it'd be something to look into once this release is done.

Link to comment
Share on other sites

Fixed the problem with alternators. The problem turned out to be ModuleManager added EngineFX definitions. All engines are defined as lists of modules with ModuleEngines first, to know if the alternator if making charge, you have to know if the engine is active and has a throttle level over zero. So when a mod like hotengines adds ModuleEngineFX definition blocks at the end of the list which override the original, when it got to the alternator check it couldn't see any active engine so charge produced = 0.

A few added checks and it's finding all of them now.

Link to comment
Share on other sites

Finally got KSP.IO to save and load colours, not as simple as you would think since complex types make it barf (colours are stored as a 4 float vector). This is now looking like RC1, I'll leave it running overnight and it if hasn't crashed by the morning it'll go up as the release.

Link to comment
Share on other sites

In 0.95:

Lag reduction (only 3 frames per second are calculated but all events are rendered)

Some refactoring to reduce object creation but loops not changed.

Users can edit config.xml to manually change font style and colours (see unity3d documentation*).

Launch clamps added as a filter.

Engine alternators shown in VAB by default, filter if you don't want to see them.

Darkness time for landed vessels shown on the darkness calculator - assumes no orbital inclination and a circular orbit.

No longer opens for EVA Kerbals.

F2 behaviour should be consistent.

*Font Style is an Enum, if unknown it will default to Normal. Colours are RGB values stored as floats in the range 0.0 to 1.0 per channel.

Support for Aviation lights, RT2, Near future and SCANsat dropped until their authors update. TAC LS support - initial additions, not complete.

Edited by Ratzap
Link to comment
Share on other sites

In 0.95:

Lag reduction (only 3 frames per second are calculated but all events are rendered)

Some refactoring to reduce object creation but loops not changed.

Users can edit config.xml to manually change font style and colours (see unity3d documentation*).

Launch clamps added as a filter.

Engine alternators shown in VAB by default, filter if you don't want to see them.

Darkness time for landed vessels shown on the darkness calculator - assumes no orbital inclination and a circular orbit.

No longer opens for EVA Kerbals.

F2 behaviour should be consistent.

*Font Style is an Enum, if unknown it will default to Normal. Colours are RGB values stored as floats in the range 0.0 to 1.0 per channel.

Support for Aviation lights, RT2, Near future and SCANsat dropped until their authors update. TAC LS support - initial additions, not complete.

Yaaay! :D Thanks for the update!

Link to comment
Share on other sites

Just a minor niggle - when I have Antennae Range installed, Fusebox no longer detects stock antennas. I presume this is due to the fact it changes ModuleDataTransmitter to ModuleLimitedDataTransmitter so it'd be nice if you could make it Fusebox checks for that as well. Love the new look of the GUI by the way, it's a lot easier on the eyes.

Link to comment
Share on other sites

In 0.95:

...

Thanks for the work on the update. I've been following progress on this project patiently in anticipation of this bugfix release. In using the most recent version, I noticed a couple things. When I toggle the settings UI option from "grey stock" to "black opaque," all Fusebox UI windows begin flickering/flashing at about 2-3 times per second. Also, the darkness calculator only displays the time of darkness on the surface for me. Adjusting the orbit altitude doesn't seem to have any effect.

One last thing I wanted to ask about is that I seem to remember there being a display mode that abbreviated everything in the main display window to a one-line read-out. Was that removed when toolbar integration was added?

Link to comment
Share on other sites

Thanks for the work on the update. I've been following progress on this project patiently in anticipation of this bugfix release. In using the most recent version, I noticed a couple things. When I toggle the settings UI option from "grey stock" to "black opaque," all Fusebox UI windows begin flickering/flashing at about 2-3 times per second. Also, the darkness calculator only displays the time of darkness on the surface for me. Adjusting the orbit altitude doesn't seem to have any effect.

One last thing I wanted to ask about is that I seem to remember there being a display mode that abbreviated everything in the main display window to a one-line read-out. Was that removed when toolbar integration was added?

That's odd. The default skin is "black opaque" like mechjeb uses, "grey stock" is the KSP standard. I'll play around with skin changes and see what it is. Did you remove your old config.xml (or the whole thing) before installing this version? It can get in a mess if it tries to use an old config.

And yes, I removed the concise mode when I added toolbar support since the toolbar gives you the same sort of information but even more compact. Green is good, green charging is refilling, red is draining and you can see how low by the amount of bars.

Link to comment
Share on other sites

I forgot to post it but you may have noticed - I fixed those bugs and put out 0.96

I did see the update and grabbed it. After finally getting a chance to install it and test, I can confirm the things I mentioned previously are no longer occurring. I had the option names reversed, based on misinterpreting the settings window. I actually prefer the black opaque style. I noticed when testing that the settings window doesn't seem wide enough for the "grey stock" setting. Some of the text is cut off in the settings window. The other windows appear normal.

I understand the toolbar graphics, and the animated icon is a nice touch. I suppose I just liked seeing the actual values in concise mode, so it became my favorite layout, but I guess it's no biggy if I'm the only one. Thank you for your prompt response and for pushing another update so quickly!

Edited by criminy
Link to comment
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.

×
×
  • Create New...