I don't need to test my programs. I have an error-correcting modem.

Legacy:Replication

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

What is Replication?[edit]

Replication is the mechanism by which the computers in a network game are kept in sync. If you are writing code that will be used in a network game and causes effects that might be seen by more than one player, then you need to be aware of replication. Just about the only time a coder doesn't care about replication is when the code only affects a single player's display.

Why do I care?[edit]

In single player mode, there is no distinction between client and server, so your scripts run fine, moving items, updating velocities, spawning and destroying actors... But when you move over to network play, suddenly you find that the item you moved keeps pinging back to its original location, or destroyed items re-appear, or the movement is terribly jittery. You need to understand from the start how to be sure that the server is doing the right thing and passing the necessary information to the clients.

How Does It Work?[edit]

Replication is a lower-bandwidth solution than Lock Step or Client Server architectures. In online games there is a server, which has final authority over what is happening, and clients, which deal with displaying the game world and capturing the user's input. So far this sounds just like the client-server model, but where replication gets clever is that the clients are allowed to simulate certain things. For example, if a projectile is fired, its behaviour is well defined – it will travel at a certain velocity in a certain direction. The client can be told the start, angle, and velocity, and can then continue to update the projectile's location with no further information from the server.

Parallel Universes[edit]

Replication is often thought of as a hard subject to get your mind around. The main reason it is difficult to understand is that Replication itself partially hides the fact that you are writing code for two systems: the server and the client. When an actor is spawned, it is (usually) spawned in two parallel universes – one, authoritative version on the server and a proxy on the client. The confusing part is that it is the same uscript code running on both systems, even though they perform subtly different jobs. So right now, before you read on, bifurcate your brain. Everything you write is going to two audiences: the server and the client.

Key Concepts[edit]

Related Topics[edit]

External Links[edit]


Category:Legacy Tutorial
Category:Legacy To Do – This needs merged into the grand topic of Replication. See Replication/Discussing