Creating world slowly?

Discussion in 'Plugin Development' started by PlayFriik, Dec 22, 2014.

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

    PlayFriik

    Hello, title says pretty much everything.. How I can make slow world generation? For example - if plugin is enabled then it is slowly making new world.
     
  2. Offline

    mine-care

    @PlayFriik if I understand correctly you want to build a world but slowly enough for users to notice block changes around them, there is a way but it requires a lot of resources and its baaad... The idea is, you load each block through a thread with a loop in it , you use the thread itself to controll time taken for the loop to continue.
     
  3. Offline

    PlayFriik

    Umm.. I want that server is creating a world, but slowly, because if it is using too much CPU then it is lagging and my countdown is lagging too.. So basically when my plugin gets enabled, then it is gonna slowly generate world and it is not causing too much lag.
     
  4. Offline

    Skionz

    @PlayFriik So you want your server to take a long ass time to start up?
     
    Konato_K likes this.
  5. Offline

    97WaterPolo

    @PlayFriik
    Just run the creation of the world off the maim thread. Won't freeze up the server.
     
  6. Offline

    teej107

    You sure about that?
     
  7. Offline

    mythbusterma

    @97WaterPolo

    True, it will only corrupt it to the nether and back. Don't do this, unless you want a broken server, broken plugin, and a broken world.

    This is probably the worst idea I've seen suggested here in a long time, and that is saying something.
     
    AdamQpzm and Funergy like this.
  8. Offline

    _Filip

    @mythbusterma I don't see what's wrong with it? That nether/overworld pattern looks pretty sick...

















    /s
     
    SuperOriginal likes this.
  9. Offline

    PlayFriik

    How I would do this if @97WaterPolo suggestion is bad..?
     
  10. @PlayFriik Technically you'd just note down what changes you'd like to make, and then make them over a period of time... Although you probably don't want to do this. It most likely will not look as good as you're hoping, and would be using too many resources for something that's only mildly interesting to see.
     
  11. Offline

    PlayFriik

    Well, if it helps you then I wanna make ultra hardcore plugin what generates slowly (without lag) the world before it is spreading players to it..
     
  12. @PlayFriik Why does it need to generate it slowly, though?
     
  13. Offline

    PlayFriik

    Because if the server isn't good enough then it probably crash/lagging like hell, so countdown is stuck or going down super slowly.
     
  14. Offline

    nverdier

    EDIT: @PlayFriik if you want @AdamQpzm to see your message than you have to Tahg or quote him!
     
    AdamQpzm likes this.
  15. @PlayFriik That makes more sense. And yeah, to do that what you're going to want is some sort of list of the changes to make, and then it makes a certain number of changes every few ticks or so. Should be a pretty basic theory, but post code snippets if you get stuck.
     
  16. Offline

    PlayFriik

    @nverdier
    Oh, thanks. Didn't know it.

    I thought about it and came to an idea.
    Pretty much - when plugin gets enabled/server gets started, then plugin puts the server to whitelist mode to generate the world. After the world is generated, then it turns whitelist off. But how I would check that when world is generated?

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

    nverdier

    Well by 'generated' do you mean loaded?
     
  18. @PlayFriik If you're going to do it in parts then it'll be whenever you reach the end of the collection of changes you want to make.
     
  19. Offline

    PlayFriik

    Yeah..

    No, I mean it just uses almost all server resources to load the world.
     
  20. Offline

    CraftCreeper6

    @PlayFriik
    Save it after is created; then use WorldSaveEvent.
     
  21. Offline

    nverdier

    And you want to load the entire world before players can get on..
     
  22. Offline

    PlayFriik

    Still, how I would check it..? When it is loaded/generated?

    Again - yeah. Or if not the entrie world, then at least spawnchunks.
     
  23. Offline

    CraftCreeper6

    @PlayFriik
    Should crash until created, code wont carry on until it's done.
     
  24. Offline

    PlayFriik

    Okay, gonna try it and post some information here then.
     
  25. Offline

    CraftCreeper6

  26. Offline

    PlayFriik

  27. Offline

    CraftCreeper6

  28. Offline

    PlayFriik

    I have another simple question: Can I disable World "spawn"? If yes, then how?
    I want to disable this because if I want to delete the world in the end of the game, then it deletes all except spawn chunks/regions..
     
  29. Offline

    CraftCreeper6

    @PlayFriik
    I do not understand?

    EDIT: You can delete a world file by:
    Code:
    File file = new File("Path\To\World", WorldName);
    file.delete();
     
  30. Offline

    PlayFriik

    @CraftCreeper6
    I know how to delete world folder and stuff, but spawn chunk regions are staying there, because these are "loaded".
    So my question is - Is there any way to disable world spawn?
     
Thread Status:
Not open for further replies.

Share This Page