playMaker

Author Topic: switch player in multiplayer game .  (Read 337 times)

dahmedsamir

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
switch player in multiplayer game .
« on: December 20, 2018, 08: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 .

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14703
  • Official Playmaker Support
    • View Profile
Re: switch player in multiplayer game .
« Reply #1 on: December 20, 2018, 11:53:16 PM »
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