- Home /
Turn based multiplayer problem
Hi,
Im working on a multiplayer chess type game. I have a Game Manager script which creates the game objects for each client, Im using the Photon API. Each game piece has a script attached to detect when the player clicks on the object, the problem is, the other client can also select and move the objects created by my/local game manager, how can I block this.
Tks
Answer by Kiloblargh · Jul 09, 2013 at 09:41 PM
You have to distinguish between local and remote pieces somehow. I don't know anything about Photon because I am targeting mobile and don't have Unity Pro- I'm just using RPCs- but the way I did it was tag local units with the "LocalUnit" tag and remote units with the "RemoteUnit" tag.
Only the ones tagged LocalUnit are selectable, the GameController moves the remote ones when a move order is received. I have them set up as belonging to two lists whose index numbers match. So when I tell allMyUnits[n] to do something, I also send a message to the other player's GameController that then tells allYourUnits[n] to do likewise.
Answer by JACLEMGO · Jul 09, 2013 at 09:49 PM
Hi Kilo,
Thanks for the response, I just found the solution.
if(photonView.isMine)
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
(C#) Help with Multiplayer Features - Photon Unity Networking 0 Answers
Photon - How to name a player? 0 Answers
How to get all created rooms and join any one of them in PHOTON 2 Answers
Photon: Storing map data for persistence - what's the best way do to this? 0 Answers