Can you describe what do you try to fix by loading map by sectors?
What I got is a huge map that require crazy amount of RAM to run it. I'd like to reduce the amount of RAM.
I believe there's two ways to achieve it. Either reduce the size of map (which is a 'no no' for me at the moment) or cut the map into sectors & load map sectors that are needed while leaving in peace sectors that are not needed
The alternative is to get a dedicated server with 256 gb of ram and pay over 9000 onion coins monthly which is also a 'no-no'
You can't save RAM by loading map parts 'when they are needed', how would you know, when they are needed?
I've been thinking to know which parts of the map are needed by the player pos, if player logins at X Y (Z is less important) then the server checks which file contains those coordinates and loads the map sectors.
There'd be either:
-list of sectors with their start/end coordinates
-the sector file names would include the starting X Y<&serv would know how many tiles each sector has so it calculate ending coordinates>
-file name would simply include starting/ending XY coordinates
and then load the needed sector (+2/3 surrounding sectors extra).
When player moves I'd like to avoid checking its pos every tile, so, i'd probably try loading further sectors when player cross the border of one sector to another.
I'd probably want the sectors to remain in RAM for a few minutes even if player leave them so that any people who walks on a sector border right/left back and forth won't cause the server loading new sectors back and forth.
The logging in time possibly would be a second or two longer but this is the price I was keen to pay.
those were just initial ideas that i had in my mind when thinking of the whole thing.
If you already know when they are needed (ex. start of some event by globalevent timer/onThink), you can use
Lua Function - Game.loadMapChunk(path, position, remove) (https://otland.net/threads/game-loadmapchunk-path-position-remove.266137/) to load .otbm with given map part.
Someone already sent this link, I tried to use it but sadly I've encountered a number of issues and gave up.
If you try to load .otbm when server is online, it will freez all players in game. That's why nobody does it.
This is something I didn't think of. Obviously freezing server occasionally is not an option, even if we save some RAM. Just to double-check, wasn't the script that infernum shared work like that? it loads otbm when the server is running and there wasnt people complaining about freezes
Overall, I am very keen to add to my server any other solution that may help reduce the RAM used by the map.
The sector loading may work completely different than i described, as long, as it works and reduces the RAM usage & doesn't freeze the server, or, I could use something completely (I really don't know what else could help with RAM usage, loading map straight from the disc? o.o or perhaps some map compression? no idea)
Been trying to make it work for a while now and, to be perfectly honest with you, im quite desperate so any help will be really, really, much appreciated

People here quite often say 'everything is possible' when it comes to coding/ programming/scripting so I'm sure something can be done here