Generate world without freeze

Discussion in 'Plugin Development' started by nubebuster, Sep 23, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    nubebuster

    When I generate a new world, the server freezes untill the spawn chunks of the new world are generated. How do I prevent the server from freezing?

    Here's the code I use if you wonder:
    Code:java
    1. WorldCreator c = new WorldCreator("worlds/" + worldName);
    2. c.environment(Environment.NORMAL);
    3. world = c.createWorld();
    4. world.setAutoSave(false);
    5. world.setDifficulty(Difficulty.HARD);
    6. world.setSpawnLocation(0, 80, 0);
    7. generateChunks(world);


    The generate chunks method does not cause the problem. Infact the server stops freezing once it reaches the generateChunks method.
     
  2. Offline

    Lorinthio

    Generating a world is relatively heavy on cpu regardless of how you create it. Thats why servers can take around 30 seconds just to setup world/nether/end. Unless you boost your server performance the issue will likely persist.

    The only other thing I can think of is running it in an async task (not recommended), its a possible option but not one i'd recommend. If you figure out anything let me know, i'd like to make an Rpg procedural world generator =)
     
  3. Offline

    teej107

    Lorinthio You can't generate a world asynchronously. You could copy the world folder contents async but it still isn't that simple.
     
    nubebuster likes this.
  4. Offline

    Lorinthio

    Thats what i figured =) but even then doesnt seem like there's many options for this
     
  5. Offline

    nubebuster

    teej107 Lorinthio I've already tried all of those options. I'll sleep and I might find a solution.
     
  6. Offline

    Lorinthio

    Don't really want to mention it but... NMS? But that probably wouldnt increase performance/creation speeds
     
Thread Status:
Not open for further replies.

Share This Page