Vg34100 / Minecraft-SleepCycle

MIT License
0 stars 0 forks source link

Config File documentation #1

Closed SidekickDART closed 1 month ago

SidekickDART commented 1 month ago

Would you be able to provide documentation for the various settings in the config file? Some of the settings are self explanatory, but I'm having some trouble parsing others and how they relate to vanilla behavior. For example, does the sleep.tick.speed setting cause the world to tick at 100% speed or 100 times faster? I'm no coder but the source code seems to indicate the latter.

To give you an idea of the goal I have in mind so that you know what I'm asking for, I'm wanting to have my world tick the same number of times and progress the same amount of in-game time, just in a shorter real-life timespan. For instance, I'd like there to still be 5000 ticks between midnight (00:00) and sunrise (05:00), but I'd like the time to pass in 5 real-life seconds instead of the waking 4 minutes and 10 seconds. This may actually be the default behavior but my crops seem to be growing faster than I feel is fair for my playthrough. It seems the relevant settings would be sleep.day.skip.speed, sleep.sleep.tick.speed, and sleep.change.tick.speed but I'm not sure what to change them to.

Any information you can provide that would help me make these calculations would be greatly appreciated! This mod is exactly what I've been looking for and I really appreciate how lightweight it is.

foul-fortune-feline commented 1 month ago

Neither: The variable is poorly named. It only affects the random tick rate gamerule (specifically multiplies it while you're sleeping), which means random ticks (grass spreading, crops growing, fire spreading or burning out, that sort of stuff) happen more often relative to tickrate

The variable you're most interested in is sleep.day.skip.speed, and by default the server functionally skips 25 out of every 26 ticks. Each tick, the mod skips the server time ahead that amount of time and ticks the client that many times, but doesn't otherwise touch the server, meaning those ticks just don't happen

To do what your suggesting would be very dependent on your hardware, and would need a slightly different approach than the mod has taken (I likewise want it to work like sleeping in c:dda does lol, but the computational requirements would be considerable, especially for servers)

Vg34100 commented 1 month ago

Yeah the crops grow a lot faster than they really would if that game passed in actual game time. As @foul-fortune-feline mentioned, I just skip the server time ahead because despite my efforts, I never managed to figure out how to accurately simulate those ticks in a way that didn't also considerable lag (server overloaded) the world/server.

As mentioned in the config, the sleep.day.skip.speed is how much the game time is incremented every single world tick. So 1 work tick is 1 + 25 world ticks (default is 25). sleep.sleep.tick.speed is how much the random tick speed is multiplied when the player is sleeping. The default was 100 but that was an arbitrary number choice, if you want it to match how it would in real game time, you should have the day skip speed match the sleep tick speed. So if day.skip.speed = 25, so does sleep.tick.speed=25.

I'm working on an update where this is actually default and the sleep.tick.speed is actually a multiplier starting out at 1.0x. The update also comes with better config documentation as well as mod menu support (which was super tricky to figure out ngl).

I'm also increasing the day.skip.speed to 60, which correlates to the night between /time set night to /time set day being around 12 seconds including the wind up effect. But you can do some math to figure out the speed that the day skip speed needs to be, day.skip.speed= Minecraft ticks to pass/ Real-life seconds to pass x 20 minecraft ticks (the minecraft default) ​ For example, if you want to pass 1 Minecraft day (24,000 ticks) in 1 real-life minutes (60 seconds):

day.skip.speed=24,000 ticks / 60 seconds x 20 = 20

If I understood what you meant by " 5000 ticks between midnight (00:00) and sunrise (05:00), but I'd like the time to pass in 5 real-life seconds" and you wanted 5000 ticks in 5 real-life seconds the value needs to be 5000 / 5 x 20 so a day.skip.speed of 50.

SidekickDART commented 1 month ago

Thank you both for your help! This makes a lot more sense now. I'm using version 1.0.1 and I do have to say the info in the config file is very informative and I'm sure it will help other users a lot. Big fan of the Mod Menu integration as well!

As far as I'm concerned this issue is closed but I'm not sure if you're using it to remind yourself of a related issue, or of GitHub etiquette in general, so I'll keep it open for you to close when you see fit.

Thanks again!