Re: Breaking matchmaking deadlocks
James Robertson <[email protected]> Fri, 09 Jul 2010 09:38:25 +0200
| Newsgroups | gmane.games.devel.sweng |
|---|---|
| Message-ID | <[email protected]> |
Yes, pretty much any meaningless number can be used. The reason I suggested using a timestamp is so that the player who started attempting to connect first would be the one more likely to succeed. Which isn't a huge deal in the grand scheme of things, but does appeal to my own personal (and slightly warped) sense of order.
Blair Holloway wrote:
> Having thought about it, each user *does* have a unique ID akin to a MAC
> address. Perhaps all we need to break the deadlock is something like:
>
> bool shouldAcceptIncomingConnectionFrom(USERID fromUser) {
> if (NotAttemptingConnectionTo(fromUser))
> return true;
> else if (this->localUserId < fromUser)
> return true;
> else
> return false;
> }
>
> I do worry about the implications of relying on a user's id, though -- I
> sense it is one of those things that, handled incorrectly, could
> generate one of those reproducible-once-in-a-thousand-times bugs. :/
>
> - Blair
>
> On Thu, Jul 8, 2010 at 8:45 PM, Peter Thierolf <[email protected]
> <mailto:[email protected]>> wrote:
>
> Why not use the MAC address ? That is supposed to be unique anyway...
>
> Am 08.07.2010 12:26, schrieb Philip Taylor:
>
> On Thu, Jul 8, 2010 at 10:41 AM, James
> Robertson<[email protected] <mailto:[email protected]>> wrote:
>
>
> All you're looking for is
> a way to reject one connection and keep the other, with a
> fallback for the
> (extremely) rare instances that both times are identical.
> The timestamps
> could be years apart and the mechanism would still give the
> required result.
>
>
> If you just want a meaningless number with minimal chances of a
> collision, timestamps sound like one of the worst possible choices -
> people put a lot of effort into making clocks accurate and
> synchronised, but you'll get more collisions as they get more
> accurate. And once you get one collision, it's much more likely that
> you'll get another collision when you try again a little later. An
> n-bit random ID (seeded by more than just the timestamp) would
> have a
> much lower chance of collision than an n-bit timestamp.
>
>
>
>
> _______________________________________________
> Sweng-Gamedev mailing list
> [email protected]
> <mailto:[email protected]>
> http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Sweng-Gamedev mailing list
> [email protected]
> http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
_______________________________________________
Sweng-Gamedev mailing list
[email protected]
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com