I'm writing a card game in Swift. The idea is to make it work on the Apple Game Center framework. I've noticed an issue which I am not sure how to address.
- I need the current game data to be the same for all players.
- There are 6 players in the game.
- There is a deck of 30 cards, they are shuffled.
- Each player must have the same deck of cards (post-shuffle).
- 6 cards are presented to the "table" one at a time (animation).
There are also other activities that a player does that are outside the bounds of this question.
My question is this;
How do I give each player the same shuffled deck of cards?
There are a couple of options I can think of, but perhaps none of these are the best way; hence my question
- The start player is the
hostcreates the shuffled deck, and this deck is sent to other players (ie: JSON); in short all activities are facilitated through him.
The problem with this is that the start player could lose internet, abandon the game or all sorts?
So I don't think this is a viable solution
- There is a middleman, the server.
There is a "lobby" (waiting area) There is multiple games. The game has players. An AI-bot could be used to fill in abandoned players
But wait, does this then mean the server shuffles the cards and sends the same data to all players and makes the players "thin clients"?
Can Apple's Game Center handle this for me?
I'm not sure about the best solution for this?