Download

Networking: getting clients to use server cameras position?

Hi Everyone,

I’m trying to figure out if I can use networking to get a UE4 level going in a cave 2 environment (it’s basically a huge wall of monitors in a big circle which are powered by a bank of computers).

My plan is to have a client playing on each of the slave computers in the network and one server running somewhere that they all connect with to get a camera position and rotation from, then each client would need to also apply a rotational offset to the camera view angle corresponding to their monitors position in the video wall.

So normal multiplayer works pretty much out of the box and I’ve figured out that I can use Set View Target with Blend to make a client use the server cameras position and rotation. The catch is I’ve only been able to figure out how to do it with Get Player Controller 0 and Get Player Controller 1 and apparently these only work on localhost but not over a network.

So I’ve been trying to figure out how to manage players when they connect with the following blueprint nodes:
573d492a063ff5a0a3fc8fd652341f57809f6ee1.png

But it’s not working :frowning:

I launch the server first with a batch file that says this:
“C:\Program Files\Unreal Engine\4.5\Engine\Binaries\Win64\UE4Editor.exe” “X:\work\USC\systems\UE4 cave prototype 3\caveTest3\caveTest3.uproject”?listen -game

And a client with a batch file that says this:
“C:\Program Files\Unreal Engine\4.5\Engine\Binaries\Win64\UE4Editor.exe” "X:\work\USC\systems\UE4 cave prototype 3\caveTest3\caveTest3.uproject"name=bob -game

When the client first runs I get a log message saying “Bob has joined the game”, but when I connect bob to the server by typing open 127.0.0.1 in his console, he connects to the server but the server displays the log message “257 has joined the game” (not bob). Then the server says the client should be set to the server view but it isn’t :frowning:

It’s a bit of a pain because if I can’t get this going I’m going to have to take the whole project back to Unity (there’s a special cave plugin for Unity that does this all automatically).

Any suggestions?

Bump.

(sorry, I really need help with this).

Doesn’t look like SetViewTarget is replicated. Also, PlayerControllers are not replicated between clients. So I’m not exactly sure how to do what you’re trying to do, but it may involve you having the server control some Actor (maybe a camera) who’s movement is replicated to all clients, then telling the joining client’s controller (through Client RPC) which Actor to follow, and then you have the RPC on the client side set the View Target. Does that make sense?

It’s a weird one because if I activate SetViewTarget with a keypress (on the server) it works (when I identify the clients using player index).

But yes, that makes sense and I’ll definitely give it a go :slight_smile:

Well it’s a listen server so it definitely works for the client that is doubling as the server. If it’s working for other clients, then I’m not sure.