Jump to content

[1.12.x] Bureaucracy - Monthly Budgets, Reimagined (1.5.1 - 13/08/2021)


severedsolo
 Share

Recommended Posts

  • 2 months later...

I'm kinda lost with the KCT warning, the Mod gives. I understand, why the warning pops up, but what settings I have to make, to make it disappear and work properly for:

1st) using the Bureaucracy Module

2nd) using the KCT Module

 

Kind regards.

Edited by zulu354
Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

Just a heads up for anyone who uses the Probes Before Crew mod and it's bundled contract pack, Bureaucracy's contract interceptor does not properly detect and modify the contracts starting with the first Mun contract and everything beyond that. To get it to properly intercept and modify the contracts, I had to go into the Probes Before Crew contract configs and remove the rewards from the individual contract parameters, combine them, and add them back in as rewards for completing the entire contract.

Just thought I would post that here so that anyone using these mods together will know to correct the issue prior to any contracts being generated incorrectly.

Link to comment
Share on other sites

  • 2 weeks later...
On 8/21/2022 at 5:06 PM, zulu354 said:

I'm kinda lost with the KCT warning, the Mod gives. I understand, why the warning pops up, but what settings I have to make, to make it disappear and work properly for:

1st) using the Bureaucracy Module

2nd) using the KCT Module

 

Kind regards.

Hey, sorry for a late reply, just reading this and wanted to answer you.  To fix it you need to right click on the KCT button on the toolbar to get the KCT settings.  Then disable the "KSC Upgrade Times".  This lets Bureaucracy do its thing with construction budgets.  I think it managed to do it on its own anyways but the popup was indeed very annoying.

 

Spoiler

ilMSIOZ.png

 

Link to comment
Share on other sites

On 10/30/2022 at 4:02 PM, WIbigdog said:

Hey, sorry for a late reply, just reading this and wanted to answer you.  To fix it you need to right click on the KCT button on the toolbar to get the KCT settings.  Then disable the "KSC Upgrade Times".  This lets Bureaucracy do its thing with construction budgets.  I think it managed to do it on its own anyways but the popup was indeed very annoying.

 

  Hide contents

ilMSIOZ.png

 

 

Thanks for the late reply. Better than now reply. =) I thought I did it that way and yet I got the messeges. Will check out and tell you soon*. :)

Link to comment
Share on other sites

  • 3 weeks later...
On 10/30/2022 at 4:02 PM, WIbigdog said:

Hey, sorry for a late reply, just reading this and wanted to answer you.  To fix it you need to right click on the KCT button on the toolbar to get the KCT settings.  Then disable the "KSC Upgrade Times".  This lets Bureaucracy do its thing with construction budgets.  I think it managed to do it on its own anyways but the popup was indeed very annoying.

 

  Hide contents

ilMSIOZ.png

 

 

I still get the message in game after choosing the preset as you showed...

 

Just found out, that KSC activates KSC Upgrade Times on its own, after I leave the VAB...

Edited by zulu354
Link to comment
Share on other sites

@severedsolo Hey I have a question, not sure if you're still around or not.. But I have a fairly extensive modlist (almost 200 mods) and I had installed a planet pack (Kcalbeloh System) and did a playthrough and everything worked fine, no problems (with any of my mods). Then I decided to enable the option within the Kcalbeloh System mod to use it as a system replacer instead of an addition, which also switches the homeworld to one of it's planets (which internally it keeps the name "Kerbin") and now when I load up the game and get to the space center, when I click on the Bureaucracy button the game immediately freezes and stops responding, then if I click anything it just crashes. The logs don't throw any errors or anything, it's like the log stops the moment I click the Bureaucracy button. Any ideas what could cause something like this?

Just because my modlist is so extensive, I figured I'd ask if there's anything obvious could be causing that issue, but if needed I can tear apart my install to see if I can figure out the problem. Perhaps testing it on an install that only has Bureaucracy + Kcalbeloh (SystemReplacer) will be in order.

EDIT: Okay so I decided to do a basic install with just Bureaucracy, Kcalbeloh and it's dependencies.. Plus the dependencies for it's dependencies.

50ab211a9b2a55c603265fabb6598990.png

