Solved Chunk generator (new)

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Aralwen

Active Member
May 26, 2017
164
14
18
25
Hello ! Following my old subject that @ShaneBee had solved, I made a map generation system. The problem is that it is slow, for example for a 1000x1000 map, it will take 16 minutes to generate itself !

Knowing that a chunk is 16x16, how to do better?


Here is my code

code_language.skript:
on load:
    set {Game.LoadingWorld} to now
    set {_x} to 0
    set {_y} to 130
    set {_z} to 0
    set {_loc} to location({_x}, {_y}, {_z}, world("world"))
    load chunk chunk at location of {_loc}
   
    loop 1000 times:
        set {_x} to {_x} + 1
        set {_y} to 130
        set {_z} to {_z} + 1
        load chunk chunk at location of {_loc}
       
        set {_x} to {_x} / -1
        set {_y} to 130
        set {_z} to {_z} / -1
       
        set {_x} to {_x} + 2
        set {_z} to {_z} + 2
        load chunk chunk at location of {_loc}
       
        add 1 to {_limit}
        if {_limit} is 100:
            wait 5 seconds
    delete {Game.LoadingWorld}
   
on connect:
    if {Game.LoadingWorld} is set:
        kick player due to "&cThe map is being generated! Come back later"

Old topic: https://forums.skunity.com/threads/chunk-generator.7906/#post-34203
 
You can't really go too fast. For example, I have used the plugin WorldBorder... and it has a fill command. When it fills a map of about 6k x 6k ... it took at least an hour. You have to remember that each chunk is a MINIMUM of about 15,616 blocks (16 x 16 x 61)... now a map of about 1k x 1k is going to have a minimum of about 61,000,000 blocks. That is a LOT of work for your server to generate all those blocks.
That being said, 1k x 1k taking 16 minutes is pretty good.
 
You can't really go too fast. For example, I have used the plugin WorldBorder... and it has a fill command. When it fills a map of about 6k x 6k ... it took at least an hour. You have to remember that each chunk is a MINIMUM of about 15,616 blocks (16 x 16 x 61)... now a map of about 1k x 1k is going to have a minimum of about 61,000,000 blocks. That is a LOT of work for your server to generate all those blocks.
That being said, 1k x 1k taking 16 minutes is pretty good.
Yet on game servers, they generate their world in 2 minutes :emoji_frowning:
 
It is possible to do this with Skript ?
Probably, depending on what you're using right now. Are you just using new world on the same server or are you creating one server per game?
 
Probably, depending on what you're using right now. Are you just using new world on the same server or are you creating one server per game?
I use the same world. Whatever the system, I just want the world to be already loaded
 
Clearly, I want me to open my server with the map "world", that all chunks will be loaded
Well since you're talking about loading chunks now and not generating them, there isn't much you can do about that. If I were you I wouldn't even be loading every chunk at the same time, it's not necessary for anything. It's probably better for your server's performance that you don't load them all at the same time but only when they come within a player's render distance.
 
Well since you're talking about loading chunks now and not generating them, there isn't much you can do about that. If I were you I wouldn't even be loading every chunk at the same time, it's not necessary for anything. It's probably better for your server's performance that you don't load them all at the same time but only when they come within a player's render distance.
Okay, thanks for all your help. Have a good day :emoji_slight_smile:
 
Status
Not open for further replies.