Network Replication...?

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Network Replication...?

Postby Allan » Fri Jun 30, 06 3:33 pm

I've been beating around the bush here for a while now, like nearly everyone who's bothered to sign up to this part of the forum. Yet there is one aspect of scripting I cannot ever get my head around. Network Replicaion... :evil:

I mean, how are you supposed to tell what kind of replication you need for the variables? I find it an impossibility!

Here's some example of what I mean:

Code: Select all
//
// network replication
//
replication
{
    // server to client
    reliable if ((Role == ROLE_Authority) && (bNetOwner))
        ClipCount, bZoomed, bHasSilencer, bHasLaser, ModBaseAccuracy, ModReloadCount, ModAccurateRange, ModReloadTime, ModRecoilStrength;

   // Things the client should send to the server
   //reliable if ( (Role<ROLE_Authority) )
      //LockTimer, Target, LockMode, TargetMessage, TargetRange, bCanTrack, LockTarget;

    // Functions client calls on server
    reliable if ( Role < ROLE_Authority )
        ReloadAmmo, LoadAmmo, CycleAmmo, LaserOn, LaserOff, LaserToggle, ScopeOn, ScopeOff, ScopeToggle, PropagateLockState, ServerForceFire,
        ServerGenerateBullet, ServerGotoFinishFire, ServerHandleNotify, StartFlame, StopFlame, ServerDoneReloading, DestroyOnFinish;

    // Functions Server calls in client
    reliable if ( Role == ROLE_Authority )
      RefreshScopeDisplay, ReadyClientToFire, SetClientAmmoParams, ClientDownWeapon, ClientActive, ClientReload;
}


Any help on this issue appreciated =)
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Dae » Fri Jun 30, 06 4:23 pm

I'm not a specialist in replications (thats a question to Nobody), but in theory, replication just tells how and which variables should be synchronized between server and client machines.
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby MainMan » Fri Jun 30, 06 5:00 pm

I'm no expert on this, but I do know quite a lot.

Role == ROLE_Authority means commands that are called from the server, to the client. For example, things affecting how the player performs basic actions (on his side) are normally Role == ROLE_Authority.

Role < ROLE_Authority means (literally) "less than role_authority". It is the opposite; commands called from the player to the server.
Functions where the player affects the whole server, (or other players as a whole) are normally Role < ROLE_Authority.




In the example you have used, from DeusExWeapon, you can see that things on the player's side, are all Role == ROLE_Authority (called on client), such as the clip count, and the accuracy. This is because they do not directly affect anyone - they only affect things through another function. (e.g. some fire function checks the accuracy, and uses it like that)

All the things that are Role < ROLE_Authority directly affect the entire server, such as whether the player is reloading, or a bullet effect is being spawned, or if a laser is activated.




Reliable means that the function must be carried out.

UnReliable means that the function is called once, but it may not be performed, due to lag, or whatever. This cuts down on network load.




Hope this helped
<center>ty m7
</center>
User avatar
MainMan
<i>Tru' Playa' Fer Defs</i>
 
Posts: 4655
Joined: Sun Jun 05, 05 7:38 am
Location: London, UK

Postby Allan » Sat Jul 01, 06 6:48 pm

Thanks =) That's really helpful =D
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 53 guests