by Karl G. » Thu Sep 25, 2008 7:36 pm
So I did some more code profiling and found the source of a "jitter". I'm using this term instead of "lag" here because lag to me means a delay during which changes you make on the client aren't reflected on the server--the client is running fine (characters animating and whatnot), but nothing changing/responding. A "jitter" however is a complete client-side lock up for a short amount of time while something happens. I've found the latter.
The problem is when the client loads a new section of the map. When loading the map, the client builds up the geometry for that section and makes a lot of allocations--I found that loading a new segment took around 0.16 seconds, or the equivalent of ~10 frames of rendering--which is very noticeable! Compound that with the fact that everything on screen will "jump" during this time, that makes for quite a jolt. I'm working on "sliding" in new sections of the map little-by-little so that it doesn't have such a drastic effect.
That said, the responsiveness problem you're having (and I've encountered, though very rarely) seems also to be client-side. I think it has to do with the input subsystem choking during a jitter. A whole bunch of messages flood in (a normal app can get a few hundred every second if the mouse is moving) and a buffer somewhere fills up, then starts just dropping new input instead of handling it. I'm thinking that switching to a different kind of input processing will fix this, but that's a challenge for later.
The jist is, there's a way to tell what the error is--but I have to get the error to happen first and as I mentioned, it rarely ever happens on my system. So when 1.10 comes out, remind me to describe to you how to find it.