x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Replicate fixed camera position

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

Here is a screenshot of my level blueprint. The "setCamera" event is set to multicast. alt text

Thank you very much for your help!

Product Version: Not Selected
Tags:
more ▼

asked Oct 13 '14 at 07:15 AM in Bug Reports

avatar image

mdreschert
11 2 3 5

avatar image eXi Oct 13 '14 at 07:23 AM

Hm just a thought, could be wrong.

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

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

avatar image mdreschert Oct 13 '14 at 07:45 AM

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

avatar image eXi Oct 13 '14 at 07:49 AM

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

avatar image mdreschert Oct 13 '14 at 08:30 AM

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

avatar image eXi Oct 13 '14 at 08:37 AM

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

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hey mdreschert,

You can try something like this:

alt text

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

Hope that helps!

more ▼

answered Oct 14 '14 at 09:29 PM

avatar image mdreschert Oct 15 '14 at 09:01 PM

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

avatar image jplanders Dec 12 '14 at 03:22 AM

I'm having the same issue as mdreschert here...

avatar image Ben Halliday STAFF Dec 24 '14 at 04:41 PM

Hey,

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

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

A safer way to do this that I just learned is to use the Post Login event in the 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 the Camera Actor in your level, and set the View Target for each player controller directly.

alt text

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

eventpostlogin.png (78.6 kB)
avatar image Suit and Tie Jan 06 '15 at 01:57 AM

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

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

Any idea what's going wrong for me?

avatar image Ben Halliday STAFF Jan 06 '15 at 09:05 PM

Either way, both methods would involve a delay because the 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 the Spectator Pawn as the default and then spawn in and possess new pawns after the controller has been created.

I'm not certain why the 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.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question