Lua, Creating and destroying worlds
#1
Can i using a lua plugin create a world ( by copying another ) set it not to save changes ( on chunks ) and when i don't need it destroy it?

I've been looking at the docs (http://mc-server.xoft.cz/LuaAPI/) and i couldn't find an answer.
Reply
Thanks given by:
#2
Hello,
it is historically possible to create a new world (cRoot:CreateAndInitializeWorld()), but it is an unsafe operation and it is quite prone to errors - the server is known to deadlock quite often in such cases. And there's no way to remove a world, mostly due to similar reasons (the operation wouldn't be safe) and also because of the built-in assumption of the Lua API (and MCS internals) that once you have a valid cWorld object, it will remain valid for the rest of the server execution. Breaking this assumption would require too much work, so it hasn't been even considered.

Can you elaborate on what exactly you're trying to do? Perhaps there's a better way of doing it, or at least a workaround.
Reply
Thanks given by:
#3
Sure.

Me and some friends we just finished a semester and wanted something to do.

I had this idea ( originally ), a scalable minecraft mini-game which would work in this fashion, a client connects to a modified MCServer ( either modified C++ or via plugin ) and that server has a bunch of slaves it would order one of them to create a mini-game instance ( like skywars for example ) this would be nothing but a short lived copy of a pre-made world, which would not need saving and could be destroyed when the game finishes.

A simpler version would mean making it work for one server only and then connect a bunch of them via bungee cord which would work fine as well, but it would be nice to be able to prevent the worlds form saving ( since they would have to be rolled back to initial state anyway so there is no need for saving ) and the world creation / destruction would be nice so that the solution wouldn't be having like hundreds of worlds / each possible minigame.

tl;dr i want to have minigames (like skywars) so i either create/destroy worlds or rollback changes made, and changes made one game don't need to be saved.

I might have screwed up trying to explain if anything isn't clear let me know.
Reply
Thanks given by:
#4
I think restoring an existing world back to its pristine state is a much easier option at this moment. That is, if you can keep the worlds reasonably limited. Restoring a 10k * 10k block world will not work, but for, say, 20 chunks * 20 chunks it should be perfect.

One more choice that comes to mind, make it a custom generator. Then whenever the chunk is (re)generated, the generator will restore the world.

And another: Set the world storage to forgetful - the changes won't get written to the disk, but still all players currently online in that world would see them. As soon as all of them log out, boom, the server unloads the chunks and the world is gone. If you put your regular MCA files to the world folder, they will get loaded the next time the world is used.
This might need some help from a plugin, too, though - you may need to override the OnChunkUnloading hook not to let any chunks unload as long as there's a player present in the world, otherwise they lose that chunk while playing.
Reply
Thanks given by:




Users browsing this thread: 4 Guest(s)