Then I went ahead and without changes any settings in Kcalbeloh System (so that stock planets are kept, Kerbin is default homeworld) I loaded up the game to see if I could click the Bureaucracy button and I could! After this I closed the game, changed the settings to set Efil in the Kcalbeloh system as my homeworld and to remove the Kerbol System and replace it with the Kcalbeloh system. At this point I reloaded the game and started up the game, it took me to the space center and I attempted to click the Bureaucracy button. The game immediately froze (though I could still hear sound) and I waited for awhile and it just hung there frozen, I clicked again and it crashed. The log file does not appear to have any useful information in it regarding the crash (it's like when the game freezes, the log just stops logging.

LINK: THE KSP.LOG FILE

LINK: THE PLAYER.LOG FILE

KSP Version: 1.12.3

OS: Windows 10

Not sure if this is a Bureaucracy problem or a Kcalbeloh problem or both so I'll also tag @Jason Kerman here as well.

EDIT: I've also just verified it does not seem to matter whether RemoveKerbolSystem is True or False in the Kcalbeloh settings, this problem seems to occur only when I have Efil set as my homeworld. (Haven't tested the other selectable homeworld in the pack but I'm assuming this is an issue somehow with the original Kerbin not being the homeworld.

 

IMPORTANT UPDATE

Okay so... I think I've potentially found the issue. Even though the log file didn't have any errors when the freeze/crash happens, I decided to open the log and filter for Bureaucracy anyways to see if it was loading correctly and to my surprise I stumbled upon this line..

[LOG 19:32:41.608] [Bureaucracy]: Next Budget at Infinity

Now obviously the next budget being at infinity is a problem.. Presumably the problem that causes the issue when the button is clicked and it tries to open the Menu. So the next step was to make sure the settings were correct and then check how exactly it used those settings. Checking my Bureaucracy settings file, I found the "TimeBetweenBudgetsDays" to be set at 30, this seemed fine.

Then I went to check the Bureaucracy Wiki, specifically the "Settings" section and found the following line of interest; 

Quote
  • TimeBetweenBudgetsDays - how many days pass between each budget (automatically adjusted to your Homeworlds day length)

Now notice the brackets.. "automatically adjusted to your Homeworlds day length" .. That struck me as possibly relevant, as Efil is orbiting close to a gas giant and Suluco close to a star, upon checking the config files for both planets I found that both were tidally locked. So now I had to see how that would actually affect the "automatically adjusted" calculation in Bureaucracy and so I went and checked the source code for the mod, where I found this line of code.

BudgetManager.Instance.NextBudget = new BudgetEvent(Planetarium.GetUniversalTime()+TimeBetweenBudgets*FlightGlobals.GetHomeBody().solarDayLength, BudgetManager.Instance, true);

Now let's note here.. It takes the current time, then adds the time between budgets which is set to 30 days... Then... it multiplies that by the "solarDayLength" of the homeworld... So what exactly is the solar day length of a tidally locked planet anyways? The first thing I did was open the Kcalbeloh config for a planet that was not tidally locked, in this case "Ahtpan" and found it had a set "rotationPeriod" of 46870... and then upon checking the Kcalbeloh configs for both Efil and Suluco I found that while "tidallyLocked" was set to True, there wasn't actually and "rotationPeriod" set. (Perhaps it being tidally locked overrides the rotation period anyways?) I also noticed the absence of anything resembling "solarDayLength". So my next step was to check the actual Kopernicus log files for the homeworld, in the current test this is Suluco and in the "SulucoHome.Body.log" file I found this line.

[LOG 19:32:21]: solarDayLength = 0

BINGO!

If we take the calculation Bureaucracy uses to calculate the next budget cycle, we find that it's taking the universal time, then adds the 30 days from the settings, then multiplies it by... 0. This of course results in the next budget being set to... 0. Apparently when loaded this then simply acts as "Infinity" as shown in the KSP log file above. I presume that clicking the button triggers it to check for the next budget cycle and thus the game freezes because it can't figure it out.

So now I had to figure out how to make a tidally locked planet still function as a tidally locked planet without being a tidally locked planet. So I figured, why not just set "tidallyLocked" to false and then add a "rotationPeriod" which precisely matches the Orbital Period of the planet / moon. So I installed Kerbal Engineer Redux and looked at the Orbital Period for Efil, which was 2 days, 2 hours, 40 minutes, 56.806 seconds, converted that into seconds (52,856.806 seconds) and then went into the "EfilHome.cfg" file for HomeSwitch and set "tidallyLocked" to false and "rotationPeriod" to 52856.806 .

When loading the game, I now get this in the KSP log.

[LOG 20:39:14.042] [Bureaucracy]: Next Budget at 1585704.17999999

And with that... I can now click the Bureaucracy button and Efil will rotate as if it were tidally locked. In theory.

EDIT: Okay so while the game is not crashing now, I've just noticed that for some reason even with Efil's rotation period set to 52856.806, which should be 2 days, 2 hours, 40 minutes, 56.806 seconds... It's actually rotating once every 20 minutes, 18 seconds. Not sure what's causing that. Also the auto-alarm for the next budget is set to 73 days, while in the budget windows it says 30 years 44 days.. yikes.

EDIT: For anyone wondering what the issue was with the rotation time mentioned in the last edit, it turns out that this has to do with a bug which is related to having a homeworld that is not orbiting the "Sun". This bug is now being looked into (not by me) to see if there is a potential fix which can be implemented into Kopernicus to correct this issue.

Edited by CoriW
Link to comment
Share on other sites

Hey everyone, so I felt that since it's been several days since my previous novel of a post and the progress I have made with the issue.. That it would be okay to make another post. I have been able to use the source code for the Bureaucracy mod and modify it to have a couple new settings which can work around the issues of having a homeworld which is not orbiting the Sun, basically these new settings allow you to set a custom day length (in seconds) and a custom year length (in seconds) instead of having Bureaucracy automatically set these values based on the solar day length and orbital period of the homeworld.

So in my particular situation (having a homeworld which is a tidally locked moon of a gas giant) the game was crashing when I clicked the Bureaucracy button because it was trying to automatically set the day length based on the solar day which wasn't able to be pulled properly because the homeworld is tidally locked. So my attempt to make the planet not tidally locked was to just set it's rotation period to it's orbital period, which prevented the crashing but due to a bug it made the planet rotate much faster than intended. So now that I have modified the Bureaucracy mod to accept custom day and year lengths, I am now able to leave the homeworld tidally locked and simply specify in the Bureaucracy settings what the day and year lengths should be, thus Bureaucracy doesn't crash the game and my homeworld rotates normally. (It also allows interested options like setting the length of a year to the orbital period of my homeworlds PARENT body instead of my homeworlds orbital period, since it is just a moon after all.)

Now that's just my particular use case, but this could come in useful to anyone who encounters issues due to a tidally locked homeworld. Seeing as this mod is posted under an MIT license I am freely able to provide this modified DLL to anyone who wants or needs it. You may download it with the link below. One thing I will note is that by default I have the set the length of a day and year for Kerbin, if you have a different homeworld (which is the only reason you'll need this modified DLL.. Then make sure you change the settings to match the day and year length of your homeworld)

