- Home /
Need help with having random generation on object sync'ed across multiplayer game
Working on a 2 player card game using Unity and Photon. Player 1 and 2 generate their hand from a list of cards randomly. I have it so that when a player plays a card, it is synced in the game.
The problem is that player 1's hand is not the same between clients. I have a RPC on their photonview and is using that, but each player is randomly generating these cards, and it is not the same between the clients.
I also updated the OnPhotonSerializeView to send and receive the players hand, but that doesn't work.
Answer by Jordash · Oct 25, 2018 at 02:56 AM
You can:
A) Have a server generate the cards and send the generated cards to the players
B) Have one player generate cards for all players then send them to each player
C) seed the random object
rnd = new Random(newSeed);
Be careful with this though, the seed will need to be shared but if you do not make unique seeds you might see identical decks across games