The simple way :
- Client sends inputs to the host.
- host processes inputs.
- host calculates the game state (positions of objects).
- host sends game state to clients.
Example : The original Quake networking (for LAN games).
Advantages : simple.
Disadvantages : lag becomes a serious issue. Round-trip latencies will make the client input laggy.
The way it is corrected :
- client reads his inputs, and calculates a local prediction of the player position.
- client sends inputs to the host, as well as his local prediction calculation. The input+prediction packet is marked with a unique number (aka Sequence Number, aka SQN).
- client also stores the input+prediction packet in a buffer.