LINK: Mod_Bureaucracy_v2.zip (NOTE: THIS DOWNLOAD ONLY CONTAINS A .DLL FILE, YOU MUST DOWNLOAD BUREAUCRACY FIRST AND THEN OVERWRITE THE EXISTING DLL WITH THE ONE PROVIDED IN THIS DOWNLOAD.)

On another note, one problem with this solution is that you end up with the in-game clock not actually matching the length of your days.. for example my homeworlds day length in "Kerbin" time is 2 days, 2 hours, 40 minutes, and 56 seconds, however since Bureaucracy reads that amount of time as 1 day for my homeworld, that means that Bureaucracy says my next budget is on day 30 however in "Kerbin" time and on the clock in the top left corner the next budget actually occurs on day 73. At first I figured that this could potentially be solved by the Kronometer mod, however I quickly discovered that the "useHomeDay" and "useHomeYear" settings were also plagued with incompatibility with tidally locked homeworlds due to the solar day issue.. So I've gone ahead and used the source code for the Kronometer mod and modify it to have a couple new settings as well in which you can set custom day lengths and custom year lengths (in seconds).

This way, if you're using both my modified version of Bureaucracy as well as my modified version of Kronometer and you set the day lengths and year lengths to be the same in both mods as your homeworld, what happens is that Bureaucracy measures one day as the actual rotation of your tidally locked homeworld (in my case 1 day is 14 hours, 40 minutes, 56 seconds) and Kronometer actually changed the clock in the corner to display that a day actually takes that same 14 hours, 40 minutes, 56 seconds to pass, and the same thing applies for the length of a year for both Bureaucracy and Kronometer. (in my case with the year being the orbital period of the parent gas giant, that is 1342 days, 1 hour, 48 minutes, 57 seconds)

