Create account / Log in

Preventing desynchronization

Topics related to the main Vassal engine.

Moderators: Tim M, uckelman

Preventing desynchronization

Postby Filip » October 23rd, 2016, 10:18 am

I've been thinking about a way to prevent regular desynchronizations some of my players are suffering.

Apparently Vassal detects server connection loss, most of the time at least. I guess I could make it try to automatically reconnect after losing connection, enter the last room and automatically synch on entry. However, that would not prevent those desynchronizations that are not related to server disconnects, which in my experience is most of them.

So one possible solution would be to store the last target of synchronization, ping them whenever the player does something (perhaps through sending an invisible chatter message), and if there's no ping back automatically reconnect, resynchronize, and only then perform the attempted thing.

Not sure if that's even viable in the current framework of Vassal.

It might also prove too complex for my very limited coding skills.

I could use some suggestions on how to approach this, as I have only a very vague idea on how to make Vassal send the ping message, and no idea whatsoever on how to make the other client detect and respond to that ping message with its own.
Filip
 
Posts: 95
Joined: September 11th, 2009, 12:46 am

Re: Preventing desynchronization

Postby uckelman » October 24th, 2016, 1:08 pm

Thus spake Filip:
> I've been thinking about a way to prevent regular desynchronizations
> some of my players are suffering.
>
> Apparently Vassal detects server connection loss, most of the time at
> least. I guess I could make it try to automatically reconnect after
> losing connection, enter the last room and automatically synch on entry.
> However, that would not prevent those desynchronizations that are not
> related to server disconnects, which in my experience is most of them.
>
> So one possible solution would be to store the last target of
> synchronization, ping them whenever the player does something (perhaps
> through sending an invisible chatter message), and if there's no ping
> back automatically reconnect, resynchronize, and only then perform the
> attempted thing.
>
> Not sure if that's even viable in the current framework of Vassal.
>
> It might also prove too complex for my very limited coding skills.
>
> I could use some suggestions on how to approach this, as I have only a
> very vague idea on how to make Vassal send the ping message, and no idea
> whatsoever on how to make the other client detect and respond to that
> ping message with its own.
>

I've never been able to reproduce the problem myself, which suggests
that the culprit is something along the path between our server and
the users having the problem.

--
J.
User avatar
uckelman
Site Admin
 
Posts: 8380
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Preventing desynchronization

Postby Filip » October 24th, 2016, 3:05 pm

We no longer use your server. Also, along the way I made sure there are no legacy vassalengine.org URLs in the code, as they were scattered all over multiple classes, causing some problems with making private servers fully independent from yours.

The problem appears server independent. Whatever was causing those desynchronizations on your public server years ago is still causing it on our private server these days.

It appears to be related to something along the path between any given two players. One thing is sure, the overall connection quality or speed has nothing to do with desynchs. For instance, one of my players suffered from constant disconnects on Teamspeak, for quite a few months, but she never had a single desynch on Vassal. On the other hand, people with very good internet connections get desynched all the time.

Perhaps it's some inherent problem of some Java protocols Vassal is using.

Either way, the problem is a given, and desynchronizations won't disappear. Hence my above idea for solving the issue by implementing desynch detection checks and automatic resynchronizations on desynch.

Any suggestions on how to code that or where to attach the code?

It occured to me that chatter sendToOthers could be used for "pinging" the "hosting player" through a special chat message (I already figured out how to trigger specific things based on the beginning characters of a chat message). I'm still not sure what would be the best place to put the detection code so that it triggers to check the desynchronization just before the player causes any change to the game state. Command.java perhaps? Is it possible to do anything at the table that doesn't go through that one?
Filip
 
Posts: 95
Joined: September 11th, 2009, 12:46 am

Re: Preventing desynchronization

Postby Filip » October 26th, 2016, 1:14 pm

I might be overthinking this. There's already some code related to pinging server in class chat/note/LockWatcher. Also, I'm starting to suspect that delay and timeout settings used by that class might be what's causing the problem, some of the time at least.
Filip
 
Posts: 95
Joined: September 11th, 2009, 12:46 am

Re: Preventing desynchronization

Postby uckelman » November 1st, 2016, 11:56 pm

Thus spake Filip:
> I might be overthinking this. There's already some code related to
> pinging server in class chat/note/LockWatcher. Also, I'm starting to
> suspect that delay and timout settings used by that class might be
> what's causing the problem, some of the time at least.

If you determine what's wrong, please let us know.

--
J.
User avatar
uckelman
Site Admin
 
Posts: 8380
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Preventing desynchronization

Postby Filip » November 7th, 2016, 4:28 pm

Unfortunately, no luck with that so far. I reduced delay and timeout from 30 minute to 30 second cycles and made it ping multiple times before timeout. I was hoping it would have either prevented desynchronization or at the very least disconnect desynchronized people faster to help them notice desynchronization immediately. However, after a few games, no change for the players suffering from this issue. Except now they tell me that their "ghosts" stay in the room much longer than they used to (I'm normally too busy GM-ing the game to closely observe that).

Other than this weird quirk, the reduction of timeout and delay didn't break anything, so I'm leaving it as is for now. I rolled back multiple pings though, as that part involved more coding that I'm confident with.

It might be worth noting that the initial test was very promising, until we moved to my older build just to be sure and it turned out it was just a good day. However the player I tested it with reported having some unrelated internet problems that day, and her provider was obviously changing something. Whatever they were doing, it must have temporarily fixed her desynchs. However, the next time we played her internet was back to normal and she desynchronized with her usual frequency, which is evey 15-30 minutes.

If I could only identify the specific cause of those desynchs, I could at least look for some ways to fix them other than fixing Vassal. And I say "fixing Vassal" because there's clearly something in Vassal's code that makes it prone to those desynchs, while for example TeamSpeak or some multiplayer FPS games I play with the same people don't seem affected by whatever factor causes Vassal desynchs. Well, I probably lack sufficient skills to fix the code anyway.

I might go back to this problem in a year or so, unless I actually move to Vassal 4 or some other app along the way. For now I'm otherwise done with a major update of my "fork" and module, so I call it a day.
Filip
 
Posts: 95
Joined: September 11th, 2009, 12:46 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests