MapLoader
Description
This plugin allows CraftBukkit server administrators to force the server to generate large portions of the world all at once so that it is not necessary for the server to load them as people explore. It was originally designed for use with Dynmap so that you could load a large portion of the world and see it on dynmap, thus allowing you to plan cities, towns, and other large constructions, as well as find the perfect spot for your castle made of spider webs. It should be noted it does not re-generate everything, only previously un-generated areas.
This plugin was originally made for my personal use when making adventure maps, but I have decided to release it.
Source: https:github.com/numenorean95/MapLoader
Current Version Info:
NOTICE: There is something weird with the current version, where it does not generate any surface elements. I will be taking a look at this as soon as I can. NOTICE NOTICE: I fixed this in the latest version (1.3.2) but it caused some potential problems with >200 radius on hyperload, so be careful.
This version has been tested and works reliably at radius 200 with 2 GB memory allocated.
WARNINGS
Please be aware this plugin is not very stable and will work better or worse depending on your system specs and the current alignment of the planets. DO NOT tell me about any errors relating to memory problems, I am aware of them.
With my new modifications it is safe for people to be on the server with up to a (tested) radius of 200. However I am not responsible for any lost items or corrupted world, although I am confident that it can do no harm other than crash the server. However, if a chunk is unloaded under a players feet...
In addition, with hyper mode activated players will be automatically kicked to take advantage of available resources.
Installation
Copy the jar into your plugins directory, restart your server.
No configs or anything, please look below for permissions.
Commands
All commands work from console or in-game
/load <world> <radius> [x-coord] [z-coord]
Aliases: /l
This will attempt to load the world from the point indicated by x and z to your radius's distance from the center (as a square). If you leave out x and z as console it will default to the spawn, if as a player, to your current location. This can take a long time, depending on how big your radius is. You must have the permission "ml.load" to use this, and I currently only have support for Bukkit permissions.
/hyperload <world> <radius> [x-coord] [z-coord]
Same as load, but much faster, and uses much more memory. Recommended for radius < 100.
/terminate
This will terminate the current running load, which will then have to be restarted to continue. Requires permission "ml.terminate"
Just a little example:
If you put in a radius of 50, you will be loading (50 * 2)^2 chunks, or 10000 chunks. Thus, a radius of 5000 would mean loading 100,000,000 chunks. USE AT YOUR OWN RISK, I have programmed in many devices to avoid cataclysmic problems, but they don't always work, and I do not check for stupid admins.
Permissions
ml.load - To use the command "/load"
ml.terminate - To use the command "/terminate"
TO DO List
- Change terminate command to /loadterminate
- Add /loadstatus command
- Investigate issues with Forge
How does this size up against WorldBorder's fill command? Is it faster? Does it generate less errors? Does it use less resources? If yes to all 3 I just may switch over to this.
@mailleweaver
Ok, it is uploaded. Have fun!
@Numenorean95
Sweetness! Thanks :) This'll sure beat flying around for hours.
@mailleweaver
Ha, that never even occurred to me. I will add that in the next version, which I should be uploading tomorrow.
I'd really like to use this, but I can't because my world name has a space in it. Would it be possible to change the syntax of the command so that the "world name" goes in quotes to support spaces? Or make it assume you want to load the world where the player running the command is located if no world is specified?
@maverickblue
Ok, new version is uploaded. Unfortunantly it was a lot harder than I thought it would be, and didn't turn out quite as well. Normal plugin operation is by default throttled to be stable for a variety of computer configurations and radii, so the new version does what you suggested and goes at full speed until a limit is reached. It is definitely less stable, but much faster. Take a look at the source if you want to and you can see how it works.
Any problems with dynmap are its own fault, not mine.
@Numenorean95
Neither CPU or memory presently seem to be issues for me, Bukkit still has over 2gigs of free RAM to play with out of the total 2.5gigs I gave it. The status messages indicate that it's gobbling up(and then freeing) 70-90MB of RAM per 400 blocks worked on. Perhaps it would help if a variable could be set in the config or via a command to allow it to take as much RAM as it wants until the amount of free RAM remaining reached X amount? That would leave a little (user defined) buffer so the server doesn't crash if say a periodic auto-save suddenly wanted a piece of memory. It seems to me (though this is a guess as I haven't the foggiest how your plugin works) that in my case the plugin is self-throttling itself long before it's able to hog a significant amount of resources, that due to the nature of the plugin, simply aren't going to be used for the most part until everything is generated anyway.
I also noticed it didn't seem to have the most graceful method of stopping dynmap, although that may be dynmap's fault as it's been giving me some issues. Of the several times I ran your plugin, it only gave the following error once:
Anywho, I look forward to trying your update this weekend. :)
@andrenoel1
As regards your suggestions, I like the new terminate command, that is a good idea. Also will be good for compatibility.
On another note, 5000!!!!!! You did see that I have tested it to 200 only, right? Well, having a radius that large would cause there to be a large lag in between status messages, so I will add a loadstatus command soon. All I can say otherwise is that I would not be surprised the server blew up.
I will check the in-game load, there could be a bug. FInally, the CPU is not the issue, odds are your cpu is relatively inactive. But memory is where it really gets problems, since it needs so much to save the world, This is Minecraft's fault, not mine.
@maverickblue
Thank you for pointing that out to @andrenoel1 , it should be noted I have not tested this with Forge and make no gueruntees that it will work. I will in the future, but now things are too busy.
As for a way to speed up the process, I should be able to add something to make it do more chunks at a time, but note that it does as much as it can possibly do at a time until memory runs out. Now that I think of it though... There are definitely a couple things I can do to speed the process up. Look for an update this weekend.
@andrenoel1
I don't know about you andrenoel1, but if you check your console you should see something like:
"10:42:10 [INFO] [MapLoader] Memory used: 82212 kb, per chunk: 205 kb 10:42:10 [INFO] [MapLoader] Loaded 105200 of 160000 chunks. Memory left: 2028053 kb. 10:42:10 [INFO] [MapLoader] Starting garbage collection... 10:42:12 [INFO] [MapLoader] Memory freed: 87813kb"
Which seems to keep track of progress every 5-10 seconds or so.
Which brings me to my question to the dev. Where it's best not to have players logged in while running this, is there anyway to just tell the plugin to have at 'er full steam? 160,000 chunks takes a heckuva long time to process, and the whole time my CPU is sitting at about 20-30% utilization, and as you can see above, roughly 2 gigs of memory just sitting there, begging to be abused by some greedy process...
How about a /loadstatus command? to see if its running and where its at in the process? perhaps showing its current working coordinates and a percentage of blocks done. also show the parameters given in the status report?
A secondary thought. perhaps the /terminate command would be better as /loadterminate this would keep the commands together in /help also it would be more meaningful.
As i type here I am testing this on my Feed-The-Beast Ultimate for 1.4.7 server. I noticed that the server does not respond to clients trying to connect during this even when the CPUs are not busy. Perhaps that is unrelated. I also noticed some errors that went whizzing by ending in a series of "[INFO] [STDERR] java.lang.NullPointerException". I also noticed an occasional cpu usage on 1 cpu that was maxed but most of the time almost no cpu usage. I suspect that was chunk generation. This attempt is of a radius of 5000. I am aware it is large.
With no way to know what it is or is not doing, I am left mildy frustrated and unsure if I should /terminate or restart the server or? lol
[a few min later...edit]
I /terminated the load. It said it terminated it. Then i issued a console stop command to stop the server. It errored some then I had to kill the process from the os.
Restarted my server.
Signed in with a cient.
Then I explored till I found some unexplored territory. I issued a /load overworld 50 xxx zzz for my current x and z. It said it finished in 0.05... seconds. That was exciting! lol well... About 3 to 8 seconds later I was disconnected from the server. Then from the console on the server I issued a /terminate and it claimed it did. Just for kicks I issued a /terminate again. It claimed there was nothing to terminate. I am pleased. But still the server will not accept client connections at all. It wont even respond to show the server running on the "Play Multiplayer" list. So I had to kill the java process again and restart the server.
The following error was when I tried to "stop" the server the last time.
[SEVERE] [ForgeModLoader] The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base classForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside ofForgeModLoader, especially Optifine, to see if there are fixes available.
There were other misc errors but this was the only severe one. Just fyi.
PS: The FTB server that I am running has both forgemodloader and an addon called BukkitForge and this part loads the Bukkit mods.
@shadvalentine
Hmm... did the plugin seem to keep running after the exception? I have seen this before, but it usually does not seem to cause any apparent problems. I will look into this closer to find a way to fix it though, as it is a rather explosive error.
@andrenoel1
Thanks, im glad you like it. As the plugin is very simple, it should probably work with every version of Bukkit ever made. The current file has been tested on 1.4.7 anyway, so feel free to use it!
This is on a radius of 10 .. seems to work fine on 5 and under
2013-04-06 04:34:47 [INFO] [MapLoader] Memory used per chunk: 173kb
2013-04-06 04:34:47 [INFO] [MapLoader] Loaded 400 chunks. Memory left: 1317969 kb.
2013-04-06 04:34:47 [INFO] [MapLoader] Starting garbage collection...
2013-04-06 04:34:47 [SEVERE] net.minecraft.server.v1_5_R2.ReportedException: Exception ticking world
2013-04-06 04:34:47 [SEVERE] at net.minecraft.server.v1_5_R2.MinecraftServer.r(MinecraftServer.java:556)
2013-04-06 04:34:47 [SEVERE] at net.minecraft.server.v1_5_R2.DedicatedServer.r(DedicatedServer.java:225)
2013-04-06 04:34:47 [SEVERE] at net.minecraft.server.v1_5_R2.MinecraftServer.q(MinecraftServer.java:474)
2013-04-06 04:34:47 [SEVERE] at net.minecraft.server.v1_5_R2.MinecraftServer.run(MinecraftServer.java:407)
2013-04-06 04:34:47 [SEVERE] at net.minecraft.server.v1_5_R2.ThreadServerApplication.run(SourceFile:573)
2013-04-06 04:34:47 [SEVERE] Caused by: java.util.ConcurrentModificationException
2013-04-06 04:34:47 [SEVERE] at org.bukkit.craftbukkit.v1_5_R2.util.LongObjectHashMap$ValueIterator.next(LongObjectHashMap.java:299)
2013-04-06 04:34:47 [SEVERE] at org.bukkit.craftbukkit.v1_5_R2.CraftWorld.processChunkGC(CraftWorld.java:1268)
2013-04-06 04:34:47 [SEVERE] at net.minecraft.server.v1_5_R2.WorldServer.doTick(WorldServer.java:213)
2013-04-06 04:34:47 [SEVERE] at net.minecraft.server.v1_5_R2.MinecraftServer.r(MinecraftServer.java:552)
2013-04-06 04:34:47 [SEVERE] ... 4 more
2013-04-06 04:34:47 [SEVERE] Encountered an unexpected exception ReportedException
net.minecraft.server.v1_5_R2.ReportedException: Exception ticking world
at net.minecraft.server.v1_5_R2.MinecraftServer.r(MinecraftServer.java:556)
at net.minecraft.server.v1_5_R2.DedicatedServer.r(DedicatedServer.java:225)
at net.minecraft.server.v1_5_R2.MinecraftServer.q(MinecraftServer.java:474)
at net.minecraft.server.v1_5_R2.MinecraftServer.run(MinecraftServer.java:407)
at net.minecraft.server.v1_5_R2.ThreadServerApplication.run(SourceFile:573)
Caused by: java.util.ConcurrentModificationException
at org.bukkit.craftbukkit.v1_5_R2.util.LongObjectHashMap$ValueIterator.next(LongObjectHashMap.java:299)
at org.bukkit.craftbukkit.v1_5_R2.CraftWorld.processChunkGC(CraftWorld.java:1268)
at net.minecraft.server.v1_5_R2.WorldServer.doTick(WorldServer.java:213)
at net.minecraft.server.v1_5_R2.MinecraftServer.r(MinecraftServer.java:552)
... 4 more
2013-04-06 04:34:47 [SEVERE] This crash report has been saved to: E:\UserFiles\SHADV\GameServers\TC35802484777261485638507\Minecraft\.\crash-reports\crash-2013-04-06_04.34.47-server.txt
Hello,
I am wondering if you have a version of this script for Minecraft 1.4.7?
I am running a Feed-The-Beast.com "ultimate" server which is currently for 1.4.7
I have tried other plugins for 1.4.7 that have each crashed when trying to use them.
I love the simplicity of this one.