Week 1 Game Networking Introduction PDF
Document Details
University of Perpetual Help System DALTA
Tags
Summary
This document provides an introduction to game networking, covering topics such as Learning Outcomes, state synchronization, video games, input prediction, and game server models. It also discusses important networking concepts like latency. This document appears to be part of a course in game development.
Full Transcript
UNIVERSITY OF PERPETUAL HELP SYSTEM DALTA IT 5003 Elective IV Game Networking Introduction of Game Networking Learning Outcomes At the end of the lesson the students must be able to : 1. Define Game networking 2. Identify the game networking stages. 3. Explain the tick rate, server , state s...
UNIVERSITY OF PERPETUAL HELP SYSTEM DALTA IT 5003 Elective IV Game Networking Introduction of Game Networking Learning Outcomes At the end of the lesson the students must be able to : 1. Define Game networking 2. Identify the game networking stages. 3. Explain the tick rate, server , state synchronization and interpolation In 1958, Higinbotham created Tennis for Two to cure the boredom of visitors to Brookhaven National Laboratory. He learned that one of Brookhaven's computers could calculate ballistic missile trajectories and he used this ability to form the game's foundation. The game was created on a Donner Model 30 analog computer. While Higinbotham's system did not create a video signal, he had created a unique way to alternate among the computer's outputs with the transistor switching circuit, creating the image of a tennis court and allowing players to control a movable ball seen on a screen, just like a modern video game. What is Game Networking? Game networking is one of the categories of computer networking that details with state synchronization, entity interpolation, input prediction and lag compensation for multiplayer games. Video games – Let multiple players to play the same game at the same time, on the same computer using split- screen or different computers connected through the internet game server or LAN, is called as Multiplayer games. Such Multiplayer games that connect gamers across the internet or LAN works based on game networking, which is an essential for every Game Developer to understand. https://www.youtube.com/watch?v=KBBJqPL5-eU https://www.youtube.com/watch?v=4yzsVLhN4FQ&t =338s State Synchronization In state synchronization, network packets/communication between the server and the clients is optimized. The idea is to send both input (from the players) and state of the game running on both ends (of the network - server & clients) in an approximate and lossy synchronization (of values such as integers, floats, strings, and Booleans) strategy. This strategy gets an advantage of selecting the most important object which needs to send in updates for each packet (data packet). This process takes a large amount of time in extrapolation (decoding the message) but it is an easy and efficient process. https://www.youtube.com/watch?v=a9UJukZWm4Y Peeker see the target first In online games, a tick is an update between the server and the connected computers. Tick rate refers to how many times information is updated a second, usually measured in hertz. A 64-tick server will update info 64 times a second. That latency is partly based on the network and partly based on the server tick rate. To give defenders the time they need to react to aggressors, we determined that VALORANT would require 128-tick servers. Roblox caps the refresh frame rate to 60 fps (frames-per-second). The server tick rate. Each server has a tick rate that refreshes the game. Many servers have a 128-tick server, which refreshes the game 128 times per second. https://www.youtube.com/watch?v=fVotjwJQ5zM Entity Interpolation Generally, almost every multiplayer game has entity interpolation in their networking model to hide the lags and jitters. Lags and jitters occur when updates are sent less frequently (per second) or due to packet drops, which increases more if UDP is used in the model. Interpolation helps in smoothing the transformations as well as brings them closer to the original movements. Input Prediction Input prediction creates a smoother player movement even before the server responds to client’s inputs. It uses players’ previous state plus player input to draw next predicted state (created using delta algorithm, which is previous position plus next expected position). And once when it receives an update from the server, it adjusts the current player state and deletes the old data. This process is repeated between every update to produce seamless game-play experience. Prediction is a technique that tries to reduce the effects of lag by adjusting the game state on the client based on the player input. For example, when a player moves their character, the client predicts where the character will be in the next frame based on the input and the physics. Two Stages of Game Networking Game networking is created in two stages: In-Game Networking and Backend Infrastructure. In-Game Networking Deals with choosing the right game server architecture like Peer-to-Peer or Client-Server, choosing a model to maintain game assets and network traffic, selecting the bandwidth and latency requirements, and picking network protocols (TCP/UDP, UDP is widely used in gaming). Backend Infrastructure Deals with creating a lobby, buddy list, clans and tournaments; and with authenticating, key checking and accounting. Important Concepts of Game Networking Latency Latency is round trip average time that is taken by a workstation to send the data packets to the server (for games it is a game server) and receive back the data packets from the server. The higher the latency, the slower is the game — the clients will not be able to enjoy the gameplay at the fullest. Dedicated Server A dedicated server is a dedicated workstation that has a copy of the game and runs the game as just a server. Host Server In host server, there is no dedicated workstation/computer to run the game. One of the clients (host-client) will also play the role of a server, by creating an instance of the game to which other players can connect. Host Migration In the client-server model, a centralized server has authority over the game. If the server goes down or fails, the gameplay is interrupted. To avoid this, we can create a host migration through which a copy of the game shall be maintained on all clients, which will be used to transfer the game to the host upon current server disconnection. Dead Reckoning Game server predicts the next move based on the last move. Roll-Back When clients correct by warping the inconsistent predictions from the game server, it is called roll- back. Communication Model in Game Networking Open System Interconnection Model (OSI) OSI model is developed by the International Organization of Standardization for standardizing communication system in 1978. This model laid standardization on how one system shall communicate with other. It has seven different layers and each layer is designated to work on a part of a communication model. Seven Layers of the OSI Model 1. Application Layer (Layer 7) The application layer is at the top of the OSI model. This layer creates data that can be transmitted over the network. The layer acts as a window to access the network. 2. Presentation Layer (Layer 6) Presentation layer works with data representation and encryption. It translates messages to a network-standard transmission format on sender’s end and then back to native format on the receiver’s end. It also encrypts the message before sending the message to the host. 3. Session Layer (Layer 5) Session layer deals with creating, maintaining and terminating a session between the nodes. It is also responsible for Synchronizing and Dialog control. 4. Transport Layer (Layer 4) Transport layer breaks the data into small units called segments, which are used in end-to-end data transmission over the networks. 5. Network Layer (Layer 3) Network layer deals with sending data from one node to another node over different networks. It is also responsible for finding the shortest path for delivering the network message. This is that major layer that we will be working with for Game Networking. 6. Data Link Layer (Layer 2) Data Link layer is responsible for error checking and sorting the messages. 7. Physical Layer (Layer 1) Physical layer’s functionality is to deal with Signal, Binary Transmission and Transmission mode. OSI model can be viewed in two stages: Application (Application, Presentation & Session); Data Transport (Transport Network, Data Link & Physical) Network Layer – Key in Game Networking The Network layer is the third layer of OSI (Open System Interconnection) model that is responsible for transmitting data packets from a computer/node to another computer/node. It provides data routing and switching for creating paths for network communication. Responsibilities of Network Layer Establishing a logical connection between nodes Data forwarding Routing Delivering error report Game Server Models There are few game server models that are widely popular in Game Networking. Peer-to-Peer (P2P) In Peer-to-Peer, the players are connected directly to each other without a centralized system. So in P2P, each player shares the information about their game status with every player in the game. In this, each connection is a peer/node, and each peer has equal authority on the game. With the evolution of the Client-Server model, this model is no longer as popular as it used to be in multiplayer gaming. Advantages It does not need a dedicated server; but has an individual workstation/computer that is used in data transfer (game status). As there is no server dependency, even if one or two peers/players disconnects from the game other gamers can continue the game uninterruptedly. Information is more reliable, giving less space for cheating in the game. Latency is reduced. Disadvantages The gameplay is completely deterministic. That means a player might get an advantage over the other player by just taking a different path. There is no server to verify the incoming data from other players, like any change in the current state. Players can cheat easily and this model is not scalable. Client-Server In Client-Server model, players (clients) are connected over a centralized server. This server has complete authority over the gameplay. The centralized server through which players are connected is called a game server. The game server is completely responsible for keeping track of every client’s game status and distributing the information to all the other players; that is, all client communication happens through the game server. For example: When a client updates the server about his position, health, ammo count etc., this information is updated on the other clients’ systems by the game server. Advantages Incoming data is more reliable, because of game server authentication. With a dedicated server, a cheat-proof game can be created. Scalable projects can be created. A dedicated server is not required in client-server-client-host. Disadvantages Latency rate is higher. Server maintenance can be very expensive. Need to handle server bottlenecks like server overloading or unable to keep up the pace. What Every Programmer Needs To Know About Game Networking Peer-to-Peer Lockstep In the beginning games were networked peer-to-peer, with each each computer exchanging information with each other in a fully connected mesh topology. You can still see this model alive today in RTS games, and interestingly for some reason, perhaps because it was the first way - it’s still how most people think that game networking works. The basic idea is to abstract the game into a series of turns and a set of command messages when processed at the beginning of each turn direct the evolution of the game state. For example: move unit, attack unit, construct building. All that is needed to network this is to run exactly the same set of commands and turns on each player’s machine starting from a common initial state. Conclusion Game networking is about sending and optimizing (that is what needs to be updated from player or server side) network packets, making a centralized authority to avoid cheating and hosting a game. Choosing a right network model can be complicated if you are not aware of the network basics. Though game networking discussed in the blog post is in relation to Unity 3D, the game networking concepts remain the same regardless of the game engine. http://blog.icat.ac.in/basics-of-game- networking#:~:text=What%20is%20Game%20Networking%3F,lag%20compensation%20fo r%20multiplayer%20games. https://www.washingtonpost.com/video-games/esports/2020/04/14/valorant-tick-rate- servers-pros-streamers/