Spawn multiple player controllers in multiplayer game

If you want to make a 4 player multiplayer game, then I assume that you want to do that over network with multiple pcs where everyone is playing his character he sees/focuses on. The only other way I can currently think of is some sort of local multiplayer where you fight with or against your buddies on a couch or something while everyone is holding a unique controller/gamepad to move and interact with his/her character on the screen.

If you want to do something over network, then you don’t have to worry about the number of controllers or alike. One player can serve as the listen server while playing. The server is locally controlled on the pc the game runs on. If you have an other computer connecting to this server, doesn’t matter if LAN or Internet/Steam, the engine itself will generate an additional player controller for the new player in the “PostLogin” Event. You can access this new player controller because in the event “PostLogin” the new player controller is an output pin.

Quote: “PostLogin - Called after a successful login. This is the first place it is safe to call replicated functions on the PlayerController. OnPostLogin can be implemented in Blueprint to add extra logic.”

So if you have only the server, there is only one player controller. If a client connects to the server, then there are two player controllers, the server and the client. And every new client will get their own player controller. So you will always have 1 player controller for the server and one player controller for each client who connected.

If you want to do a local multiplayer or so called “couch co-op”, you need to handle the indexes of player controllers inside of your game “somehow”. Why do I say somehow? Because I do not know everything and I didn’t do local multiplayer that much on one screen. But you should be able to create multiple player controllers, even of the same class, which get input from different peripherals, like keyboard, mouse or gamepads.