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"

How to Make One Controller Possess Two Players?

Hello!

Now here is the situation. In game mode blueprint, with Event Begin Play I create a second player. The ID for new controller is "-1" which is what the random number for "Create Player" node. (Making the ID 0 breaks everything)

What I need to do is, I need to assign my default controller to this newly created player aswell. I am creating a local multiplayer game where two players use one keyboard.

At the moment I fix my problem by casting to player characters in the game during the game time to tell them what to do, for example input A makes player one move while input B makes player two move because I cast to them during that time.

I believe this is a dirty way to fix as the game automaticaly creates 2 controllers even only one of them, the first one is being used. And I got 2 player starts. Here is the situation:

Controller 0 is created. His mood : =D I am doing everything yay! Controller 1 is created because "Create Player" node in gamemode blueprint says so. His mood: =| U wot mejt.

I tried to fix this by telling Create Player node in gamemode blueprint to assign the controller 0 to it aswell, but this makes things goes mad. It seems Player 0 loses the controller by this way. At the moment I got a second controller that I want to get rid of, as it does nothing at all.

As I checked the answerhub, spawning controller actor doesn't work. I am not on my computer right now so I can't check it. :(

Long story short, how can I make one controller posses two players at the same time?

Thank you for your time and reading!

Product Version: Not Selected
Tags:
more ▼

asked Apr 03 '15 at 03:40 PM in Blueprint Scripting

avatar image

Achilleon
767 38 33 69

avatar image PeterLNewton Apr 03 '15 at 03:59 PM

Hi Achilleon,

By putting -1, you imply you want the next free ControllerID to be used. When you specify, it actually takes that controllerID if it is available. Which 0 by default is taken.

When input is captured by an Actor, for example the Controller. It is consumed by this Actor, and other actors in the world cannot receive direct input. The way I resolved this was similar to what you did, On Event Tick for the other actors I wanted to control. If I were to change it now, I would have the events from the PlayerController call specific functions within the Actors I wanted the PlayerController to manipulate.

Hope that helps!

Peter

avatar image Achilleon Apr 03 '15 at 05:38 PM

Hello Mr Peter,

This, as you said sounds reasonable. Maybe the Engine is not ready for this, or it's not designed to have one controller for two or more, though the paragraph in this link that I will show says otherwise.

https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Controller/index.html

" By default, there is a one-to-one relationship between Controllers and Pawns; meaning, each Controller controls only one Pawn at any given time. This is acceptable for most types of games, but may need to be adjusted as certain types of games - real-time strategy comes to mind - may require the ability to control multiple entities at once. "

It says it is possible.. in a quite tricky way. The paragraph is like a beautiful girl winking at you but wrapping her arm around another guy's belly right after. And it seems there is no information or tutorial regarding how to do it. :(

Just my two cents. I am planning to put something on Marketplace, a Fighting Game Template, and I would like it to be proffessional as much as it can. Having a controller that doesn't do anything is abit odd. What if this was a Real Time Strategy Game? Hundreds of controllers everywhere! D:

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

0 answers: sort voted first
Be the first one to answer this question
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