Talk:Everything you ever wanted to know about replication (but were afraid to ask)

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

Ah sorry for changing that i thought dynamic would make more sense and have still the same meaning so i dealt with it just like typos and adding categories to someone else his article. --Eliot 19:28, 13 August 2010 (UTC)

So if I get this right....

Ok if I understand this correctly:

1. The <uscript>replication{}</uscript> block is used to update variables on the client(s). When this happens, depends on the variable used in the if-statement (ie bNetInitial) surrounding the variable.

2. To execute something after a variable is updated, mark the variable for replication notifications using 'repnotify': <uscript>var repnotify int myRepInt</uscript> This calls the <uscript>simulated event ReplicatedEvent(name VarName)</uscript> function. <uscript>simulated event ReplicatedEvent(name VarName) {

   if(VarName == 'myRepInt')


3. If we execute a function on the client (function has to be marked simulated for this) and it needs to be done on the server aswell (to update/notify change to all others), we need a reliable (or unreliable if it's not that big of a deal if it doesn't happen) server function (containing the same logic as the client function). <uscript> exec setMyRepInt() {



simulated function initMyRepInt() {

   myRepInt = 10;
   if(Role < Role_Authority)


reliable server function serverInitMyRepInt() {

   myRepInt = 10;

} </uscript>

I hope this is correct and that if it is the code may enhance the tutorial/QA/overview of replication for others. —Preceding unsigned comment added by Omar007 (talkcontribs) 19:49, 12 October 2011

Yes, that's correct, but it's highly UE3-specific. In earlier engine generations replication of functions is specified in the replication block as well and repnotify/ReplicatedEvent() do not exist. —Wormbo 19:41, 12 October 2011 (UTC)

Yes that is true. I wrote this with the UDK replication syntax in mind as that is what I needed to know for sure ;)

Greatly appreciate you writing this document and confirming my verification question.

--Omar007 21:06, 12 October 2011 (UTC)

Name type

Is it just me doing something wrong or is the replicating of Name variable types not possible? When I send a Name variable from server to client the client may receive 'bTrackMouse' when the server actually sent 'foo', it seems that the engine just sends the name index instead of sending the new name string for the client to register to its internal Names list, either that or I am doing it wrong? --Eliot 12:31, 10 March 2014 (UTC)

Replicating names should work, as long as you don't use names from dynamically loaded packages or even names created at runtime. Names are just sent as name table index. —Wormbo 17:29, 10 March 2014 (UTC)
Thanks for confirming my suspicion Wormbo!, that explains why QueueAnnouncement works. --Eliot 18:50, 10 March 2014 (UTC)

Is a replicated function executed in tick?

I've been looking for this information for some time now, but can't find it anywhere. When a client calls the server with a replicated function, does the server immediately start the execution (ie: in a separate thread?) as soon as it gets the client's call, or does it wait for the next tick to execute the function?

If the function runs in a separate thread, is there any issue accessing and modifying variables? In general, is there any behavior that could cause problems and should be avoided in replicated functions? (should the function function be lightweight, with minimal impact? Or is there no real restriction?)

Thanks! --Benit2 (talk) 09:52, 30 September 2015 (EDT)

UnrealScript is strictly single-threaded. (There may be parallel physics updates in UE3, but I'm not sure if they would cause any asynchronous UnrealScript execution.) Replicated functions are executed when the receiving party polls the data during the connection tick, and thus run synchronously in relation to other UnrealScript functions on the executing client or server instance. —Wormbo 16:55, 1 October 2015 (EDT)
Thanks that pretty much answers my question. :) --Benit2 (talk) 12:41, 2 October 2015 (EDT)