Luckily Kronometer is also posted under an MIT license, so I am freely able to provide the modified DLL to anyone who wants or needs it. You may download it with the link below. One thing I have to note with the Kronometer settings, is that in order for the custom day and year length settings to apply, you must also enable the "useHomeDay" and "useHomeYear" settings. (change them to True)

LINK: Mod_Kronometer_v1.zip (NOTE: THIS DOWNLOAD ONLY CONTAINS A .DLL FILE, YOU MUST DOWNLOAD KRONOMETER FIRST (LGG VERSION) AND THEN OVERWRITE THE EXISTING DLL WITH THE ONE PROVIDED IN THIS DOWNLOAD.)

LINK TO LGG VERSION OF KRONOMETER FOR KSP 1.12: https://github.com/linuxgurugamer/Kronometer/releases/tag/1.12.0.2

Also in the Kronometer modified DLL I did also add another setting that may be useful to anyone with a tidally locked world, by default if Kronometer detects a tidally locked world it will try and set the year length to equal the day length, however if your homeworld is a moon of another planet you may not want this to happen, and may want to use the length of the parent bodies orbit as the year length. In this case simply enable the "tidalOverride" setting and this will prevent Kronometer from trying to modify your year length.

Lastly AND VERY IMPORTANTLY I will note that while I have made these modifications to fix problems within my own game and have decided to share them as a good gesture for anyone else having similar issues with mod compatibility, I am not interested in taking over or continuing any mods or maintaining anything for the long term. If you use my DLL's and something breaks, you can DM me (don't post here as it may be considered off topic) and I may try and help fix the issue. But I must stress these modified DLL's are USE AT YOUR OWN RISK, they shouldn't have any problems as I am going to be using them in my own game, but if you intend to use them on an existing save for example, I strongly recommend backing up your save. You have been warned.

EDIT: Was just doing some testing... Definitely something interesting seeing a year be this long...

16640cde51544107e8f5eefc77e4c93b.png?dl=  851c1e6b665299c6cdd86d274257f6b5.png?dl=

Edited by CoriW
Link to comment
Share on other sites

  • 2 weeks later...

@CoriW - that was a fun read,  (and I'm so glad you got to the bottom of it rather than me having to!). If you ever feel like sending me a PR on Github I can merge your changes if I ever decide to pick up modding again.

Thought I'd share a little insight into why it hung (and stopped logging).

So when you click the button, as you rightly say, it queries the BudgetEvent to get the completion time of the event and display it in the UI (it doesn't calculate it again, it just pulls the UT timestamp out of the BudgetEvent class as it's already stored there).  The thing is, that timestamp is how many (in game) seconds have passed since the game started, not every helpful for a UI. So we call a method in the Utilities class that converts a UT timestamp to a more helpful string (Yx Dx).

That method is a bit crude, it just counts the number of years that need to pass to get within a year of the timestamp, and then when we have less than 1 year left, does the same with days. Works well in (nearly) all situations and doesn't log (because honestly if I logged every time the UI updated, you'd be spammed to hell).

So, the UT to Date String method grabs the completionTime from the BudgetEvent, and keeps adding a year at a time until it hits the timestamp. Uh how many years does it take to reach infinity again?  And thats why it hung. Bureaucracy got stuck in an infinite loop (literally), never released the main thread, and nothing else was allowed to run.

As an aside - I'm not really sure why it decided the completionTime was Infinity rather than 0 - but even if it had picked 0, your game would have frozen the moment you loaded your save (your timestamp of 0 is Y1 D1, and if the timestamp was in the past then you'd be stuck in an infinite loop of budgets firing).

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

 Share

×
×
  • Create New...