Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
It happens to everyone, with bigger or lesser severity, depending on computer speed.
My guess is that as soon as MCServer generates a chunk, it sends it to the client, but then the fluid simulator takes over and in its first step simulates several thousand blocks, sends those changes to the client and the client freezes because it recalculates lighting for each block change. To confirm this, if you set both water and lava simulators to Noop, the client should cease freezing (but of course you don't get running water, then).
There are principially two solutions to this:
1, Don't send chunks to client until they've had several steps of fluid simulation
2, Generate chunks (at least) one row ahead of clients and siulate them even when they have zero clients.
#1 is quite difficult to code - there's a lot of housekeeping (this chunk has a client, but don't send block updates to it yet, because the chunk itself hasn't been sent yet)
#2 is easier to code, but means that the server will use more RAM (needs 1 more row of chunks around the player) and CPU (chunks that could be unloaded will still be simulated)
Posts: 136
Threads: 4
Joined: Nov 2011
Thanks: 6
Given 17 thank(s) in 13 post(s)
No lag when disabling fluid simulation - so it's definitely it. I think there should be a better solution. How vanilla server deals with that problem?
Posts: 1,469
Threads: 57
Joined: Jul 2012
Thanks: 66
Given 127 thank(s) in 108 post(s)
fluids don't run until they receive a block update, I believe.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
I believe vanilla uses solution #2, but it's hard to say, really, vanilla has quite a different approach to terrain generation and is much less multithreaded than MCS.
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
if you don't have the presimulator enabled they don't run until they receive a update but if you have it enabled it runs once the chunk is generated.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
By rev 1366 I consider abandoned mineshafts generator to be done. There's just two things missing and those are related to missing MCServer features - spawners don't work and don't have a spider in them, but a (default) pig, and loot books have no enchantments. Otherwise the entire thing should be working. It may use some speed-related checkup, still.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
I'm trying to integrate SQLite and LuaSQLite into MCServer, but LuaSQLite doesn't compile for weird reasons. And it's the kind of source written by real madmen, so it's impossible to tell what's going on there. This is gonna take a while.