Okay, I’ve made lots of single player games, both 2D and 3D and for my latest project I’m making my dream game. It’s a multiplayer card game using Lobby and Relay.
I’ve got my Lobby all setup and now I’m getting into the nitty-gritty netcode issues. I want the host to be the “source of truth” for all the cards. It’s a realtime multiplayer version of Solitaire (i.e. Dutch Blitz or Nertz) so it’s not turn-based.
A big part of the strategy is seeing the cards other players have on their Trading Pile and Discard pile so you can tell if they’re about to play something to the Clan Piles (i.e. the “foundations” in Solitaire) so basically, all the players need a real-time list of all the other player’s cards.
TL/DR
So when the game starts, I want the server to initialize the cards for all the players. I’ve defined a PlayerCards class as follows:
public class PlayerCards
{
public string PlayerId { get; private set; }
public Suit Suit { get; private set; }
public DrawPile DrawPile { get; private set; }
public List<Card> DiscardPile { get; private set; }
public TradingPile[] TradingPiles { get; private set; }
public CastlePile CastlePile { get; private set; }
...
}
I am hydrating that in my GameManager’s OnNetworkSpawn() method (for the host only) and I want to propagate it out to the clients.
I’m wondering the best way to do that? Should I use a ClientRpc method and setup a bunch of serialization? Or is there a better way? Thanks!