How I learned to start worrying and hate above-water cities
Posted: Thu Mar 02, 2017 20:55
I've noticed that some server owners and people like to build large cities and even spawns on large seas, it consists of thin layer of block above water with people buildings on it and below. What can go wrong with such innocent and nice idea?
When I played on original "Just Test", spawn and pretty large area around was plagued by slow fps and constant jitter. Back then I was worried but ehh.
After I learned you can enable debug wireframe mode by editing source code I've tried it and start studying various servers, its layout above and underground and how it renders.
I realised something that was quite obvious but often forgotten by everyone: minetest has special algorithm that decides what 16x16x16 areas to render and what not, if something is hidden from view - it is not rendered. You feel comfy at first, algorithm will sort everything out.
Then you go into wireframe mode and realise that algorithm is so inefficient that your lovely water city spawn with 4 buildings is rendered like a fps-eating monster world, you can see deepest parts of the sea with tons of garbage blocks made by people over the years, underwater tunnels, mines, trenches, terrain with cheese-like appearance.
The truth is: you render almost TWO worlds at the same time: city part (above), and sea floor with everything on it (below) and even deeper, you don't see it, yet it is rendered almost fully. That is the reason of abysmally low fps in such water cities. Every day sea floor accumulates more and more stuff, fps gets lower with time, players digging deeper expose more land that renders more etc etc.
How much it affects fps? Depends, if you take "just test"-like water city spawn and turn everything from 0 to -20 to solid stone, you can almost double your fps and remove a lot of server lag due to calculating liquid mechanics.
There's another problem with any big city with tall buildings in general (even on solid ground), LinuxGaming2 is one of the best examples. Algorithm is inefficient and you end up rendering a looooooot of stuff you don't even realise, like part of building behind building behind building. Another example is Vanessa Dreambuilder Survival server - that has nice and huge underground service network just below the roads with pipes and other stuff - everything is rendered, even if you can't see it.
Conclusions:
+ minetest occlusion culling algorithm is not very efficient
+ in water city practically everything below thin floor level down to sea floor is rendered
+ in land city a lot of tunnels and underground floors are rendered, but less aggressively.
+ in city with tall buildings a lot of stuff is rendered behind buildings
+ building city spawn over water is particularly bad idea, if sea floor is unprotected - already low fps degrades with time.
+ building spawn on land can offer much better fps, depending on design, you can achieve good results, say, you can make custom protected spawn with people building outside, you can protect at least underground parts of spawn to avoid overloading it with tunnels and such, you can forbid tall buildings on spawn, sky cities near spawn should be located high to avoid going into range (300 nodes is safe bet), limit number of underground tunnels etc etc
When I played on original "Just Test", spawn and pretty large area around was plagued by slow fps and constant jitter. Back then I was worried but ehh.
After I learned you can enable debug wireframe mode by editing source code I've tried it and start studying various servers, its layout above and underground and how it renders.
I realised something that was quite obvious but often forgotten by everyone: minetest has special algorithm that decides what 16x16x16 areas to render and what not, if something is hidden from view - it is not rendered. You feel comfy at first, algorithm will sort everything out.
Then you go into wireframe mode and realise that algorithm is so inefficient that your lovely water city spawn with 4 buildings is rendered like a fps-eating monster world, you can see deepest parts of the sea with tons of garbage blocks made by people over the years, underwater tunnels, mines, trenches, terrain with cheese-like appearance.
The truth is: you render almost TWO worlds at the same time: city part (above), and sea floor with everything on it (below) and even deeper, you don't see it, yet it is rendered almost fully. That is the reason of abysmally low fps in such water cities. Every day sea floor accumulates more and more stuff, fps gets lower with time, players digging deeper expose more land that renders more etc etc.
How much it affects fps? Depends, if you take "just test"-like water city spawn and turn everything from 0 to -20 to solid stone, you can almost double your fps and remove a lot of server lag due to calculating liquid mechanics.
There's another problem with any big city with tall buildings in general (even on solid ground), LinuxGaming2 is one of the best examples. Algorithm is inefficient and you end up rendering a looooooot of stuff you don't even realise, like part of building behind building behind building. Another example is Vanessa Dreambuilder Survival server - that has nice and huge underground service network just below the roads with pipes and other stuff - everything is rendered, even if you can't see it.
Conclusions:
+ minetest occlusion culling algorithm is not very efficient
+ in water city practically everything below thin floor level down to sea floor is rendered
+ in land city a lot of tunnels and underground floors are rendered, but less aggressively.
+ in city with tall buildings a lot of stuff is rendered behind buildings
+ building city spawn over water is particularly bad idea, if sea floor is unprotected - already low fps degrades with time.
+ building spawn on land can offer much better fps, depending on design, you can achieve good results, say, you can make custom protected spawn with people building outside, you can protect at least underground parts of spawn to avoid overloading it with tunnels and such, you can forbid tall buildings on spawn, sky cities near spawn should be located high to avoid going into range (300 nodes is safe bet), limit number of underground tunnels etc etc