The International Simutrans Forum

 

Author Topic: Desyncs when the client runs ahead of the server  (Read 1353 times)

0 Members and 1 Guest are viewing this topic.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20917
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Desyncs when the client runs ahead of the server
« on: January 22, 2012, 11:55:38 PM »
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:

Code: [Select]
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?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10819
  • Languages: De,EN,JP
Re: Desyncs when the client runs ahead of the server
« Reply #1 on: January 23, 2012, 12:06:17 AM »
Normal causes (and also most possible ones): Server too slow or very varying ping times or timer troubles.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20917
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Desyncs when the client runs ahead of the server
« Reply #2 on: January 23, 2012, 12:39:44 AM »
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.