Netcode

Netcode is a blanket term for anything that somehow relates to networking in online games; netcode is a term most commonly used by gamers when discussing synchronization issues between clients and servers. The actual elements of a game engine that can cause so-called "netcode issues" include, among other things, latency, lag compensation or the lack thereof, simulation errors, and network issues between the client and server that are completely out of the game's hands.[1] Netcode as a term tends to be used only in the gaming community, as it is not recognized as an actual computer science term.[2][3]

Potential causes of netcode issues

Latency is an unavoidable fact of online games, caused by not only network latency, which is largely out of a game's control, but also latency inherent in the way game simulations are run. There are several lag compensation methods used to disguise, reduce, or cope with latency, however their feasibility varies by application.

A single update of a game simulation is known as a tick. The rate at which the simulation is run on a server is referred often to as the server's tickrate; this is essentially the server equivalent of a client's frame rate, absent any rendering system.[4] Tickrate is limited by the length of time it takes to run the simulation, and is often intentionally limited further to reduce instability introduced by a fluctuating tickrate, and to reduce CPU and data transmission costs. A lower tickrate increases latency in the synchronization of the game simulation between the server and clients.[5] Tickrate for games like first-person shooters can vary from 60 ticks per seconds for games like Quake or Counter-Strike: Global Offensive in competitive mode to 30 ticks per seconds for games like Battlefield 4 and Titanfall. A lower tickrate also naturally reduces the precision of the simulation,[4] which itself might cause problems if taken too far, or if the client and server simulations are running at significantly different rates.

Games may limit the number of times per second that updates are sent to a particular client, and/or are sent about particular objects in the game's world. Because of limitations in the amount of bandwidth available, and the CPU time that's taken by network communication, some games prioritize certain critical communication while limiting the frequency and priority of less important information.[4][6] As with the tickrate, this effectively increases the synchronization latency. Game engines may also reduce the precision of some values sent over the network to help with bandwidth use;[6] this lack of precision may in some instances be noticeable.

Various simulation synchronization errors between machines can also fall under the "netcode issues" blanket. These may include bugs which cause the simulation to proceed differently on one machine than on another, or which cause some things to not be communicated when the user perceives that they ought to be.[1] Traditionally, real-time strategy games have used lock-step peer-to-peer networking models where it is assumed the simulation will run exactly the same on all clients; if, however, one client falls out of step for any reason, the desynchronization may compound and be unrecoverable.[7]

Input delay and rollback networking

In order for an online game to function smoothly, player input must be received within a certain time for each frame (e.g. 16 ms at 60 FPS). However, due to inconsistent network conditions and physical distance between players, this may not be realized. Many games solve this using delay-based netcode, which allows for a buffer (e.g. 3 frames) within which input can be received. When input fails to be sent within this buffer, the game has to wait, causing freezes. Because this delay can be variable, this causes an inconsistent experience compared to offline play, and can affect player performance in timing-sensitive genres such as fighting games.

An alternate solution, rollback networking, predicts remote player input instead of waiting (assuming the same input). When this prediction is correct, the game proceeds as-is. If the prediction was incorrect, the game state is reverted and gameplay continued from the corrected state, seen as a "jump". Most games utilize a hybrid solution, with a fixed input delay, and then rollback being used. Rollback requires the game engine to be able to turn back its state, so requires changes to existing engines. A library named GGPO also exists to help implement rollback.[8]

Transport layer protocol and communication code

A game's choice of transport layer protocol can also affect perceived networking issues. Should the game use TCP, networking will have a high overhead cost and increased latency. Should it use UDP, the game engine may need to implement its own networking code to handle error conditions and other things that are handled by TCP;[9] this increases the engine's complexity and might itself lead to issues.

gollark: Okay, so not actually all...
gollark: Oh, hey, all mine are back now. Mostly.
gollark: Luck: Weird and Oscillating.
gollark: Wow! I caught my first Copper!
gollark: In one drop, I missed a blusang, magma *and* chicken.

See also

References

  1. "Addressing "Netcode" in Battlefield 4". EA Digital Illusions CE. March 2014. Retrieved 2014-03-30.
  2. "List of programming and computer science terms". Labautopedia.
  3. "Computer programming term". Computer Hope.
  4. "Source Multiplayer Networking". Valve. Retrieved 2014-03-30.
  5. "Titanfall, de l'importance d'un bon tickrate". gamekult.com. 2014-03-29. Retrieved 2014-03-30.
  6. "Unreal Networking Architecture". Epic Games. Retrieved 2014-09-07.
  7. Glenn Fiedler. "What every programmer needs to know about game networking". Retrieved 2014-09-08.
  8. Pusch, Ricky. "Explaining how fighting games use delay-based and rollback netcode". Ars Technica. Retrieved 11 July 2020.
  9. Glenn Fiedler. "UDP vs. TCP". Retrieved 2014-09-08.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.