Glossary
SnapNet uses a number of common networking and gameplay terms. Often, these terms take on a number of meanings in the game and technology industries in different contexts. Below are terms used throughout the codebase and what they mean specifically in the context of SnapNet:
Backwards Reconciliation
Backwards reconciliation is the process of rewinding the state of interpolated entities on the server to match what a given player was seeing on that frame. It is used primarily to compensate for latency when firing hitscan weapons in shooters.
Client
Clients represent physical machines connected to a server. When playing an offline session with SnapNet, you may have a single client and server both running within the same process.
Note
Clients represent physical machines and their network connection to the server, not individual players. Consider a game with support for splitscreen: there may be two clients connected to the server but four humans playing.Client Index
A client index is an integer that uniquely identifies a specific client. It is globally agreed upon between the server and all connected clients e.g., client index 2 will refer to the same client on everyone’s machine. Note that client indices will be reused so if a client disconnects their client index is no longer valid. If another client connects it is likely that it will be assigned that same client index. A negative client index is always invalid and a value of -1 is often used to indicate a client is not specified, valid, or applicable.
Entity
Like Unreal’s Actors or Unity’s GameObjects, SnapNet’s entities are at the heart of gameplay. Entities can contain any number of networked fields and it is these entities and their associated fields that are kept in sync for each frame of your game.
Entity Index
An entity index is an integer that uniquely identifies a specific entity in the simulation. It is globally agreed upon between the server and all connected clients e.g., entity index 2 will refer to the same entity on everyone’s machine. Note that entity indices will be reused so if an entity is destroyed its entity index is no longer valid. If another entity is spawned it is likely that it will be assigned that same entity index. A negative entity index is always invalid and a value of -1 is often used to indicate an entity is not specified, valid, or applicable.
Event
SnapNet events are constructs that are critical to networking visual and sound effects and are typically used for transmitting state that belongs more to an instant in time than any particular entity. Callbacks are executed when they are predicted by the simulation and then subsequently when they are either confirmed or canceled by the server—giving the developer the flexibility to configure how cosmetic effects behave under latency on a case-by-case basis.
Full Match Replay
Full match replays are emitted in short chunks by the server during gameplay. These chunks can later be passed to a client to play back the recorded gameplay. The game can be spectated from any specified player’s perspective and the resulting gameplay will be lag compensated to match what the spectated player saw at the time.
Instant Replay
Instant replays refer to earlier gameplay shown to one or more clients while the match is running. An instant replay can be played back to all clients to show an instant replay in a sports game, played back to a single client as a killcam in a shooter, or saved and played back later to show the best play of the game. Instant replays are optionally played back from a specified player’s point of view and the gameplay is lag compensated to match what the spectated player saw at the time.
Local Player
A local player represents a human playing the game on a particular client. In games that support splitscreen or couch play, there may be multiple local players per client. In single player games, there will always be one local player per client.
Local Player Index
A local player index is an integer that identifies a specific local player per client. Local player index 0 always refers to the first human playing on a client, 1 is the second, and so on. A negative local player index is always invalid and a value of -1 is often used to indicate that a local player index is not specified, valid, or applicable.
Note
The same local player index refers to different humans on different clients. When working with local player indices on the server, a client index is required to disambiguate which human is being specified.Player
A player represents a human or a bot that is playing the game. Players provide input to the simulation and can be assigned ownership of entities and events.
Player Index
A player index is an integer that uniquely identifies a specific player. It is globally agreed upon between the server and all connected clients e.g., player 2 will refer to the same player on everyone’s machine. Note that player indices will be reused so if a player leaves the game their player index is no longer valid. If another player joins it is likely that they will be assigned that same player index. A negative player index is always invalid and a value of -1 is often used to indicate a player is not specified, valid, or applicable.
Reliable Message
Reliable messages are packets of data that will be sent reliably outside the normal flow of game traffic. They are not stored or played back in replays and are most often used for clients to make requests to the server e.g., when making selections in the user interface or issuing commands for debugging, or to exchange chat messages.
Server
The server is a process running on a physical machine that accepts incoming connections from clients, simulates the game, and is the ground source of truth for what occurred during gameplay.