Selective Chunk Regeneration

Discussion in 'Archived: Plugin Requests' started by greg2725d, Jul 27, 2013.

  1. Offline

    greg2725d

    I've been searching for a plugin or even application that will selectively regenerate chunks that have not been modified from the original seed or doesn't contain man-made items (found one that was supposed to do just that but I believe it was outdated). On my server people like to walk around for a few hours making the map kind of large (I've got about 1.5 GB of map files). When minecraft updates with new blocks, we have to travel quite far for them. This search really started when quartz came out. We don't want to regenerate the entire nether, only the chunks where our transport system isn't located. I would like to have something that could be used in the over world too.
     
  2. Offline

    xxMOxMOxx

    Personally I'm not experienced enough to code this but I have a suggestion for whoever does:
    1. Each time a chunk is loaded, check the chunk file and get the time-stamp it was created
    2. Compare this to the time-stamp when that file was modified
    3. If they are the same, use the Chunk.regenerateChunk(x, z) command
     
  3. Offline

    Skye

    This is actually a good plugin idea. There have been programs in the past that could be used to scan through map data for player structures and delete undeveloped chunks, but nothing on the plugin end that would endure across Minecraft versions. I'll start working on something lightweight. :)

    Edit: However, the implementation I have in mind would work best if the plugin was running from the beginning. I could write it to scan for unnatural blocks, but because so much of the newer structures in Minecraft use these blocks, it'd be hard to write something that would accurately catch every player-made structure. Instead, with my design, you'd have to give players time to produce some block activity and then delete chunks with no activity logged since a given date.
     
  4. Offline

    greg2725d

    Awesome! Thank you so much! :)
     
  5. Offline

    Me4502

    Best way to do this:

    Store lists of last time a chunk was checked, only check once every few days.
    When a chunk loads, check it. But make a snapshot of the chunk and check it Asynchronously to avoid lag.
    If it returns as unused... Add that chunk to a list to remove on chunk unload.. OR server shutdown.
     
  6. Offline

    Skye

    The way I'm approaching this is by having the plugin monitor and record significant block changes to work out which chunks are populated. However, as seen in this terrible quality video, I worked out a good active scanner on chunk load with minimal resource hit. As chunk data is recorded, users will be able to rescan all chunks that have been accessed since the plugin was installed, with the ability to define what they believe to be significant.

    I've got a pretty good idea how I'll work out the automatic/manual regeneration next. I don't have much time to work on this, but I think I'll have something rough that works within a few days.
     
  7. Offline

    greg2725d

    Skye, were you able to get anything functioning? Now that there's a beta of 1.6.2 we could really use it. :)
     
  8. Offline

    BooGaLoo90

    greg2725d you can also just world edit.

    use //wand to select the area (can be large than a chunk =D)
    type //expand vert to expand from sky to bedrock, this helps so when you select a region, you only have to worry about the perimeter.
    then, type //regen and it will regenerate the selected area. based on your server RAM, you will have to limit the size of each regeneration. if you have a lot of RAM, you can regenerate more at one time.
     
  9. Offline

    greg2725d

    Oh I've used that command before. Crashed my server many times as well. Unfortunately that's not quite what I'm looking for. I need something that's smarter than me. it would take me months to select only the untouched portions of my map and regenerate them. Plus I would end up hitting underground caves or mines that my users dug or explored without realizing. Need a one click solution to go through my whole map and regenerate unmodified chunks.
     
  10. Offline

    timtower Administrator Administrator Moderator

    Easier for you, harder for developers, this would require some logging methods, only requires 1 line of storage per chunk though, but it is impossible to use it right away on the already made world
     
  11. Offline

    greg2725d

    Wasn't saying it would be easy. And basically it wouldn't happen any other way. There's just too much map with unseen structures to do it cleanly. Now when you say impassible on an already made world, there's no way to scan chunks for certain blocks? I'm no java/minecraft expert so forgive me if I'm wrong but i have done some programming and as long as you can figure out the items in a chunk you should be able to build that index?
     
  12. Offline

    timtower Administrator Administrator Moderator

    It is possible, but your server won't like it at all, maybe it could work when something would run for a week. That would check every chunk that a player walks into, if there are certain blocks then make sure to not regenerate it.
    This would give weird effects with abandoned mineshafts though
     
  13. Offline

    HammerHedd

    Just wanted to bump this thread, as a lot of us with tons of 1.6.4 land will probably want to regen it into 1.7.2 land.

    I would be fine with a plugin that works in the background for a week or so. Is anyone still working on/ considering this?
     
  14. Offline

    BillyGalbreath

    I take it you guys havent been around long enough to see what happens to a world when the generation code changes. You get hard edges. Ugly ones.

    So, lets say you have 100 chunks of land. You've build on about 25 of them, scattered through out the area. We could definitely make a plugin to detect untouched chunks and regenerate them. However, what youre going to end up with is something worse than what you could ever imagine.

    [​IMG]

    Not one giant wall like you see there. No. This is a screenshot from the transition from 1.2.4 to 1.2.5 when they changed the generation code. This is at the edge of someone's world that they never explored before on the old 1.2.4 but are now going into it on the 1.2.5 causing it to generate the new land.

    With what you want you're going to see them at every chunk intersection of old chunk and new chunk, which you just cause a lot of them to appear using a plugin.

    This plugin is a bad idea, and will cause more problems than it would ever fix.
     
  15. Offline

    greg2725d

    I agree. For major changes like from 1.6 to 1.7 this probably wouldn't work. Which is why we've already started a new seed for 1.7. Mainly because we didn't want to run forever to see all the new biomes.

    For smaller additions however, I think it would still work. If the addition is only the introduction of a few new blocks and not the change of the generation code, I think this would be useful. Not for "the update that changed the world".

    I'm not looking for a cure for ever having to start with a clean map. I've accepted that. But I don't want to have to start fresh every time we get new blocks.
     
  16. Offline

    Skye

    Sorry for the late update! I wanted to provide a way to regenerate chunks as they are loaded—without a huge hit to server performance from scanning every time a chunk is loaded, or disk space from logging every block change. As I slept on ways to do this, I kind of forgot about it. :(

    I've settled on block counting as the plugin loads chunks for the first time, and updating counts for almost every block change. The counts are mostly accurate... but between Bukkit bugs and other plugins that may make block changes, it's impossible to get a completely accurate count in certain situations.

    Some of the parameters I have in mind for regenerating are:
    • Date chunks were last accessed
    • Date chunks were last modified
    • Sum of blocks in block type whitelist
    • Block count thresholds
    • Manual flagging
    • Radius
    Good configurable parameters is the hardest part at the moment, so any suggestions would be very helpful... making it happen is the easy part.

    While the plugin could be used for huge changes in the way chunks are generated, the real intent is to provide a way to regenerate chunks for the following:
    • Minor generation changes that introduce new resources
    • Exhaustion of resources
    • Chunks that have been developed but are no longer being visited and/or further developed
     
  17. Offline

    dunbaratu

    Has any progress been made on this? I actually like the "cliff wall" effect you get when making the new terrain next to the old, as the in-game plot explanation will be that there has been a magical cataclysm. But my main motivation is to generate 1.7.4 terrain in an existing 1.6.4 world in all the wilderness places that don't contain player structures.
     
  18. Offline

    HammerHedd

    I found this https://code.google.com/p/minecraft-chunk-deleter/

    Unfortunately, it is written for the older save file .mcr. I'm no coder, but it looks like the src is all in the directory. Would just changing the code to look for ".mca"s make it work? Dunno.... Hopefully someone with more chunk knowledge can answer that question ...
     
  19. Offline

    EvilWitchdoctor

    I think this plugin might not be such a bad idea... cliff walls are unlikely unless a major amount of generation code is modified (and even if that happened, it would still work for superflat worlds, which I have seen get out of proportion just as badly).
    I would really like anyone who feels interested to continue developing this plugin, it could really help me in conserving some of my server's space.
    thanks a ton for any help with this ;)
     
  20. Offline

    ThePassingStar

    Gotta love that necro. I want to bring to the table the following:

    A plugin... that would generate chunks... that overwrite current chunks.

    See, I have a server that is basically a flat world made of sand, which I then made the sand fall into the Void. So now, I'm looking at a world completely and utterly empty. Then, I made a large cube-shaped area of stone. It's basically a big empty stone box.

    Here's the kicker. I want... a plugin... that will fill that big empty stone box... with a variety of landscapes.

    Rivers, deserts, jungles, plains, forests, mesa, beaches, hills and valleys, everything Minecraft has to offer as far as biomes go. Will anyone help me in my request?

    Oh, and Tim, don't yell at me honey <3
     
  21. Offline

    timtower Administrator Administrator Moderator

  22. Offline

    ThePassingStar

    timtower It does not generate the classical chunks that I want, it in fact only removes everything in that chunk. It may be because the world I am using is a flat world type with air as the only blocks (basically skylands), and the only biome is plains. Thus, when I do //regen to an area, it wipes everything in that area and replaces it with nothing.

    I want to be able to generate chunks of various landscapes that overwrite current chunks (which may or may not involve changing the chunk biome), and then shave off the tops of those with world edit, to place elsewhere. I don't care about the ores or the majority of the chunk, just the landscapes as they appear from above.
     
  23. Offline

    timtower Administrator Administrator Moderator

    ThePassingStar New world with default generator, select all, //copy, go to other world, //paste
    Can't regenerate with a different generator as far as I know
     
  24. Offline

    ThePassingStar

    Additionally, //setbiome, results in absolutely nothing as well. :( I am a sad astronaut.

    Edit: Just got your new post, I'll try it.

    Thinking about it, I would very much not like to do the multi-world thing. Would it be possible to change the nether or end into a normal world, or wipe them and replace them with overworlds, and then draw from them into my main overworld?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  25. Offline

    timtower Administrator Administrator Moderator

  26. Offline

    sleepercave

    I'm no expert on programing but maybe a separate program where you download your map and it goes through and removes any chunk that hasn't been modified by the player and I know worldedit can regen an area to be like a player was never there so maybe the program checks the data that world edit regens from and if it matches the data for how the chunk is now it deletes the chunk. then you upload the new and smaller map file to your server. of course I don't know if a regen would use new generation data after minecraft updates so this may cause issues where it thinks all chunks are used but you simply clean the map before updating to avoid this.
     
  27. Offline

    Skye

    The biggest thing that has kept me from continuing work on this plugin is a lack of non-deprecated methods post 1.7. It didn't seem like there would be much need for this plugin in the imminent future, so I've been waiting to write something that wouldn't require regular updates.

    The most effective and easiest way to do this is to hook a logging plugin like LogBlock, but I don't want to write a plugin with heavy dependencies.
     
  28. Offline

    krisdestruction

    I think you should store the chunk UUID into a HashMap<Chunk,Date> and use your last modified idea to do this. Saving the data isn't to hard either as you can store this HashMap into a config/data file. The problem is identifying if the chunk is actually a mined out area or just a very old build that people still use but don't modify (eg. spawn). I was already thinking of creating a plugin like this but I'm missing that last piece of the puzzle.

    You can use this function to regenerate the chunk in question:
    http://jd.bukkit.org/rb/apidocs/org/bukkit/World.html#regenerateChunk(int, int)

    I've thought of a few solutions including scanning for certain blocks or integrating it with GriefPrevention/WorldGuard. Both these situations aren't deterministic especially the GP/WG one since not everyone makes claims/regions.
     

Share This Page