-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have Chunky detect if players are online and auto pause/continue #29
Comments
Sounds good to me. Thanks for posting here on Github so I can track this better. By the way, we can probably do this much more efficiently (check when a player joins / quits and immediately update the status). No need for some sort of timer thing, as that's just wasted time that could be spent generating chunks! |
Thanks for looking into and considering my feature suggestion! |
Hey! Is this being worked on by someone at the moment? If not I may try it. I've done a little bit of work to play around (using the event listeners to start/stop tasks when players join/leave), but there is still some work to do, like making a config option and getting |
I'm not currently working on it, so you're welcome to do some testing if you'd like to try to figure something out. My initial thoughts on implementation here was to poll for resources (such as player count) synchronously and then check these values in the generation task. Note: I've been working on refactoring portions of the code base, so just keep that in mind. I will probably not be merging anything else until I'm finished with that. Please message me on Discord if you want to know more about that. |
Maybe add a config to choose number of players online. (A lot of times one player is afking and then chunky can run perfectly |
This will be added in #58 (if it gets merged) @emielderckx |
I made a simple datapack that checks if the server is empty every 5 seconds. Continues/pauses generation accordingly. Although it runs the command every 5 seconds even if it's already running, it doesn't seem to have any performance impact. |
Is this still being worked on? Seems like a simple thing to do but very important feature in my opinion |
@alexanderhorner Good question, here are my thoughts currently as I have not posted an update on this issue in a while: I've been a bit hesitant to go forward with this feature as it encourages pre-generating with players online which kind of defeats the purpose of doing so in the first place for the majority of servers, since the reason you're doing it is to give players a better chunk loading experience, which is not going to be the case if you pre-gen while or after players have already joined. In addition, pre-generation generally does not lag the server at all on modern versions of Minecraft, even with players online. Chunk loading will be somewhat throttled, but any lag or TPS drops are usually not directly related. I have not yet closed this issue as I may still add options to control the rate, but for the most part it seems superficial and there have not been many requests for it, so it's been lower priority for me. I encourage you to try for yourself and give anecdotal evidence if you're not convinced, but there have even been raspberry pi's running without issues, and that's about as low-end as it gets in terms of running Minecraft servers. |
I am also interested in this feature. For us, being able to leave Chunky running while players are on the server would let us avoid taking the server down for half a day or more instead. We use Chunky infrequently, usually around game updates. Since upgrading to 1.18, we have been using it to upgrade the old terrain, both to make it easier on players exploring and also to let Dynmap render it (terrain that hasn't been upgraded to 1.18 can't be rendered by Dynmap). When we do run Chunky, it is virtually impossible to load new chunks. As long as players stay within the chunks they already have loaded, they can continue to play as normal. If Chunky were able to scale its work to have the impact of a single player flying around in spectator mode, then we could let it run without worrying about it hindering players, and it would finish its work in about a week. As it stands, we will be running Chunky on and off for probably a month to upgrade the 15k m radius circle in our world. It would take 2–3 days if we closed the server to players, which we don't want to do. Ideally, Chunky should be able to scale its performance impact so that it can take advantage of times when no players are on the server while also letting any players who do connect play the game as normal. |
Someone also shared a plugin on the Discord server which works similarly to the data pack above. So if you don't like data packs, there's another solution for the time being. |
Unfortunately, the plugin is for Spigot (we use Fabric), and I have tried the data pack but it doesn't seem to work (we've had it for two days and it hasn't started Chunky a single time). |
I just tested the data pack and it seems to work for me, at least on Fabric 1.18. I also made some changes in 93b2ffe which should fix compatibility with |
I think the issue with the datapack was that, as downloaded from GitHub, the pack itself wasn't in the root directory of the .zip file. I've repacked it and hopefully now it will work. |
Yeah I had to unzip it for it to work |
@Jipok's datapack unfortunately gives me the following error:
|
@alexanderhorner there was an issue with the line endings being mixed between UNIX-style and Windows-style. I fixed this issue by making all the files in the datapack use Windows-style line endings: Chunky Auto v2.zip |
I'd like to +1 this issue. Yes, in an ideal world you'd pre-generate everything and nothing would ever change. However, in real life a server can outgrow its current border and need to be expanded, in which case you kind of need to be able to generate chunks while online. Dynmap solves this very elegantly with several methods to determine if it should pause itself, and works flawlessly:
|
With the release of the Developer API, this is now possible via a custom integration. For example, I have written ChunkyPause for Bukkit servers which allows you to configure a max player count before pausing. The default is 0 which means that the server must be empty for tasks to run. Of course, you can also control the pausing of tasks by any other criteria if you like. 🎉 |
It's unfortunate that this couldn't be added to Chunky itself, but thank you. |
Let me be clear that by closing this issue I am not ruling out the possibility of adding this to the main plugin in the future, however I just cannot justify it at the moment. Allow me to give more context: Over the last 2 years since this issue was created, I have spent a lot of time trying to come up with ideas for how to best incorporate this into the plugin without adding too much bloat and encouraging bad practice with pre-generation. I just couldn't think of a way to do that effectively. The only somewhat sensible pausing method (in my opinion) so far has been player pausing, not for lag but simply to avoid generating chunks when players are also potentially generating chunks, and even that is a bit of a stretch. Most other stuff like pausing for TPS, RAM, and so on would be largely superficial (and has been known to cause problems with older pre-gen plugins like WorldBorder). That being said, I am providing the API so that server owners and developers can very easily create automations based on their preferences for how they want tasks in chunky to run. I believe this is the right decision in general for "custom functionality", and I am currently looking at doing this with custom shapes as well. For further discussion into adjacent features let's move into the #chunky channel on the Discord server as I'd like to avoid creating extra email spam for everyone following this resolved issue. |
Updated version of Jipok's data pack: ChunkyPlayerPause.zip Used for testing the fix for #334, but uploading here again in case anyone still finds it helpful... |
I'm requesting a feature that pauses Chunky when a player is online and continues it only when the server is empty.
Perhaps like a check every half hour or configurable time to check for players, would be great for small community servers that have periods of time with no players such as during the night.
Ideally a check every 20 minutes(or a listener, I don't know whats more efficient) to see if players are online
if yes, pause chunky, if already paused, do nothing.
If server is empty, run /chunky continue
The text was updated successfully, but these errors were encountered: