The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

Difference between revisions of "Legacy:Replication"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
(Replacing page with 'DeleteMe Moved into non-legacy space')
m (reverted, this shouldn't simply be moved to the main namespace as it only links back to the legacy pages anyway)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[DeleteMe]]  Moved into non-legacy space
+
==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 [[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}/Compared|Lock Step]] or [[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}/Compared|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==
 +
 
 +
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==
 +
 
 +
* [[Legacy:Relevance|Relevance]]
 +
* [[Legacy:Role|Role and RemoteRole]]
 +
* [[Legacy:NetMode|NetMode]]
 +
* [[Legacy:Simulated Function|Simulated Function]]s and [[Legacy:Replicated Function|Replicated Function]]s
 +
 
 +
==Related Topics ==
 +
* [[Legacy:Actor|Actor]] class, which contains the properties governing replication behaviour
 +
* [[Legacy:Introduction To Replication|Introduction to Replication]]
 +
* [[Legacy:Replication Block|Replication Block]]
 +
* [[Legacy:Role|Role]] and RemoteRole, and [[Legacy:NetMode|NetMode]].
 +
* [[Legacy:Netcode Idioms|Netcode Idioms]]
 +
* [[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}/Message Types]]
 +
* [[Legacy:Simulated Function|Simulated Function]]
 +
* [[Legacy:Replicated Function|Replicated Function]]
 +
* [[Legacy:Animation Replication|Animation Replication]]
 +
* [[Legacy:Another Look At Replication|Another Look At Replication]]
 +
* [[Legacy:Replication Examples|Replication examples]]
 +
** [[Legacy:Replication Examples/Battle City|Replication Examples/Battle City]]
 +
** [[Legacy:Replication Examples/Giant Spider Execution|Replication Examples/Giant Spider Execution]]
 +
 
 +
==External Links==
 +
* [http://unreal.epicgames.com/Network.htm Networking Architecture] by Tim Sweeney himself.
 +
* [http://unreal.jall.org/tutorials/replication.html Replication De-Obfuscation] by Mongo (28-12-06, local copy : [[Legacy:Replication De-Obfuscation|Replication De-Obfuscation]])
 +
* [http://unreal.jall.org/tutorials/guidedripper.html Guided Ripper Tutorial] – A UT-based tutorial describing the pitfalls of creating a weapon that works not only offline.
 +
* [http://www.members.shaw.ca/gswilson/Simple2.zip Networking Sample] by GW
 +
* [http://www.members.shaw.ca/gswilson/SimpleB.zip Another Networking Sample] by GW
 +
 
 +
----
 +
 
 +
[[:Category:Legacy Tutorial]]<br />[[:Category:Legacy To Do]] &ndash; This needs merged into the grand topic of [[Legacy:Replication|Replication]]. See [[Legacy:Replication/Discussing|Replication/Discussing]]
 +
[[Category:Legacy Tutorial|{{PAGENAME}}]]
 +
[[Category:Legacy To Do|{{PAGENAME}}]]

Latest revision as of 04:13, 7 December 2008

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