Question Prevent chunk generation?

Abcik

New member
Jan 4, 2022
3
0
1
Hey! I want to prevent all chunks generations around a specific area (e.g. 7x7 chunks in the center of the world). I want only 49 active chunks per world instead of 361 or something like that.
In simple terms, I want only central chunks to work, and everything outside is never created, stored in memory or on disk, sent to the players, and use processor resources.

I need it because I want to allocate a world per player, but i faced with excess waste of RAM, disk space and processor usage because of unnecessary chunks.

Attention! I know about void chunks, but they still stored in RAM and disk, and they perceptibly load the processor. (Considering this could have been avoided this is becoming a serious problem. Especially with ~300 worlds (100 players with each dimension))

 

Subscribe

New member
Jan 4, 2022
1
0
1
Unfortunately there is not an ideal way of dealing with this in a plugin. Using void chunks will get you very close though, and another feasible option would be to scale your setup across multiple servers.
 

FivePB

Velocity Developer
Staff member
Dec 17, 2021
3
0
1
fivepb.me
I have another idea, use a world border, have the chunks outside generate, but don’t tick them. Make use of the new Simulation distance to prevent things outside the world border from being used by the server, that should stop load outside the designated area.
 

electronicboy

Administrator
Staff member
Dec 11, 2021
225
10
38
28
such is how the game works, and changing that would basically require deep modifications towards the server to basically share empty chunks or something, this is basically not something which is feasible; you could modify the server with various things to try to limit what all happens there, e.g. have "empty" chunks which are actually empty and just forcefully return air blocks for all lookups, etc, but, this is defo far from as trivial as you're hoping

You probably wanna look into slime world manager for some aspects
 

Override

New member
Jan 4, 2022
1
0
1
I don’t think void chunks will have that much impact on your server if your chunk generator just generates those outside the specified chunk radius, unless you have measurable statistics that show this particular thing as lagging I wouldn’t worry about it too much
 

Abcik

New member
Jan 4, 2022
3
0
1
Unfortunately there is not an ideal way of dealing with this in a plugin. Using void chunks will get you very close though, and another feasible option would be to scale your setup across multiple servers.
Yes, void chunks do not tick, and the gameruleRandomTickSpeed does not affect them, but they still take a lot of CPU time, RAM and disk space.

I have another idea, use a world border, have the chunks outside generate, but don’t tick them. Make use of the new Simulation distance to prevent things outside the world border from being used by the server, that should stop load outside the designated area.
It also doesn't solve the problem. It will be the same as if these chunks were just void. (Dont tick, but use CPU resources)

such is how the game works, and changing that would basically require deep modifications towards the server to basically share empty chunks or something, this is basically not something which is feasible; you could modify the server with various things to try to limit what all happens there, e.g. have "empty" chunks which are actually empty and just forcefully return air blocks for all lookups, etc, but, this is defo far from as trivial as you're hoping

You probably wanna look into slime world manager for some aspects
I have achieved some results making changes to "runAllUpdates" method in the ChunkMapDistance class, this prevents chunks from loading, storing and ticking. But the problem remains - when a player gets into an unloaded chunk, he got kicked.
It is a pity that there is no such setting by default in paper. This could greatly help save resources and improve performance in some situations.
Although the strange "all-chunks-are-slime-chunks" there is lol...

I don’t think void chunks will have that much impact on your server if your chunk generator just generates those outside the specified chunk radius, unless you have measurable statistics that show this particular thing as lagging I wouldn’t worry about it too much
A bit of math:
(according to my calculations on my processor 1 void chunk takes ~0,000183 ms of processor time per second.)
300 worlds * 360 chunks * 0,000183ms = 19.76ms (yeah, it still 20tps, but I only have 30ms left to all gameplay.)
Compare this with what it would be if there were no extra chunks:
49 chunks * 300 worlds * 0,000183ms = 2.69ms as for me the difference is palpable. And I have not yet touched on the use of disk space and RAM...

And this is if we talk about the example of 7x7 chunks, which I gave in the topic. But what if I want 11x11 chunks?
(Don't worry, I already figured it out for you. Results is 40.02ms vs 6.64ms)
 
Last edited:
D

Deleted member 94

Guest
Unfortunately I think the best fix for this will be to use custom paper fork which is very easy to make. There is no good way to expose something such as this for plugins to use and I do not think PaperMC will ever do this. It would be serious hell
 

Abcik

New member
Jan 4, 2022
3
0
1
Unfortunately I think the best fix for this will be to use custom paper fork which is very easy to make. There is no good way to expose something such as this for plugins to use and I do not think PaperMC will ever do this. It would be serious hell
Yes, you are completely right, but it is not that easy to fork. Im not much good at minecraft server code, plus there are many asynchronous methods from paper overlaid, which confuse me even more. I'm still looking for what I should change to get what I want as easy as possible.
 

electronicboy

Administrator
Staff member
Dec 11, 2021
225
10
38
28
There is a massive difference between a config option which makes all chunks slime chunks, and a config option which idfk how it would be a config option which would require mangling the chunk system and many things which interacts with it.