How resource dependent is it to keep chunks loaded?

Discussion in 'Spigot Plugin Development' started by Snowerfo, Jan 6, 2020.

  1. Hey, I’m working on a project that involves a limited size map (2k x 2k), and events can occur that happen across the whole map. One issue is that it only can happen on loaded chunks. Is it out of range for keeping the whole map loaded? How resource intensive would it be.

    TLDR: Would it be possible to keep every chunk in a 2k by 2k map loaded 24/7
     
  2. pretty intensive. wouldnt try it. 15625 chunks loaded at all times

    /e why does the entire map need to be loaded? why cant you choose a location and manually load the surrounding chunks for a time? does the event require modification to the entire map? are you not in control of the plugin?
     
    #2 Warren1001, Jan 6, 2020
    Last edited: Jan 6, 2020
  3. Will consume likely at least 4 GB of Ram just to have those chunks loaded.
     
  4. Would it be possible on a high end machine, I could go down to 1k x 1k
     
  5. To your edit:

    I’ll explain the general concept. Me and my friends are working on a server with more realistic mechanics. Such as accurate day times (to mine and my friends time zone), longer plant growth, and seasons. The idea is maybe it will take many real-time days for the plants to grow, but that will also happen while you are offline. Another idea is we will have natural events, such as a snow storm. Over a few hours, a select part (or the whole map?) may get covered in snow. If this is only for one person online, weird things would happen where the unloaded chunks meet the loaded chunks, or it would entirely skip the area.

    Another idea I had (would be harder to implement) was to try and do all this updating on chunk load, by storing it’s last loaded time stamp. Then based on it, you could accurately guess the crop growth etc, but this would be harder for example to generate all the snow (in the example of the snow storm)
     
  6. theres gotta be a better way. 1kx1k sounds like a lot but once youve played on it for more than a day youll realize how small it is. your second approach sounds better, although some things u could probably emulate better using other methods
     
  7. I’m thinking of going the second route - Could you expand on the ‘emulate better using other methods? I’m thinking of doing this:


    For every chunk, I have an object which you can access through the chunks location (X,Y). This chunk includes some data:

    The chunks most recent time loaded, and lists of other events that have occurred. You can then ‘push’ these changes - By using the onChunkLoad, (working asynchronously), to create a seamless effect. Because my friends have modern pcs, by the time they have got to the chunk (around 12 chunks of running is when it gets loaded), it would’ve completed. If the last time the chunk is loaded is below 5 minutes or so, nothing gets ran.
     
  8. honestly, keeping a timestamp and then doing instant calculations (same limitations, but instantly calculating based on the time) and modifying the world on chunk load is your best bet. you can do this with anything and it will look the same as if it was generated normally provided you maintain the same restrictions.
     
    • Agree Agree x 2