News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Desyncs when the client runs ahead of the server

Started by jamespetts, January 22, 2012, 11:55:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

In my Simutrans-Experimental server, I have noticed that there seem to be fairly frequent desyncs, especially, but not only, when players interact with the world. To check the cause, I used a debugger to check where the calls to disconnect were coming from: all of them that I found (and there were several) came from this part of the code in network_cmd_ingame.cc:


if (get_sync_step() < welt->get_sync_steps()) {
        if (!ignore_old_events()) {
            dbg->warning("network_world_command_t::execute", "wanted to execute(%d) in the past", get_id());
            welt->network_disconnect();


get_sync_step() was usually 1, sometimes 2, less than welt->get_sync_steps().

I think that I am right in deducing that this method will kick a client that has run ahead of the server. Am I further right in gathering that the server_frames_ahead and additional_client_frames_behind parameters in simuconf.tab are intended to prevent this, but possibly at the cost of command execution delay, and that increasing these numbers can reduce this type of desync? Does the server_frames_between_checks parameter make any difference here?

May I ask - what is the normal cause of the client running ahead of the server?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

Normal causes (and also most possible ones): Server too slow or very varying ping times or timer troubles.

jamespetts

Hmm, thank you - somewhat difficult to counter any of those directly. I have found, however, that setting additional_client_frames_behind to a higher number seems to help quite a bit.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.