How to network a 2D Card game?

Hi Good day,

I made a 2D playing card game in Unity and would like to make it a multiplayer game using Photon. I have been following various tutorials on Photon and has started making the Multiplayer version of the game. I made the UI for the multiplayer lobby system. Since my game is a 2D playing card game there wont be any player movement. I made two scenes one for the Lobby and one for the game. When the game starts the Deck is shuffled and both players receive 6 cards each and the game play goes from there based on the decisions of the players. In my game I use a Raycast to select cards with the mouse. My UI for the game has one player info at the top with his hand leaf cards, score, games won etc and the other player own is at the bottom.

I have a card object, a deck of cards object and a player object as prefabs. I have a photonView on each of the three including the Game Manager object. The deck Object can shuffle and kick card. When use PhotonNetwork to Instantiate the and Kick a card at the start of the game. The game scene keeps reloading continuously and the kick card changes with each reload of the scene. When I use the lobby system and loag the game from it with only one player the scene is as I want it but once two players are loaded from the lobby into the game then it continuously reloads.


Is there a way to stop the game scene from reloading continuously and stay in the scene?

Any suggestions/help in going about implementing my card game as Multiplayer will be greatly appreciated.

I am new to Photon and is not sure what is happening and if I am approaching this the correct way. I have searched for multiplayer play card tutorials with photon and hasn't found any. So am looking for suggestions on structuring a 2D playing card game with Photon.

Answers

  • Hi , why your game scene is reloading continuously , you need to show your code for that . I dont think you need photonview for a turn based game . Try raise event from photon
  • I changed to photon 2 and the reloading has stop. My game has a deck which has to be inatntiated on each client then Shuffled on the master and sync to the other client so that they both have the cards in the deck in the same order so when the top card is kicked it is the same kick card for both players. What is the best way to Sync the deck to achieve this?

    I have been using RPC but cant sync the deck class. I am told I need to register a customtype with photon so that I can sync it. How does one resgister a CustomType?