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"

Calling CreatePlayer (Blueprint) on client leads to bug

I would like to support combined local and remote multiplayer. If I call "CreatePlayer" on the client side (HasAuthority remote) this leaves a mess. It does create a new character, and yes, this character can be controlled using a gamepad on the client. But on the server side, suddenly the second gamepad also works and I can control a second character on the server (which is actually a client character). It seems like an additional "local" controller is also created on the server, which is a bug, because there is still only one local player on the server.

How to reproduce: Connect two gamepads. Use third person blueprint template, create some spawn points, map the character jump action to "has authority - remote" and then "CreatePlayer". Run the game in client/server mode with 2 players (in two windows).

Then select the client window and press the jump button (for the client). This creates an additional player.

Afterwards, you will be able to control 2 players both in the client window and in the server window, which is wrong. It should only be possible in the client window.

In order to phrase a proper question: How do I create an additional local player for correct use with remote multiplayer?

Product Version: UE 4.13
Tags:
more ▼

asked Nov 11 '16 at 11:36 PM in Bug Reports

avatar image

lotodore
216 9 16 22

avatar image lotodore Nov 12 '16 at 02:53 PM

Actually, the same issue occurs if I call CreatePlayer on the server. It seems that CreatePlayer currently does not work in a "remote" multiplayer environment. It leads to the client being able to control a server character.

avatar image Sean L ♦♦ STAFF Nov 17 '16 at 03:17 PM

Hey lotodore,

I've spent some time working on this, but I'm not seeing the same results. It could be that there is a slight difference in our setups. As a result, I have a couple of questions.

Could you provide a screenshot of the blueprint that you are using for Create Player?

Also, how are you handling your character input in your game? Is this issue only occurring when using a controller for input?

Thanks!

avatar image lotodore Nov 17 '16 at 08:02 PM

Hi Sean,

sorry, my bad, the "steps to reproduce" did not work because I made other changes which I did not write down.

After retrying I have narrowed the issue to the following problem: If I run "CreatePlayer" on the client and then run "GetControlledPawn" on the return value, it contains nothing. This actually caused the issues I had because of the way I posessed the characters after spawning. Afterwards I just got desparate trying different things, which is why my bug description is so bad. Sorry for not providing proper steps to reproduce.

Here is an example blueprint to show that GetControlledPawn returns nothing (use third person template):

CreatePlayer

Here are the settings I am using to start the game in the editor: Play Settings

The issue is: I don't know which character I just locally spawned on the client. If I react to some event, this may be some other remote character joining.

I need to know "this" character which the client just spawned because I need different implementation for local and remote characters.

Please let me know if you can reproduce this issue.

avatar image Sean L ♦♦ STAFF Nov 22 '16 at 09:23 PM

Hey lotodore,

Honestly, this is something that I'm not sure works the way that you're looking to set it up. I'm going to spend some time looking into the issues and discuss it with our developers to see if I can determine if there is, in fact, a bug here or if there is an alternative solution.

I appreciate your patience.

avatar image lotodore Nov 22 '16 at 10:17 PM

Hi Sean,

thanks for looking into this, as I still have not found a proper alternative way to deal with this. I have the option to store the returned controllers in an array and perform the character changes later, but that adds a lot of complexity for something that should be very simple. Also, I cannot even tell CreatePlayer which pawn class to use for spawning, so I cannot use some placeholder for local players and replace it later.

I would still say that after creating a player on the client the character should exist on the client, but well, I'm new to Unreal Engine...

avatar image Sean L ♦♦ STAFF Nov 28 '16 at 02:50 PM

Hey lotodore,

After spending some time testing this, I haven't been able to see the same results.

I think that it would be worth the time to look into this tutorial:

https://www.youtube.com/watch?v=ZOc9fV6Sap4&t=4392s

The tutorial goes through how to set up local multiplayer. Although I know you're looking to modify the setup slightly by adding networked multiplayer to it as well, if you can get the initial setup down I think that it will resolve your issue in your multiplayer project.

Let me know if after running through the tutorial you're still having the same issue, and I'll be glad to continue investigating.

Have a great day

avatar image lotodore Nov 30 '16 at 08:36 PM

Hi Sean,

I have watched the tutorial you mentioned and also watched the whole Blueprint Networking series https://www.youtube.com/playlist?list=PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ and the original Blueprint Networking Introduction https://www.youtube.com/playlist?list=PLZlv_N0_O1gYwhBTjNLSFPRiBpwe5sTwc

There are no hints about combined local/remote multiplayer in any of these tutorials, except in the one you pointed to, but this is only an answer at the end which says "yes this is possible".

I also wrote a request for help in the forum and got no response. It seems that this is something very uncommon in Unreal Engine.

The problem I have is that CreatePlayer, if run on a client, returns a new controller but does not yet associate a pawn with it. Instead, it seems that it tells the server to spawn a pawn which then replicates and later appears on the client. This makes CreatePlayer behave very differently on client and server, so it feels like a bug. If pawn creation is delayed, CreatePlayer should e.g. have a delayed pin which returns after player creation is complete, so that the pawn can be accessed.

avatar image lotodore Nov 30 '16 at 08:49 PM

Just in case: If you try to reproduce, make sure you are using the "remote" pin on the "Switch Has Authority" in the upper screenshot.

avatar image Sean L ♦♦ STAFF Dec 15 '16 at 07:36 PM

Hey lotodore,

Sorry for the delay. At this time we believe that the issue you are describing is not actually a bug with the Unreal Engine, and so we are not able to take any further action on this. If you still believe this may be a bug, please provide steps for us to reproduce the issue, and we will continue our investigation.

At the current time, we do not have the resources to allocate to investigating the issue without a clear way to reproduce it, as the current steps were not getting the same issue on my end. If you'd like to provide a project that showcases the issue, I'll be glad to try to look into it. You can PM me a link to Drive or Dropbox through the forums: https://forums.unrealengine.com/member.php?160394-Sean-Flint

Have a great day!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I've spent a lot of time to find a workaround for this issue. Basically, one could state that this is "working as designed" but the design is very bad imho.

The solution is, basically, the following: If you need to run CreatePlayer on a Client (which is connected to a server), simply do not use the return value. Instead, use some kind of player activation based on the local player id in BeginPlay of the Controller.

more ▼

answered Jan 30 '17 at 08:48 PM

avatar image

lotodore
216 9 16 22

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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