
















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















































Networking in Games
In-game networking:
Machine 1 (^) Machine 2
in library/kernel (EECS 489)
in game (more in EECS 591/491)
Network: LAN or Internet
Distributed Systems
Networking
Distributed Systems
Networking
Consistency
Problem statement:
time
player1 (^) player
fire^ move
fire move
How do you differentiate the two cases, at both player1 and player2?
When to Render a Move?
How long do you have to wait for the other players’ moves before rendering them?
time
player1 (^) player
fire^ move
fire^ move
fire^ move
Lock-step Protocol
Problems:
time
Player1 Player
synchronize moves and render scene
Pessimistic Consistency
Every player must see the EXACT same world
AoE/AoK/AoM:
Problems:
Dead Reckoning
v
move lost or late, dead reckoned
Optimistic Consistency with Roll-back
Observation: dead reckoning doesn’t have to be limited to lost packets!
Half-Life:
Consistency: Correctness
For consistency ALL user input MUST pass through the synchro- nization module
Be careful with random number generators. Isolate the one used for game-state updating from other uses (ambient noise etc.)
Design for multiplayer from the start. Single-player becomes a special case of single-client multiplayer game
Initialization Overall GameControl Game SessionControl
Local PlayerInput
Receive RemotePlayer(s) Input Main Logic:
Local Input^ Send
Render sceneto buffer
Copy buffer todisplay
Time sync
Reducing Consistency Check
Do area-of-interest management (a.k.a. relevance filtering):
Aura and nimbus are defined for a given set of “technology” (e.g., cloaking device, quantum sensor, etc.)
Perform consistency check only when B is within A’s nimbus and A is within B’s aura
Cheating
AoE doesn’t need cheat-proofing because each player simulates each move in lock step All moves are simulated, not just collisions
Half-Life synchronizes only collisions, higher probability for cheating
Cheats (more at megagames.com):
Suppress-correct Cheat
At time 150, C sends out a move consistent with fake moves at time 0, 50, 100 that were actually computed upon receiving packets from Player H
Player C Player H 0 50 100
200
150
250
0 50 100
200
150
250
t= t= t=
Distributed Computing Model
Message passing:
Initialization Overall GameControl Game SessionControl
Local PlayerInput Receive RemotePlayer(s) Input Main Logic:- update states
Local Input^ Send
Render sceneto buffer
Copy buffer todisplay
Time sync
Player inputs sent/received using sockets
Socket Programming
What is a socket?
How to use socket for client-server computing?
Socket Programming
socket : a data structure containing connection information
Connection identifying information:
Client-server connection: