I love the smell of UnrealEd crashing in the morning. – tarquin
What is Replication?
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?
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?
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.
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.
- Actor class, which contains the properties governing replication behaviour
- Introduction to Replication
- Replication Block
- Role and RemoteRole, and NetMode.
- Netcode Idioms
- Legacy:Replication/Message Types
- Simulated Function
- Replicated Function
- Animation Replication
- Another Look At Replication
- Replication examples
- Networking Architecture by Tim Sweeney himself.
- Replication De-Obfuscation by Mongo (28-12-06, local copy : Replication De-Obfuscation)
- Guided Ripper Tutorial – A UT-based tutorial describing the pitfalls of creating a weapon that works not only offline.
- Networking Sample by GW
- Another Networking Sample by GW