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"

Local Mutiplayer - Index/refrence

I am creating a local multiplayer game in which players can play split screen using one PC/Console with multiple controllers for different players. (Xbox 360)

So far I have a Game Mode BP which i have created players and them possessed that player using the player character index of 0 & 1 as shown below. This works fine for spawning 2 characters that control separate on different controllers. from this I've tried to make a variable that sets in different characters using "Character ID" as reference to which player it is.

alt text

I am then referencing this variable in the character's and other Bp's to reference different controllers and there corresponding pawn/character. Below i am trying to use the ID number to set up different colors for different players eg. Player 1 = green Player 2 = Blue and so forth.

alt text

Please help me if i am creating/ referencing players wrongly. I am new to setting up multiplayer and need help on how start creating referencing for local multiplayer.

Many Thanks Harrison Lee

Product Version: UE 4.11
Tags:
more ▼

asked Sep 02 '16 at 12:17 PM in Blueprint Scripting

avatar image

Hraxzy94
60 11 12 15

avatar image mightyenigma Feb 10 '18 at 07:52 PM

I need a better understanding of this as well, as I am combining splitscreen local with networked multiplayer.

avatar image Exonfluxx Feb 10 '18 at 08:04 PM

I am missing something here. whats not working ? is the color not applying ?

Can you tell me what is not working I don't seem to be catching on here.. sorry

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

1 answer: sort voted first

Engine creates 1 player out of the box so by calling "Create Player" you are creating 2nd and 3rd player, so there is already player with id 0. By looking on engine code:

https://github.com/EpicGames/UnrealEngine/blob/dbced2dd59f9f5dfef1d7786fd67ad2970adf95f/Engine/Source/Runtime/Engine/Private/GameInstance.cpp#L509

If you input ID 0 that already exist the creation of player would fail and you would get error in logs. Try using Set PlayerControler ID insted which has code that swaps IDs between them, but keep in mind you still gonna have extra PlayerController.

Note that you don't need to use ID system if you have static number of players, you can just keep them in variables.

more ▼

answered Feb 11 '18 at 12:20 AM

avatar image

Shadowriver
35.2k 921 166 1098

avatar image mightyenigma Feb 11 '18 at 12:59 AM

Thank you @Shadowriver. That makes things a little more clear. The link you provided results in a 404 for me. would I be able to look at the GameInstance source code without downloading the source code version of Unreal?

avatar image mightyenigma Feb 20 '18 at 01:10 AM

Question: Why are you using your own ID variable instead of the built-in Controller ID that comes with each player controller? There's nothing wrong with that approach but there might be some confusion if you were to set two things to the same ID, which I think the engine does not allow on its built-in controller ID (does it swap them if you try?), except for network remote controllers which all have the ID -1.

(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