from Hacker News

How we solved an infamous sliding bug

by exch on 4/5/14, 6:31 PM with 22 comments

  • by tetrep on 4/5/14, 8:39 PM

    Problem: Lag + collision detection = characters slide. Solution: Turn off collision detection.

    I was sincerely hoping for an actual technical solution for dealing with peer-to-peer networking and lag. I feel somewhat cheated out of the time it took me to read that article. While it did explain the problem very nicely, the solution was to just disable the feature outright.

  • by sigvef on 4/5/14, 7:43 PM

    How do you stop clients from cheating in a peer-to-peer game like Awesomenauts?
  • by m_mueller on 4/6/14, 10:33 AM

    This is the first time (as a non game-dev) I'm reading about a P2P game where each peer computes only part of the world. That's quite clever, especially for an indie developer who'd be hurt more by spending lots of money on server resources. It should be possible to build quite massive multiplayer worlds this way. Has this ever been attempted, say, in a WoW or Eve type game? I imagine that for massive battles, each peer could serve as a proxy for all the data it has received already, such that only one connection to another peer is needed to see the whole thing - similar to how bit torrent works. Lag could become a larger problem there of course, so it probably only lends itself to a slower paced gameplay where players don't target each other using a visor - but it should work for a WoW style combat system, no?
  • by kevingadd on 4/5/14, 8:53 PM

    It seems like this solution implicitly acknowledges (and fails to resolve) the fact that their game has frequent, pervasive desyncs. The bug being described is only possible when in a state of persistent desync - that's a little scary in a competitive or semi-competitive game (like most games in the 'MOBA' genre are, including Awesomenauts).

    I wonder what their reasons were for going with peer-to-peer instead of anointing a player as the 'server' as many other console multiplayer games do (Awesomenauts started out on console, IIRC)? That would solve a lot of these desync problems because the server would be responsible for resolving all the collisions.

  • by jbert on 4/5/14, 10:55 PM

    Would it work to have a different response to collision, namely to apply a reverse of your last step? (A full reverse or partial).

    There might still be corner cases, but it would seem to resolve the described issue, since irrespective of where you think the other player is, if you both reverse your motion you should disengage.

    I can see 3-body problems being more problematic, but that's probably also the case with the original code.

  • by eridius on 4/5/14, 8:39 PM

    How does the player with the lower objectID detect that the sliding bug is happening? The way it was described, only the player with the higher objectID would be able to figure that out. Did they change it so both players sends the message? Or does the player with the higher objectID simply send a message when they detect the bug, meaning they turn off their collision first? Or something else entirely?
  • by scottfr on 4/6/14, 2:50 AM

    Could you resolve the issue by introducing an element of stochasticity into the distance players are displaced to avoid collisions?

    That way, one player would move right (or left) more than the other player and the collision would still resolve itself.