Search Unity

Peer-to-peer clarification

Discussion in 'Multiplayer' started by Staples, Dec 5, 2012.

  1. Staples

    Staples

    Joined:
    Jan 14, 2009
    Posts:
    224
    (I know Unity doesn't support peer-to-peer, but..)

    I'm a bit confused about how peer-to-peer in a RTS game is handled this at a more detailed level (using lockstep). For example when player A moves a unit:

    - A sends a message to players B, C, D, which each acknowledge that they recieved it.
    - B sends a message to C, D that it recieved it. (and all other peers do the same)
    - So no peer will perform the step unless it has recieved the Ack from all other peers.

    But... because it's peer-to-peer, each peer will have varying pings to eachtoher. Even if A has a 50ms ping to B C, B might have a 2000ms ping to C. So what happens if A recieved the Ack from all peers, it knows all other clients have recieved it so it will execute the command on the specified tick. Yet the routing between players B C is 2000ms, so player B C are waiting for the ack from eachother, but player A doesn't know this.

    So you can end up in a situation where
    - A has Ack from B, C, D. (will run the tick)
    - B has Ack from A, D but not C
    - C has Ack from A, D but not B
    - D has Ack from A, B, C. (will run the tick)
     
    Last edited: Dec 5, 2012