Network Physics

Download Report

Transcript Network Physics

Network Physics
Created by Ruslan Yavdoshak for Nikitova Games, 2008
Index
•
•
•
•
AI Cover
Lags, Lag compensation
Smoothing
Priority channel, QoS
AI Cover
• Multiplayer = AI (realization)
• Multiplayer more fun than AI
• Conflict 2 side hosts [Player + AI], [Player],
where AI is processing when lag has been
happened?
• Prediction of the decision of AI on different
hosts
LAGS: Plague of networked games
Physics of Latency:
• <10ms LAN
• <30ms “Regional Lag”
• <100ms World Lag with fiber optics
• 250-350 ms (avr.) Satellite communication
• >350ms overloaded channel, slow communication, delay filter
• Speed of transfer for “acknowledge” transport :PacketSize /
(2*latency)
• Additional latency when packet has been drop
• Example: 1450 byte packets on a link that can handle 2500 bytes / s
of data: Next Packet Time = Current Time + (1450 bytes + 28 byte
UDP header) / 2500 = Current Time + .5912 seconds
• Computer hardware and operating system latency
How to Overcome Latency
Decouple the communications from your game:
• Place blocking communications calls in a separate thread or use
asynchronous communications calls.
• Never await incoming data from another player before allowing
game play to continue.
• Use predicting, interpolating, and reconciling later to improve game
play.
• When using prediction, transmit not just position information, but
also velocity and acceleration.
• Latch or queue user input (for example, keystrokes) until the next
time communications data is to be sent. If you use the more
traditional method of checking the keyboard at regular intervals
during the game loop and perform this checking only at moments
before sending data to the network, you will be prone to missing
user input.
How to Overcome Latency
Hide latencies in other game elements:
• Schedule events in the future if you want them to happen
simultaneously for all users.
• Require multiple shots to kill someone, and minimize the number of
all-or-nothing, deterministic, latency-sensitive events.
• Make rockets take a long time in the air (and reconcile the outcome
while the rocket is flying).
• Require time to move from one location to another (don't allow any
instantaneous teleporters).
• Make players, ships, and other objects move in ways that facilitate
prediction. For example, build inertia into the way entities in your
game move.
• Use your imagination to incorporate latency within the context of
your game concept.
Dead Reckoning Algorithms
Cubic splines
Lag Compensation
Terminology:
• Server-side prediction
• Client-side prediction
• Drawbacks of movement prediction (50150ms.)
• Hit-side prediction
• Cheat protection
Lag Compensation
Smoothing
•
•
•
•
Extrapolation correction
Queue of packets & “live-modifying”
Speed limits
Active walk system (steps & turn)
Quality-of-Service (IntServ )
Integrated Services (IntServ):
•
architecture for providing QoS guarantees in IP networks for individual flows
•
fundamental changes to the Internet to reserve end-to-end bandwidths
•
components:
•
admission control
•
resource reservation
•
routing
•
classifier and route selection
•
packet scheduling
Problems with that approach:
•
scalability/complexity: maintaining per-flow router state difficult with large number of
flows
•
flexible service models: IntServ has only two classes (controlled, guaranteed), we
would like “qualitative” service classes
Quality-of-Service (DiffServ )
Differentiated Services (DiffServ):
• simple functions in network core, relatively complex
functions at edge routers (or hosts)
– edge: packet classification, packet marking, traffic conditioning
– core: forwarding flows are aggregated into classes that receive
‘treatment’ depending on class parameters
• don’t define define service classes, provide functional
components to build service classes
Channels/Flow