Download

Really stupid MP setup question...

I keep seeing in all of the tutorials and forum posts, etc that I need to do this that or the other from the server to the client, or the inverse. Mostly this all makes sense, but the issue I’m having is…

How do I know when something is running on the server or client?

Is everything that comes from a PlayerController considered a client even it it’s the player that is on the server?

Is anything placed in the world and running logic considered to be on the server?

If a PlayerController calls a function from the GameState, is that the client calling it or is it the client requesting the server to call it?

There’s about a million other similar permutations of those questions, but it seems to be all an extension of one simple misunderstanding. How do I know if it’s the server or client?

There is a few nodes that will help you determine if the Server is running some Logic or the Client.

Take a look at the HasAuthority node and the accompanying Macro SwitchHasAuthority.

You will see that it returns a Boolean depending on if the Server is running the logic or the Client.

I recommend you do some research into which Class types run where. For example, the GameMode only exists on the Server and Clients cannot directly access it.

I begin learning MP last week (if i say something incorrect someone warns!). It cost me a bit but I think I’m beginning to understand concepts

Like DevilsD Gamemode run on server always. That class only exist in server. That mean you not need user “Switch Authority”.

In the others YOU MUST select where to run the logic in server or client with “Switch Authority”

If you not use “Switch Authority” in you logic (example playercontroller) both the client playercontroler and server playercontroller will run that logic.
That mean if you “PlayerController”-> “Event Begin” -> “Print String” -> “hello” you will see Client1: Hello and Server1: Hello

If you want call a function from client to the server you must change that function to “Run on server” , same server->client “Run on client”