I am starting to add multiplayer to my prototype and wanted to try a little around so I fired up a new C++ ThirdPersonTemplate and just wanted to mess around a little. The first thing I tried was printing a text if I am playing on the Server so I added the Tick() function to the C++ character and this 2 lines of code
I’ve found authority is a bit ambiguous. The client can seemingly have authority over some things and the server others… PERHAPS the tick function give the client authority? Just a guess…
But if that only servers could spawn replicated actors, maybe you mean:
1 - the client call some rpc on server that spawns the actor
2 then some code inside the engine understands this and puts this client having authority over the actor?
Clients can still spawn actors - but if they do, the actor will only exist locally and the Client will therefore have authority over it. They won’t be able to call RPC’s, since the actor only exists on their machine. There are many cases where a Client can have Authority over something, another example is if you “Tear Off” a replicated actor, Clients will then have Authority over their local instance of that actor once the torn off state replicates.
HasAuthority() simply means “I can do what I want with this actor” - it doesn’t neccesarily mean that actor is Server-Authoritative.
I had a similar issue and noticed I had my Editor set to Net Mode: Play As Standalone. Change this to Play As Listen Server and see if that fixes your issue.
I believe when you use Standalone all of the clients are simulated on the server which makes HasAuthority() always return true.
If you play in Standalone then there is no networked game - it’s like being a Server without any networking layer. Obviously in Standalone, everything is running on your local machine so HasAuthority() would always be true.
on cpp it’s deprecated, but it doesn’t say why.
i’ve remember having read a warning at some point in favor of IsNetMode instead of IsServer or somthing similar.
“Server” is usually ambiguous, with standalone, dedicated, and listen. but im not sure what it means on that function.
on cpp at least seems to rely on the net driver (iirc), and im not sure about the implications.
thanks, i already done that. that’s how i have that info.
what am i trying to achieve? like i said. detect when it’s server not only when it has auth.
but anyway i’ve already solved it with the answer i posted above.