Replicate fixed camera position

For my game I created a fixed camera and decoupled it from pawn. This all works well until I switch on networked play.
camera is only set on server but is not replicated to clients. How do I correctly set up camera position replication.

Here is a screenshot of my level blueprint. The “setCamera” event is set to multicast.

Thank you very much for your help!

Yes, but that is what I want. There is only one overhead camera everyone should use. With set view target with blend I position view on that cameraActor. This actor is an object in scene and should be available to everyone.

Hm just a thought, could be wrong.

Could it be, that you only replicate server camera position?

So all clients get server camera Position updated but not their own?
Like you told everyone that servers camera is at 0,0,0 but client cameras are at their own positions.

Yes and i think you just tell everyone that Server uses camera :X just a comment and a thought, not an answer.

Ah. Now I understand what you mean. So is problem Get player controller node?

Hm could be. I thibk about a method to get all players and changr THEIR camera. As far as i understand multicast, it just tell everyone that camera belonging to server is changed but their own camera stays same. Is there maybe a point Run on Client that you could use? :open_mouth:

Hey mdreschert,

You can try something like this:

problem is that you’re only setting camera for Player Controller at index 0, which is usually server. If your SetCamera Event is set to Multicast, then you can find how many players are in game (in this case I simply counted number of instances of MyCharacter there are) and then set each Player Controller to use same camera.

Hope that helps!

Thank you very much. Your solution works pretty good, but I have another problem now: Every client now sees only himself, not other clients. I am using third person template by way.

I’m having same issue as mdreschert here…

Hey,

Sorry for delayed response, I totally lost track of this one.

That’s an odd result of level attempting to run this before all Player Controllers have been created. simplest fix is to increase delay to 1.2 or 1.5 seconds or so, depending on number of players.

A safer way to do this that I just learned is to use Post Login event in GameMode BP. That event waits until all internal replication flags are set up correctly before firing, so it will wait until all players have player controllers assigned. Then you can use a Get All Actors of Class node to find Camera Actor in your level, and set View Target for each player controller directly.

Let me know if you run into any problems with either setup.

first solution with an extended delay semi-worked for me. I say semi because players will load with their default cameras, wait 1.5 seconds from delay node, and then camera will switch to what I have set in scene. This is obviously not ideal.

second solution with Post Login event in GameMode BP didn’t work for me at all.

Any idea what’s going wrong for me?

Either way, both methods would involve a delay because Set View Target with Blend cannot execute until all players have a controller assigned, and in a multiplayer game this can take time. You can use a loading screen or something similar to hide this, or use Spectator Pawn as default and then spawn in and possess new pawns after controller has been created.

I’m not certain why Post Login event isn’t working anymore… I’ll need to dig into that. It was working when I posted that image but apparently is not any more. I’ll let you know what I find.

Sorry to be 7 years late, but if what it is about is that all users preview a camera, then ideal would be for camera itself to speak to all users, simplest solution:

  1. Create a camera
  2. Edit that camera in Blueprint

In event chart put following blueprint and you’re done.

Now all users can see camera on map.

EDIT: Recommended, use a delay before target with blend

This helped Thank you!