Inactive [ADMN/MISC] WorldGenerationControl v2.6 - Generate areas of your world at will [1.0.1-R1 / 1.1Dev]

Discussion in 'Inactive/Unsupported Plugins' started by Nephyrin, Aug 7, 2011.

  1. Offline

    Nephyrin

    WorldGenerationControl 2.6
    Formerly ForceGenChunks
    Which is a confusing ass name so I changed it

    WorldGenerationControl on BukkitDev

    This is a very simple plugin to allow you to pre-generate a region of your world. It does not affect already generated regions. As of 2.0, it can also repair lighting of existing regions.

    Features
    • Generate arbitrary regions by coordinates
    • Queue multiple generations
    • Various speed settings to control lag vs generation time
    • Works on a live server
    • Doesn't lock up the server (unless you use the /allAtOnce option)
    • Low ram usage, works on servers with 1gig of memory.
    • Generates trees & ore, not just land
    • Can generate valid lighting
    • Can force regenerate lighting on existing chunks, to fix light issues.
    Bugs/Quirks
    • Generating land and light take lots of CPU - nothing the plugin can do to prevent that! If you don't want to lag a live server, use the /slow or /veryslow modes.
    • Designed for servers with at least 1gig of memory allocated to them (-Xmx1024M). Servers with lower memory limits may encounter heap exceptions. If you have less than 1gig of memory, try using /slow or /veryslow modes.
    Commands

    The /genregion (or /generateregion) command can be entered by any server op, the server console, or anyone with the appropriate permission (see below).

    The syntax is:
    /genregion WorldName StartX StartZ EndX EndZ

    For circles (/generatecircularregion or /gencircle):

    /gencircle Radius [WorldName xCenter zCenter]

    The world and center coordinates for the circle command are [optional] if you are a player (not the console). It will default to your current/world position.

    All coordinates are in normal, in-game coordinates - but will be adjusted to the nearest chunk boundary (inclusive).

    Options

    All commands can have options applied to them like so:

    /gencircle 1600 MyWorld 0 0 /fast /lighting

    Options are not case sensitive. The available options are:
    • /allAtOnce - Don't pause between steps, generate everything requested all at once. This will make the server basically unusable until the generation completes, but get the job done fastest. Very useful in conjunction with /onlyWhenEmpty
    • /veryFast, /fast, /slow, /verySlow - Adjust speed. Has no effect if /allAtOnce specified. Normally the plugin will cause mild lag while generating usually doing around 700ms of work per three seconds (depending on the server CPU). Raising the speed with fast or veryfast will cause more lag but speed up the generation, slow or veryslow will reduce lag while increasing generation times. Veryfast will cause a lot of lag. Veryslow will cause almost no lag, but will take something like 10x longer.
    • /forceKeepUp - Force the server to 'keep up' with garbage collection and chunk saving. In particular, 1.9 Has a new async chunk saver, which appears to be rate limited, meaning it may not keep up with fast generations. This option forces the chunks to be saved immediately, rather than on a separate thread.
      You should use this option if you notice the plugin spending a lot of time "waiting for the server to catch up" and don't mind the minor increase in CPU usage caused by forcing it to keep up. /allAtOnce mode will always use this option.
    • /lighting:none - Skip generating light data for loaded chunks. See Notes on Lighting below.
    • /lighting:force - Reset and regenerate lighting for all chunks we pass over, even if they already have lighting data. Useful for fixing areas with corrupt lighting.
    • /verbose - Print detailed timing info while generating. Doubles the amount of spam the plugin prints!
    • /quitAfter - Shutdown the server once this (and any other pending generations) are complete. See the Using in a Script section below.
    • /onlyWhenEmpty - Only do generating when the server is empty. The plugin will pause generation and wait until players leave, allowing you to generate lots of land without worrying at all about the extra CPU. You can use this in conjunction with /allAtOnce to have the server use 100% when it is empty towards generating land, without causing any lag when players are online.
    • /destroyAndRegenerateArea - As the name says, this will delete and destroy all land in the area given, generating new land instead. I cannot stress enough how this will delete your world (or the specified area of it at least), so please understand what you're doing and make backups!
    Permissions

    Permissions are optional. Server ops and the server console can always use generation commands. However, if you have permissions installed, the following permissions are used:
    • worldgenerationcontrol.generate - Allows user to queue generations. Implicitly grants worldgenerationcontrol.statusupdates.
    • worldgenerationcontrol.statusupdates - Allows user to see generation progress messages. These can be quite spammy, explicitly removing this permission will cause only the server console to see these messages.
    Examples

    /genregion OurBeautifulWorld -50 -50 50 50

    Would generate from -50,-50 to 50,50 in game coordinates. Simple!

    /genregion "Bob and Sam's \"Awesome\" World" -50 -50 50 50

    The same command for world: Bob and Sam's "Awesome" World. Quotes can be placed around world names with spaces, world names with actual quotes in them can be escaped with backlashes.

    /gencircle 1000 /fast /verbose /lighting

    Would generate a 1000 block radius circle around the issuing player, using the /fast speed setting, with verbose output, with lighting!

    /gencircle 1000 MyWorld 100 100 /veryslow

    Would generate a 1000 block radius centered in MyWorld at 100x, 100z, using the veryslow speed setting so as not to cause lag.

    /gencircle 10000 MyWorld 100 100 /allAtOnce /onlyWhenEmpty

    Would generate a HEUG circle centered at MyWorld 100,100 at max possible speed, but pause the generation when players join. Useful if you want your server to use 100% on generating when it would otherwise be idle.

    Notes on Lighting

    By default, minecraft only generates lighting info for a chunk when it is first approached by a player. This is fine, but if you want to generate an external map with something like Minecraft Overviewer, it means the areas players haven't visited will only have 'fast' lighting, with pitch black shadows.
    To fix this, by default, WorldGenerationControl forces new chunks to have lighting info, as if a player were nearby. This shouldn't cause any problems, but takes about 8% more CPU-time. You can skip this step with /lighting:none -- the chunks will still be lit when a player wanders by, so this is only an issue for external tools as mentioned above.
    There is also /lighting:force, which will force-generate lighting for all chunks it passes over (even those already generated and with proper lighting), which is useful for making minecraft recalculate the lighting in areas with glitched shadows.

    Using in a Script

    The /quitAfter option lets this plugin be used as part of a script. For example, some users like to generate maps for a lot of random seeds to share with the community or post on /r/minecraft for delicious karma. Because bukkit/java freaks out when EOF is encountered in input, the proper way to do this would be something like:

    Code:
    echo "gencircle 1000 TestWorld 0 0 /allatonce /quitafter" | cat - /dev/full | java -jar craftbukkit-0.0.1-SNAPSHOT.jar --nojline

    Download
    https://github.com/downloads/Nephyrin/WorldGenerationControl/WorldGenerationControl_v2.6.jar

    Source
    https://github.com/Nephyrin/WorldGenerationControl

    ChangeLog
    • 2.6
      • Updated to work with 1.0.1 / 1.1 builds.
    • 2.5
      • /forceKeepUp now keeps up on garbage collection as well
      • Renamed /forceSave to /forceKeepUp to reflect that it also keeps up on garbage collection.
      • When the server is floating at >80% memory for too long, the plugin will try invoking a GC. This fixes the issue where the default Java GC options would have it float at 80% memory forever as long as nothing forced it to catch up.
      • Cleaned up /verbose output a little.
      • Check if we have <200Megs free in addition to <20% free, prevents out of memory errors on 512Meg ram servers (which this plugin doesn't technically support)
    • 2.4
      • Add /forceSave workaround for 1.9's AsyncChunkLoader silliness.
      • /allAtOnce now implies /forceSave
      • Make the memory limit a little more conservative to ensure we don't hit GC overhead errors on low memory servers
      • Once the memory limit has been hit, wait for ram to decrease below the limit by at least 10% before resuming
      • Tweak the NextTickList bug workaround - instead of flushing the list, just ensure it stays below a threshold. Should fix the minor lag spikes from the fix.
      • Minor optimizations
    • 2.3 - Death to Memory Issues edition
      • Includes a fix for CraftBukkit's poor NextTickList handling, allowing high generation speeds on low memory servers
      • Invokes the GC directly when running close to memory limits to prevent GC Overhead errors
      • Takes a break if memory usage gets unacceptably high to let the server catch up
    • 2.2
      • Lighting now talks directly to CraftBukkit and is now approximately 115 times faster. Yep.
      • Because lighting has gone from taking up 92% of processing time to a trivial amount, the plugin no longer splits lighting/generating/saving into separate steps.
      • Because lighting is now very fast, /lighting is now the default. It can still be disabled with /lighting:none
      • /lighting:extreme is now named /lighting:force, and only eats a little bit more CPU.
      • Added /destroyAndRegenerateArea - which regenerates all chunks in the region. Beware!
      • Removed /lightExisting, lighting is now only done as-needed either way, and /lighting:force can be used to try and fix corrupt light areas.
      • Fixed /gencircle being centered incorrectly when called by a player without coordinates
      • Improved accuracy of some fuzzy math logic to ensure only requested areas are generated
      • Added /onlyWhenEmpty - this causes the plugin to only do its work when the server is empty, pausing and resuming as needed when players join/leave.
      • Minor speed/overhead improvements
    • 2.1
      • Fixed issue with /allAtOnce being too aggressive on lighting, causing memory issues on low-memory servers.
      • allAtOnce mode now returns into the server briefly between ticks, allowing other commands (such as /cancelgen) to be run.
    • 2.0
      • Name changed to WorldGenerationControl from ForceGenChunks
      • Large rewrite
      • Supports Minecraft 1.8's lighting methods
      • Added options: lighting, speed, verbose, quitafter
      • Added permissions support
      • Normal speed is much, much less laggy. Speed options provide control over lag during generation.
      • No longer trusts server to cleanup chunks, manages process through lighting step and cleans up chunks directly. maxLoadedChunks removed as a result, even on high speed settings the plugin will never load more than 1024 chunks into memory.
      • Cleaned up and improved status messages.
      • Use block coordinates instead of chunk coordinates
      • Support queueing multiple generations
      • Better in-plugin API for other plugins to interact with this one.
      • Other things I likely forgot
    • 1.4
      • Added progress % to generating status messages.
    • 1.3
      • Added support for quotes and spaces in worldnames via quotes and escape sequences.
        • To generate for map: Bob's "Wonderful" Funland
        • /forcegen "Bob's \"Wonderful\" Funland" -10 -10 10 10
      • Fixed the "Invalid world name" error message giving the wrong world name for /forcegencircle commands.
      • Separated generation and cleanup phases - plugin now prints a message when generation is complete, and a second message later when cleanup is complete.
      • New generations can be started even if cleanup isn't done, the remaining cleanup will just be merged with the new task's cleanup.
      • Removed warnings about players being in the world, with above changes there is no harm in them being there.
      • Added some colors to plugin messages. Pretty.
      • Plugin messages now show who did what.
      • Tested with recommended builds 1000 and 1060.
    • 1.2
      • Added /forcegencircle
      • Players who use the command now see the progress, not just the 'generation started' message.
      • A few minor text tweaks.
    • 1.1
      • Wait for chunks to unload, instead of assuming our unload requests succeed. Fixes a 'leak' of loaded chunks in large generations, chunks that never unload until a reboot.
      • Add a optional maxLoadedChunks argument to /forcegen, setting this higher reduces the time spent waiting for old chunks to unload, but causes more chunks to reside in ram, increasing memory usage.
      • Added /cancelforcegen, to cancel generation in progress.
    • 1.0
      • Release
     
    mknight14 and MechanID like this.
  2. Offline

    Grrrr159

    Works great :D First!
     
  3. Offline

    p3king

    Haha you could´ve told me that you´re gonna do it better :)
    Now i wasted several hours and my plugin still eats ram like .. :D
     
  4. Offline

    Nephyrin

    Well I wasn't planning to release this, but I spent so much time on it I figured I should. Feel free to steal any ideas/code from it, it is open source!
     
  5. Offline

    timmyderselts

    can u make it so you can do /forcegenchunks <world> <radius>? centered aroung person who types it?
     
  6. Offline

    Nephyrin

    Sure, why not! Added, v1.2 released

    <3
     
  7. Offline

    timmyderselts

    thank :)
    now permissions :p
     
  8. Offline

    Nephyrin

    Updated to 1.3. All versions of this should also work with the new 1060 recommended build.
     
  9. Offline

    p3king

    Well i looked at your plugin and it works much better than mine.
    As im still new to Java and the whole OOP thing i´ll just cancel my plugin and link to yours if you don´t mind ;)
     
  10. Offline

    Nephyrin

    Up to you, I don't mind. You're also welcome to submit patches and such via github, combine our efforts and such!
     
  11. Offline

    Geethebluesky

    May I humbly suggest that the plugin check to see if level saving is enabled before starting generation?Just to eliminate the possibility of someone asking "Well, uhhh, WTF...??!?!?"

    I had just disabled level saving to generate a map pre-ForceGen and launched it--It kept waiting for chunks to unload, but of course they wouldn't. Issuing save-on fixed that immediately without having to stop ForceGen or anything.


    Also, can this generate chunks in the Nether?
     
  12. Offline

    ALufkin24

    I've tried it, but mine keeps saying 'Start Arguement must be in number'. Any help is appreciated. I type in /forcegenchunks x-46.3 z81.6 x-650.7 z12.4
     
  13. Offline

    Nephyrin

    Bluesky - Sure, I'll add that to my list.
    ALufkin - The format is "/forcegenchunks Worldname -46 81 -650 12" You're missing the worldname, and the x's and z's arn't necessary. Also, it can't generate .3 or .6 of a chunk, that doesn't make sense!

    Edit: And yes, this should work fine for nether dimensions

    Bam! Added %progress display. It's so sexy I called it 1.4.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 18, 2016
  14. Offline

    Sorken

    Im looking for a feature where it deletes untouched chunks since i run from a ramdisk. Basically run a hash check on chunk and compare that to what the chunk from seed would be and you have your answer if it has been modified or not.
     
  15. Offline

    Nephyrin

    The problem with this is bukkit has no API for deleting a chunk, meaning it would require a bukkit hack to make it work. In fact, I don't think the minecraft code has any way of deleting a chunk, so it would require some serious mods to the save code. I can take a look, but it seems like a pretty large project.
     
  16. Offline

    Sorken

    I would appreciate it, could even live with an offline tool where you shutdown server, run it, then start it back up
     
  17. Offline

    TelephoneKiosk

    How do I forcegen when my world has 2 words in its name?
     
  18. Offline

    Nephyrin

    Put quotes around it:
    Code:
    /forcegen "My world" -10 -10 10 10
     
  19. Offline

    TelephoneKiosk

    Thanks. Can you add a permission node to allow non-op's to see the progress %?
    EDIT Or make it display a server wide message when it starts/finishes loading the chunks.
     
  20. Offline

    Nephyrin

    I'll see if I can add permissions to 1.5. I could add a 'progress' permission that you could set to default if you wanted everyone to see the progress messages. Right now only the server console and the player who sent the command see them.
     
  21. Offline

    Raptor2213

    I don't think that's possible. if you download ChunkRegenerate, you will see that if you regenerate a chunk, things WILL change. For example, by default, you don't have waterfalls. Those are only activated once the chunk is created, and start flowing from a hole in the wall.

    Try it yourself, stand in a chunk and type /cr repeatedly, you'll see SLIGHT changes every time (usually trees and water).
     
  22. Offline

    Nephyrin

    A smart plugin could compare known-static features (land/dirt shape) and check for manmade blocks, while ignoring differences in trees/water/fire. It could still be possible to get a false-positive (IE a chunk with no changes but someone planted a single tree), but the plugin could also add a protection radius around known-modified chunks and reduce this to a minimum.

    The main issue is adding the APIs to make this possible to bukkit. I suggested an interface in the modders forum but got no response out of EvilSeph. I'm not sure I want to spent the time adding the chunk deletion/compaction APIs to have them turned down :-P
     
  23. Offline

    Raptor2213

    Bug:
    If a player starts a generation request, then logs out, when they log back in, they are no longer given progress reports (though it still shows up in the console).

    If a server is running an addon that causes chunks to persist longer, the mod will spam the console with messages about chunks waiting to unload (roughly once every second or two). I propose that the mod either manualy unloads them (if possible), or waits longer between checks (say 30-60 seconds, possibly a configurable amount). Example mod conflict: PerformanceTweaks (or it's older version).
    (Seeing log files with nothing but this error message gets stupid after a little while)


    Feature Request:
    Queuing - If multiple requests are entered, rather than ignore the second, save it, and do it when the first request is done.
     
  24. Offline

    Nephyrin

    The messages thing will be fixed in 1.5 by the permissions-based messages.

    The waiting for chunks to unload spam was fixed in 1.3, are you using an up-to-date version? What does the spam look like? Is it the "more than X chunks loaded, waiting for some to unload first" error?

    And yeah, I can add queuing fairly easily, i'll see if I can't put it in 1.5 and release that shortly.
     
  25. Offline

    Raptor2213

    I'm using 1.4.

    Like I said, it's due to a slight conflict with the two addons. Performance wants to keep the chunks loaded for longer:
    Show Spoiler
    This causes the chunks not to unload the way ForcegenChunks would on a 'stock' server, and causes the issue.



    Log file excerpt:
    Show Spoiler
    Code:
    2011-08-30 16:45:13 [INFO] [ForcegenChunks] [16.78%] Generating 256 chunk region from [38,-60] to [53,-45], 1531 currently loaded.
    2011-08-30 16:45:14 [INFO] [ForcegenChunks] [17.69%] Generating 256 chunk region from [52,-60] to [67,-45], 1731 currently loaded.
    2011-08-30 16:45:14 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1907), waiting for some to finish unloading
    2011-08-30 16:45:15 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1907), waiting for some to finish unloading
    2011-08-30 16:45:16 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1907), waiting for some to finish unloading
    2011-08-30 16:45:17 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    2011-08-30 16:45:18 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    2011-08-30 16:45:20 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    
    ----------------------more of the same, edited out for space----------------------
    
    2011-08-30 16:49:18 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    2011-08-30 16:49:20 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    2011-08-30 16:49:21 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    2011-08-30 16:49:22 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    2011-08-30 16:49:24 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    2011-08-30 16:49:25 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    2011-08-30 16:49:26 [INFO] [ForcegenChunks] More than 1822 chunks loaded (1898), waiting for some to finish unloading
    2011-08-30 16:49:27 [INFO] [ForcegenChunks] [18.59%] Generating 256 chunk region from [66,-60] to [81,-45], 1764 currently loaded.



    I realize it's not actually a 'problem' with your code, just a minor incompatibility, I figure that it wouldn't be too horribly hard to make it pause for 30-60 seconds when it gets that message.
     
  26. Offline

    Nephyrin

    I can fix it so that that message only prints once/30seconds or so. That would reduce the amount of spam, but the core issue would be unchanged - Force unloading a chunk causes issues with lighting updates, so all the plugin can do is request the chunk be marked for cleanup and wait for it to happen.
     
  27. Offline

    Raptor2213

    P.S. I'm not sure, but I think that it doesn't bother to check to see if a chunk is there already BEFORE generating it, meaning that if you, say, pre-generate a circle of 100, and then 200, it will try to re-generate every chunk it did when you hit 100, as well as the other section.
     
  28. Offline

    pdinklag

    Hey there!

    I like this plugin, and I think one little convenience function could round it up to be perfect: add a command like "forcegenregion", which you pass the region (as opposed to chunk) coordinates to.

    It could automatically calculate the region coordinates and invoke the usual chunk generation mechanism.
     
  29. Offline

    alryaz

    Does it overwrite existing chunks? Answer faster please, before my /forcegencircle 100000 0 0 Civilization 9999999999 runs out :D
     
  30. Offline

    Nephyrin

    alryaz - it does not :-P
     

Share This Page