How to generate new worlds for minigame without lag?

Discussion in 'Plugin Development' started by Banjer_HD, Nov 14, 2019.

Thread Status:
Not open for further replies.
  1. Hey there,

    I want to create freshly generated worlds for a minigame(Needs to be a new seed everytime).
    I tried it with Bukkit.createWorld(new WorldCreator("WORLDNAME")); but that makes the server freeze for 10 - 20 seconds.
    A new world needs te be generated quite often because it is a minigame so I don't think generating worlds when the server starts would work because I don't know how many worlds I need.
    What is the best way to achieve this?

    Thanks for helping!

    EDIT: It should also be possible to have multiple maps at once
     
    Last edited: Nov 14, 2019
  2. Offline

    CraftCreeper6

    @Banjer_HD
    You could always reset the map using iteration rather than resetting the world each time.

    You can set it up so that it will detect for blocks that have changed, and reset them back to their original block, and also have a small delay between each block change to prevent lag.

    This has a quadratic time complexity though so with larger maps it could be that resetting the world would be quicker, but this method will almost* never crash.

    * Depending on the size of the map and how you implement the detection/changing.

    EDIT: Further read your post and see that it says you need a new seed every time. I think there are ways to chunk generate from a new seed which would still be better than resetting the world each time, but I'm not sure how you would do it for 1, and for 2 the map would have to be of fixed size.
     
Thread Status:
Not open for further replies.

Share This Page