P2P synchronization: can a player update fields of other players?

Posted by CherryQu on Game Development See other posts from Game Development or by CherryQu
Published on 2012-09-01T06:31:12Z Indexed on 2012/09/01 9:50 UTC
Read the original article Hit count: 531

I know that synchronization is a huge topic, so I have minimized the problem to this example case.

Let's say, Alice and Bob are playing a P2P game, fighting against each other. If Alice hits Bob, how should I do the network component to make Bob's HP decrease?

I can think of two approaches:

  1. Alice perform a Bob.HP--, then send Bob's reduced HP to Bob.
  2. Alice send a "I just hit Bob" signal to Bob. Bob checks it, and reduce its own HP, then send his new HP to everyone including Alice.

I think the second approach is better because I don't think a player in a P2P game should be able to modify other players' private fields. Otherwise cheating would be too easy, right?

My philosophy is that in a P2P game especially, a player's attributes and all attributes of its belonging objects should only be updated by the player himself. However, I can't prove that this is right. Could someone give me some evidence? Thanks :)

© Game Development or respective owner

Related posts about networking

Related posts about synchronization