Is It wise to have Timer In Actor That Gets Set on HasAuthority()?

Hello,

I am sort of confused about this, since I just started learning networking.

What I am doing is I have Created An Actor (Control Point) and On Begin Play I check if ROLE_Authority and if that is true I set a Timer Loop (1 sec In-Rate).

What that timer calls is a function that basically Increments the Score depending Upon Which Faction has More Units in the Control point.(Box Component)
BTW I haven’t Set the Function I Call, Server, Reliable or anything like that, It runs as expected both on clients and server, so I never bothered to try marking it ServerOnly etc.

Is this good or I am doing a bad practice somewhere, even though all this is working just as I want it to but That 1 Sec Timer I think can be a bad practice I don’t know what to do.

If you want that timer to affect other clients as well, call that Timer functions on the Server, moreover you can use replicated variable properties of the Unreal Multiplayer system. ROLE_Authority comes true on client possessed pawn

Hi Fieol,

No I think replicating how many players are inside a control point is not really necessary since I already have another variable that fills the Capture Bar which depends on a replicated value.

As of now my Timer function only works on Server and it does all the calculations there about how many Players are in the Control Point, What should be the colour of progress bar depending on the dominating team etc every thing is done on server. Only thing that gets replicated is a struct that I marked Replicated and it contains Linear Color and a Float value that passes to all the clients and it is what they use to update their Widgets.

the thing that worries me is the frequency which my server calls this function and as its result it modifies the struct which is replicated. its current In Rate is 1 sec.
Is there any more bandwidth efficient way to do this? Or replicating struct each second isn’t really a big deal?