Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: dahmedsamir on December 20, 2018, 10:36:54 AM

Title: switch player in multiplayer game .
Post by: dahmedsamir on December 20, 2018, 10:36:54 AM
hello ,
i am trying to create a multiplayer strike game .
one player shoot a ball and the other one control with a goalkeeper then changing rolls .
my problem is as i want when player who controls striker and shoot a ball after that he control the goalkeeper with the second shoot while the second player is shooting , then at third shoot he control the striker and so on .
i tried several methods but cannot do that .
any help for me .
Title: Re: switch player in multiplayer game .
Post by: jeanfabre on December 21, 2018, 01:53:16 AM
Hi,


--- first option

what you need is separate Input from players.

 each Human player will be represented in your logic by a network object that is just taking the inputs, that's it.

then your game is instanciated various characters, that accepts inputs from these network object, and you will link them together dynamically, using RPC to call for a connecting like : player 1 input take controls of Character X

then, each instance across the network, can adjust to that.


your characters can be network instances too but as scene objects.

-------- second option

switch ownership. I assume you use Photon, in photon you can request ownership. and so you can change the owner basically. however this ca be tricky especially if players disconnects, if you are currently owning an object that was not yours, and if the original owner disconnects, that object disappear. you can however create just scene objects to solve that.

Bye,

 Jean