Jump to content

Recommended Posts

Posted

I have been kicking around an idea for different way of backing up and restoring world data. In order for it to work I need to know more about how the dimension loading and unloading mechanism works. I have not kept up with Minecraft in a while and I am out of the game. On top of that most of the codebase has changed.

So my idea is leverage filesystem mechanisms in *nix OSes. I want to create a copy of the world data every X minutes (e.g 20 minutes) only keep the latest X copies (as per the configured options). In the event something happens to the world instead of shutting down the server I could record the last known postions of all online players and then kick them to a lobby dimension (DIM999) and force unload DIM0 for example. Then restore the world data to that dimension without requiring a full server reboot.

My rationale to this idea is the only thing that has changed is the world data, the mods and configurations have not, so why reboot the entire server?

If no one is occupying a dimension and its unloaded from memory can the world data be modified without breaking anything? Part of me from my sysadmin background thinks its that easy but I am not a game dev so there might be things I had not considered. I imagine most of my coding will be backend connections to Linux processes.

The other question is how would I deal with chunk loaders? Do chunk loaders identify themselves as such or are they a fake player? If I am sure are "real players" are off the world I could still force unload the world right?

Can anyone provide insight to this?

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Posted (edited)

My insight would be good luck. 🙂 I am far from an expert on chunk loading, but here's some observations:

 

* The chunk loading is pretty hard code to understand. Its partially asynchronous and has shared code between the client and server sides, but they use it in different ways. 

* Its made harder when you consider other mods are changing what it does, e.g. optimisations to lighting or just speeding up chunk loading in general

* The world save is split into "World" data and "Level" data. Its confusing, because forge used to call what is now called the level, the world. 🙂 The world data is typically only reloaded at game restart, e.g. restarting the server. Things could go wrong if these are inconsistent because you only backdated the level data.

* DIM0 (now called minecraft:overworld) is normally never unloaded (even if it has no players) because of the spawn chunks.

 

Then there is the usual rule. "Don't fix what is not broken".

Is a server restart really that slow that you want to risk world breaking bugs in your new code? Kind of defeats the point of what backups are supposed to achieve.

You might test it extensively during initial development. But when Mojang makes changes to it in future (that might be quite subtle) are you going to want to repeat the process?

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.