How to Handle Card Dealing to players

Options
hey am kinda new to photon and networking am making a card game here but i can't find any info about how should i handle dealing cards to different players in the same room what i was able to find in terms of info is that i should use RPCs and make the master client do the dealing process ( maybe on start ) what i don't know is : 1- should i create a prefab for each player in the case of a card game or not and what should that prefab look like ?
2- should i instantiate my entire deck using photon instantiate or should i just keep my deck cards as a scene object with no owner and change their ownership as am dealing the cards ?
3- what does changing the ownership actually do ? do they stop the other player from seeing them or what ?
4 - how can i make each player see the back of the opponent's cards on the other side (to know how many cards he has)
any info or help would appreciated

Comments

  • Tobias
    Options
    For card dealing, it makes sense the clients only know their own hand, so it makes sense to do it from a central place. PUN can use the Master Client for this but this opens the door for cheating. It's fine for a hobby project but if you go competitive or have real money in the game, then use the Photon Server for this.

    You probably want to separate the simulation from the visuals here. When you do, you can use RaiseEvent to send which cards each user gets and the turns / actions everyone does with the cards. Where each card is / goes, could be part of the card's state and when a card is being played, send an event detailing (e.g.) "card X is played as Y and goes to Z position". Then any client can either show a short animation of this action or simply change the visuals to match the state.

    This is somewhat related:
    https://doc.photonengine.com/en-us/pun/v2/gameplay/rpcsandraiseevent