Networking

I’m trying to get some basic networking sorted and I must say its the most confusing thing I’ve ever had to do in unreal, the documentation is appalling and the video that always gets linked regarding networking in the 3rd person blueprint doesn’t even match up with current 4.11

88049-from+video.png

This is the shot of the custom event in the video (notice the Reliable Replicated From Client)

88050-mine.png

Mine; notice its competely different yet setup exactly the same as the server. Do I need to set something up change a setting, add a network custom event, also what does (if owning client/server mean) does that mean if I’m a server (how does know what it is) or am I the owning client (of what???, the blueprint?, the thing owning the custom event). I don’t mean to rant but every answer or forum post I’ve found seems to link a video that is no longer relevant (or appears to be) to the current version of the Unreal Engine.

88071-authority.png

Can someone please explain what this actually does, I assume you can make it so it follows a different route for each branch but does it get replicated.

I’m trying to have it so that an object is spawned, that object is then moved around the map and replicated to all the clients. I can make the server show it and I can make the client show it, but I cannot get the server to show the clients what I want. Am I missing something?

(if owning client) means this function will run on the server ONLY if the actor running that function is owned by the Client. Basically you can execute Run On Server events from you Player Controller, Player State, Player Character(only if it is possessed by your Controller) or from any component that is owned by any of these Actors.

88089-runonserver.png

Switch Has Authority will branch the execution flow based on the Network role of the Actor. If the Actor belongs to the Server (means if owned by the server and exists in server world) it will activate Authority Pin. Otherwise it will activate Remote Pin. This is the same as the below C++ code:

if (HasAuthority()) // or if (Role == ROLE_Authority)
{
    // Do server stuff
}
else
{
    // Do client stuff
}

But remember Switch Has Authority can get tricky. For example, if you call the node [TearOff][2] (from the server only) then all clients who got locally replicated copies of the Actor will take authoritative control over the Actor and will no longer replicate over the network. After this if you run Switch Has Authority on a Client it will activate the Authority Pin since this Actor is no longer replicated over the network and the client has full control over the Actor as if it was spawned locally by that Client.

If you want an Actor to replicate to everyone then it should be set to Replicate.

88090-replicates.png

Then you can Spawn this actor from an Event that is set to Run On Server and it will be replicated to all clients. Try calling it from you Player Controller.

Hope it helps :slight_smile:

I would really like someone to answer why

88161-capture.png

They are not the same yet I’ve created it exactly the same way from the video, has it been changed in 4.11 or do I need to do something to make it show that.

Seams like visual bug/changes. Doesn’t matter much.