Spawn multiple player controllers in multiplayer game

Dimensionite
Sat, 11 Mar 2017 01:01:23 +0000
Multiplayer & Networking

Hi,

I’m trying to use a custom controllers to control different players in a multiplayer game. Here is the part where I get the player and attach to this controller. It works fine when number of players is 1, but as soon as there are 2 or more players in the game, there are multiple instances of player character but there is only 1 instance of player controller. Hence theoretically there is only 1 character that is getting controlled. But all characters are still receiving control mechanics from this custom controller. Basically I want the game to spawn controllers where the amount is the same as the number of players in the game so that each controller is controlling one player character.

@anonymous_user_3cd4384c Thanks for your reply! I am aiming for multiplayer game over network, and I just checked that there are 2 player controllers on server and 1 on client, meaning they get spawned correctly. Those are some actions that I would like the character to do when certain inputs are received.

The problem is those inputs will be received and actions will be made by controllers to characters, but when I exit the game I will receive those errors, indicating me that Cast Player which is the character reference is None. Since all character actions are in controller blueprint, I will need character reference to apply actions to.

[This is the video][4] I followed on creating custom controller, it works fine for 1 player, but if there are more than 1 players, the error messages above will show up. I modified my “Getting player character reference” part a little bit which is the first image of this thread. How am I supposed to modify my controller so that it works with multiplayer games? Thanks a lot!

13 posts - 4 participants