Could you please allow, in BP, several players to control a single character in local coop, on a single screen, using either keyboard, or keyboard + mouse, or keyboard + mouse + gamepad, or several gamepads.
Here is an example of practical application - a tank with several turrets, each controlled by an different player, while tank movement is controlled by another player (player1 controls movement, player2 controls main turret, player3 controls machinegun, etc.).
I’m under the impression that this is already quite doable.
Suppose you want several players to control a Pawn, instead of possessing the Pawn and handling input in it, handle all input in the PlayerController. All playerControllers will have a reference to the same Pawn, and they will bind their input to this Pawn’s movement function. Nobody would “Possess” the Pawn. Here’s some pseudocode :
All you need to do aside from that is to assign the reference to that Pawn to all PlayerControllers on BeginPlay or something. That should do the trick
This whole concept of Pawn possession in UE4 is often advertized as the only way to handle input in the engine, but I think that’s a bit unfortunate. That notion has bothered me for a long time, because it didn’t seem architecturally sound to me (at least not for a general game engine). I’m pretty sure this is part of what makes people say “unreal engine is only good at making FPSs”. More people should know that you can handle input in PlayerController too, which, in my opinion, makes a LOT more sense in many cases (in an RTS, for example. Or any game where you don’t have a specific character, really).
This seems doable, even with blueprints.
Getting all input in the player controllers, and just forwarding to the controlled object seems simple, assuming you have a good way to find the special controlled object from each player controller.
If that didn’t work, I would try to make multiple pawns; one for each turret, etc.
Then, when spawning the vehicle, I’d “attach actor to component” for each of the individually controlled pawn actors.
Then, I’d make sure that each player controller possesses a separate one of those pawns.
There may be some rule that forbids separately possessed pawns to be attached together, so it’d be an interesting experiment to try