Gameplay Networking Jacob Steinfort. Importance of Multiplayer Games If gamers had to choose either a single-player game or a multiplayer game, most people.

Slides:



Advertisements
Similar presentations
Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
Advertisements

Dead Reckoning Objectives – –Understand what is meant by the term dead reckoning. –Realize the two major components of a dead reckoning protocol. –Be capable.
Remote Procedure Call (RPC)
CCNA – Network Fundamentals
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public ITE PC v4.0 Chapter 1 1 OSI Transport Layer Network Fundamentals – Chapter 4.
Network synchronization of Online Games Li, Zetan.
Lessons learned from a multiplayer RTS development Based on: ures/ /terrano_01.htm - accessed on 17th December.
1 Java Networking – Part I CS , Spring 2008/9.
Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization I’m Curtis.
Game Networking CSE 191A: Seminar on Video Game Programming Lecture 9: Networking UCSD, Spring, 2003 Instructor: Steve Rotenberg Guest Lecturer: Mark Rotenberg.
Internetworking Fundamentals (Lecture #2) Andres Rengifo Copyright 2008.
1 Computer Networks Transport Layer Protocols. 2 Application-layer Protocols Application-layer protocols –one “piece” of an app –define messages exchanged.
What Is TCP/IP? The large collection of networking protocols and services called TCP/IP denotes far more than the combination of the two key protocols.
Applying Real-time Simulation to Real-time Collaboration Bart Miller.
Chapter 1 The Challenges of Networked Games. Online Gaming Desire for entertainment has pushed the frontiers of computing and networking technologies.
Magda El Zarki Professor of CS Univ. of CA, Irvine
Process-to-Process Delivery:
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
Lect3..ppt - 09/12/04 CIS 4100 Systems Performance and Evaluation Lecture 3 by Zornitza Genova Prodanoff.
Game Networking CS381 Sushil J. Louis Dept. of Computer Science and Engineering University of Nevada, Reno From and much thanks to
11 September 2015 RE Meyers, Ms.Ed. CCENT ICND1 Exam Topics Review Describe the Operation of Data Networks: Network Diagrams and Data Paths.
UNIT-V Computer Network Transport Layer 1 Prepared by - ROHIT KOSHTA.
Network Physics Created by Ruslan Yavdoshak for Nikitova Games, 2008.
Advanced Multimedia University of Palestine University of Palestine Eng. Wisam Zaqoot Eng. Wisam Zaqoot October 2010 October 2010 Ref: Computer Networking:
1 Network Gaming. History of Network Gaming MUD MUD –Multi-user Dungeons Modem Games Modem Games Match Makings Match Makings –Real-time strategy –FPS.
Introduction to Networked Graphics Part 3 of 5: Latency.
CS 3214 Computer Systems Godmar Back Lecture 23. Announcements Project 5 due Dec 8 Exercise 10 handed out Exercise 11 coming before Thanksgiving CS 3214.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 OSI Transport Layer Network Fundamentals – Chapter 4.
CS 1652 The slides are adapted from the publisher’s material All material copyright J.F Kurose and K.W. Ross, All Rights Reserved Jack Lange.
Time Manipulation.  The game states rendered at the clients are different because latency is dependent on the location of the client from the server.
University of the Western Cape Chapter 12: The Transport Layer.
Fundamentals of Computer Networks ECE 478/578 Lecture #19: Transport Layer Instructor: Loukas Lazos Dept of Electrical and Computer Engineering University.
Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 Part.
William Stallings Data and Computer Communications 7 th Edition Chapter 1 Data Communications and Networks Overview.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Computer Networks with Internet Technology William Stallings
Chapter 15 – Part 2 Networks The Internal Operating System The Architecture of Computer Hardware and Systems Software: An Information Technology Approach.
Marwan Al-Namari Week 5. Responsible for delivering packets between endpoints over multiple links Physical Link Network Transport Application.
03/11/2015 Michael Chai; Behrouz Forouzan Staffordshire University School of Computing Streaming 1.
Institute of Technology Sligo - Dept of Computing Chapter 12 The Transport Layer.
Transport Layer3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley,
Individual Project 1 Sarah Pritchard. Fran, a customer of your company, would like to visit your company’s website from her home computer… How does your.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Principles of reliable data transfer 0.
4343 X2 – The Transport Layer Tanenbaum Ch.6.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
2: Transport Layer 11 Transport Layer 1. 2: Transport Layer 12 Part 2: Transport Layer Chapter goals: r understand principles behind transport layer services:
Introduction Chapter 1. TCP/IP Reference Model Why Another Model? Although the OSI reference model is universally recognized, the historical and technical.
Process-to-Process Delivery:
Networking Project. Game Networking Game Networking Topology Star (client/server) Topology – All devices are connected to a central hub (server) – Nodes.
The Transport Layer Implementation Services Functions Protocols
1.2 The Network Edge Beginning at the edge of a network we are looking at the components with which we are most familiar - namely, the computers that we.
Unity Networking.
Vocabulary Prototype: A preliminary sketch of an idea or model for something new. It’s the original drawing from which something real might be built or.
Chapter 1 Introduction Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011.
Virtual World Architecture II
CMPT 371 Data Communications and Networking
Vocabulary Prototype: A preliminary sketch of an idea or model for something new. It’s the original drawing from which something real might be built or.
CS 1652 Jack Lange University of Pittsburgh
Congestion Control, Internet transport protocols: udp
Transport Layer Our goals:
September 19th, 2013 CS1652 Jack Lange University of Pittsburgh
Process-to-Process Delivery:
CPEG514 Advanced Computer Networkst
Computer Networks Topic :User datagram protocol Transmission Control Protocol -Hemashree S( )
Process-to-Process Delivery: UDP, TCP
Computer Networks Protocols
Chapter 3 Transport Layer
The TCP/IP Model.
Presentation transcript:

Gameplay Networking Jacob Steinfort

Importance of Multiplayer Games If gamers had to choose either a single-player game or a multiplayer game, most people will choose multiplayer Why? – Beating your friends is more fun than beating an AI – Get a different experience every time you play the game

USA 2011 Top Unit Sales Multiplayer Single-Player

Importance of Getting Multiplayer Right If developers provide a bad experience, people won’t buy the game

How do we get multiplayer right?

Computer Networking Review Part 1 CS Data Communications and Computer Networks – Latency = Delay, amount of time it takes a packet to travel from source to destination RTT (Round Trip Time)= source -> destination ->source Usually measured in milliseconds (ms) – Bandwidth = amount of data that can be transferred per unit of time Usually measured in Megabits / second (Mbps) Bandwidth RTT

– Ideally: Infinitely small latency (0 ms) Unlimited bandwidth ( … Mbps) – Realistically: What is a perfect connection?

Socket = bidirectional communication endpoint for sending and receiving data with another socket. Two main types of sockets: – TCP (Transmission Control Protocol) – UDP (User Datagram Protocol) Computer Networking Review Part 2

TCP vs. UDP TCPUDP Connection based (handshake)No concept of connection, have to code this yourself Guaranteed reliable and orderedNo guarantee of reliability or ordering of packets. They may arrive out of order, be duplicated, or not arrive at all! Automatically breaks up your data into packets for you You have to manually break up your data into packets and send them Makes sure it doesn’t send data too fast for the internet connection to handle (flow control) You have to make sure you don’t send data too fast for your internet connection to handle Easy to use, you just read and write data like its a file If a packet is lost, you need to devise some way to detect this, and resend that data if necessary SlowFast

Why UDP? Real-time requirement – For most parts of a game, it doesn’t matter what happened a second ago, you only care about the most recent data

Gameplay Networking What is it? – Technology to help multiple players sustain the belief that they are playing a game together – Is it possible to achieve this? Challenges: – Latency – Bandwidth – Dropped Packets – Cheaters – Joining/Quitting Games in progress

What type of games will I be talking about? Action Games – Emphasizes physical challenges, including hand– eye coordination and reaction-time Best Example: SHOOTERS!

First technique of Gameplay Networking: Peer-to-Peer Lockstep Each computer exchanging information with every other computer Process: extract a game into series of turns and a set of command messages – Example: turn = 50ms; set of commands = {move unit, attack unit, construct building, …} What happens during a turn on one machine? 1.Receive other player’s commands 2.Evolve the game state 3.Start recording commands 4.Stop recording commands and send them to other peers

Peer-to-Peer Lockstep Was created for RTS (Real Time Strategy) games – Game state was too large to transmit Had to settle for transmitting changes only

Peer-to-Peer Lockstep Deterministic – Will always produce same output when given same input – Synchronized: each machine is at the exact same state at any given time

Problems with Peer-to-Peer Lockstep 1.Game could become out of sync – One small change could destroy synchronization 2.Doesn’t support late join – Everybody needs to start from the same state 3.Everybody’s perceived latency is equal to the slowest latency – Necessary for consistency

Peer-to-Peer Lockstep Does it work for action games? – Maybe on LAN, definitely not over the Internet Problem: input latency Doom (1993): First action game to attempt to implement peer-to-peer lockstep

Client/Server model Computer Networking Review Part 3

Solution: Client/Server Each client has only one connection: to the server Clients turned into “dumb” terminals – Input sent to server (real-time) to be evaluated – Server sends updated game state (their player and all other players) to the client

2 Types of Client/Server: Dedicated Server – Clients are the only players Non-dedicated Server – Server is also a player – Server player is called “Host”

Client/Server Benefits 1.No more turns = Less latency – Other player’s latency will not slow you down Process changes

2.No more consistency issues – Game is only being simulated on the server (Peer-to-Peer Lockstep: game simulated on all machines) Client/Server Benefits

Client/Server: Small Problem Frame rate on client is limited to how frequently the server sent the game state to the client Solution: Entity Interpolation!

Entity Interpolation Game State 1 Game State 2 Interpolated Game State / Rendered Frame

Entity Interpolation with dropped packet safeguard ? ?

Client/Server with Entity Interpolation Benefits: Provides a very smooth experience (unlimited framerate) that is much better than Peer-to- Peer Lockstep Clients still run minimal code (no physics/collisions)

Client/Server: Big Problem Client1 has an unfair advantage If not dedicated server, huge host advantage + + = LAG! (user-perceived latency)

New Solution: Client-Side Prediction As soon as user changes input, their machine predicts where the server is going to put them – Push forward on keyboard, instantaneously move forward on screen Client needs to run more code – Client needs to be aware of physics and collisions (don’t want to run through a wall)

Client-Side Prediction (This is where it gets complicated) After RTT has passed, the client gets the updated game state from the server and verifies that its game state WAS equal to what it predicted – If not, client performs correction Server Correction Client Prediction Client’s Modified Prediction User perceives lag

Client-Side Prediction How to implement? Need a circular buffer on the client to store the user’s last few commands – When correction comes in from server, client performs new predictions based on the saved commands Client Prediction

Gears of War 1 (2006) and 2 (2008): Host Advantage 0:57 Host 1:05 Non-host

Another problem with Client/Server 1.I shoot another player and know it is a hit 2.Client sends shoot command to server – Contains point of origin, and direction 3.Server gets the command and evaluates the shot – Server: client did not get the hit Why? The position of other players on the client’s machine is always out of date. You only see a “ghost” of other players.

Possible Solution: Give Client authority over shots Client performs collision check right after shot – If hit, send a “hit confirmed” message to server Problem? – CHEATERS! – Man-in-the-middle attack

Actual Solution: Lag Compensation 1.Client sends shoot command to server – Contains point of origin, and direction 2.Server gets command a)Estimates when the client executed the command using RTT b)Rolls back the game to the time of shot c)Simulates shot, checks for collision d)Server updates current game state Counter Stike: View of Player1’s point of view from the server Player2 is running to the left Player2’s actual position on server Player2’s position seen from Player1’s client

