Loading Large Arenas

Discussion in 'Plugin Development' started by Mysticate, Mar 14, 2015.

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

    Mysticate

    For a minigame plugin where there would be multiple maps per game, what would be the best method of loading said maps? Should I have each map in a seperate world, then load all the worlds on start? That seems very intensive and unnecessary to me. I could save each map in a schematic and paste them when the game comes to that map. The issue would be that if the map is big, it might cause lag.

    I'm not really sure what to do, and any help would be appreciated. Thanks!
     
  2. Offline

    ResultStatic

    @Mysticate actually i found the perfect fix for the server i code for but it uses a lot of code and nms. basically you have a world folder for each arena but none of the worlds loaded. then when a world is needed it loads it from the folder and changes the name, but it doesnt load any chunks or create any files for the new world but it loads the same block data as the normal world would. i tested it and loaded 1000 copies of the same world in less than a second. and when ever you enter that world it loads chunks just like a normal world would. and it only used about 200 mb of ram obviously if you loaded chunks on the worlds the ram would increase. o also you need to disable saving on the hacked worlds or else you get errors from multiple save points. basically i extend WorldServer nms class and do some hacky stuff to change the name but keep the same region folder. it works perfectly loading worlds on the spot with 120 players on the server
     
  3. Offline

    Mysticate

    How do you go about that?
     
  4. Offline

    ResultStatic

    @Mysticate you will need to look at the source nms code to help you, but i extend WorldServer remove the world that it creates from the world collection in CraftServer then you add it back with the new name.
     
    Last edited: Mar 14, 2015
  5. Offline

    Mysticate

    Do you have any code to get me started? That isn't much to go on.
     
  6. Offline

    Zombie_Striker

    I don't know about the method that ResultStatic is using, but the way I would do this is by having a plugin that adds the capability of creating new worlds (like Multiworld), than either creating a file in the dataFile and saving the arenas there, or just create the map in one world so that you can copy it and bring it to the other world.

    Also, if you looking for code handouts, you came to the wrong place.
     
  7. Offline

    Konato_K

    @Mysticate Creating new worlds it's way less intensive than pasting schematics, it uses slightly more memory, but that shouldn't be a problem, just remember to unload the worlds once you're done using them.

    Look at the WorldCreator class
     
  8. Offline

    ResultStatic

    @Mysticate decompile bukkit, then look at the nms World class, the CraftServer class and the CraftWorld class.
     
Thread Status:
Not open for further replies.

Share This Page