1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

UE3 - UDK Are Timers server-side too?

Discussion in 'Programming' started by Salzel, Jan 8, 2014.

  1. Salzel

    Salzel New Member

    Joined:
    Sep 5, 2013
    Messages:
    5
    Likes Received:
    0
    Hello I have a couple questions I couldn't find info on, or at least not that I could understand completely.

    1. If a client does a default SetTimer with some time and some function call, is that timer sent to the server as soon as SetTimer is created too? Or is the timer just kept client-side and the activated function gets sent to the server after the client keeps track of the time.

    2. Does WeaponFiring() logic use time stamps like player movement? I'm guessing no because I haven't seen anything about it.
     
  2. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,913
    Likes Received:
    36
    Timers are entirely local. The engine does not apply any kind of replication to them. If you call SetTimer on the server, the timer will run on the server. If you call SetTimer on a client, the timer will run on that client.

    I'm pretty sure weapon firing is handled using replicated functions, but since they happen infrequently (compared to the regular movement updates), applying and verifying timestamps isn't worth the effort. In fact, as far as I can tell, the entire replication part for weapon firing seems to be implemented in UnrealScript using replicated functions.
    The exec functions for starting and ending firing actions are in the PlayerController, which doesn't apply any replication and passes them on to the Pawn. The Pawn also doesn't apply any replication and passes the events on to the active Weapon. Only there things start getting interesting. StartFire calls ServerStartFire if it executes on a client, then calls BeginFire. ServerStartFire is replicated to the server and also calls BeginFire. StopFire works similarly and most things inbetween are handled by timers that run independently on server and client, but use the same intervals.
    IMHO the UE3 weapon firing logic is actually relatively easy to follow, if you take your time to step from call to call. (Unlike UT2004 weapon or vehicle firing, which jump between UScript and native code at several points.)
     

Share This Page