Review of Basic Techniques Peer-To-Peer Lockstep – Simple, works well for RTS games Client/Server – Much better for action games, frame rate limited Client/Server + Interpolation – Unlimited frame rate, still has large input latency + Client-Side Prediction – No more input latency, interacting with other players is lagged though + Lag Compensation – No lag with other players – Amazing!

Battlefield 3 Getting Gameplay Networking Right

Extra Tricks In Use Now Game: Halo: Reach Developer:Bungie Studios

A closer look at Client-Side Prediction This technique works great for the character that the client is controlling What about the other objects in the game (e.g. a grenade)

Entity Extrapolation

This is how it looks on a Halo: Reach client

Entity Extrapolation Only makes sense for objects that have predictable paths – Grenades, rockets, anything not being controlled by a user Doesn’t make sense to use on other players – Unpredictable direction changes – Have to stick with Interpolation for other players

Entity Extrapolation It’s so complicated, why use it? To reduce lag

Another Trick: Prioritization A Halo game can have hundreds of objects – Some objects are less important to update on one client and more important to update on another Solution: Real-time prioritization – Each object for each client has an update priority

Prioritization Prioritization example 0.50/1.00/0 Legend: Final priority / relevance / desired update period (ms) 0.22/0.97/127

Internet Protocol Stack Application Transport Network Link Physical

Check out Bungie’s Presentation I Shot You First: Networking the Gameplay of HALO: REACH – Game Developers Conference, 2011

Sources Aldridge, David. "I Shot You First: Networking the Gameplay of HALO: REACH." GDC Vault. Game Developers Conference, 28 Mar Web.. Fiedler, Glenn. "Networking for Game Programmers." Gaffer On Games. N.p., 1 Oct Web. 1 Sept Kurose, James F., and Keith W. Ross. Computer Networking: A Top-down Approach. Boston: Pearson/Addison Wesley, Print. "Source Multiplayer Networking." Valve Developer Community. Valve, n.d. Web. 1 Oct Steed, Anthony, and Manuel Fradinho. Oliveira. Networked Graphics: Building Networked Games and Virtual Environments. Burlington, MA: Morgan Kaufmann, Print.

Sources Videos: Gears of War 2 Host Comparison – Battlefield 3 – Jet vs Sniper –

Questions?