xoros
Indeed, I had noticed that the peer could not received the message by itself.
The problem comes from the execution flow. In my concept, I split command execution into 2 stages,
Each of player (host/peer) will request a command, then go through validating, and executing stage,
1. validate stage: player check if this command could be run by call it's validating function. If not, do nothing, else (validating pass)
- host: broadcast this command to all peers, then go to stage2 immediately
- peer: send request to host, then go to stage2 immediately , so that there is no delay
------> when host receive request from peer, host will run the same validating function, it should be pass like sender-peer, otherwise the validating had mismatched, something wrong at this sender-peer. If the validating pass (match with sender-peer), broadcast this command to all peers. ( then go to stage2 immediately )
2. execute stage: execute command
- player(host/peer) who request the command and validating pass will go to this stage
- peers receive the command which validating by host will go to this stage
---
On the other word -
1. [peer] request a command
2. [peer] validate this command (could I run this command?)
3. [peer] if validated pass, execute this command and send this request to host
4. [host] receive command , then validate it
5. [host] if validated pass, execute this command and send this request to other peers
- if validated failed , something with that peer
6. [other peer] get validated command, execute it.