views:

49

answers:

2

i am designing a card game.. multiple clients will connect to a single server object. should i store the instance variables in the protocol or the server object?

A: 

If you consider only the cheating point of view, remember the adage: never trust a client for something which should be calculated by the server.

Damien B
A: 

I think you want the server to keep track of the total game state, and let the each client keep track of what is relevant/known to the individual player. This will reduce cheating, and the server can enforce other game constraints. It will also cut down on bandwidth. The disadvantage is that the server may require a lot of memory, but this seems mostly hypothetical, as it will probably want to maintain state anyway to ensure everything in the game is consistent. Or if not, why isn't the game just peer-to-peer, with a server to introduce peers to each other?

Paul A Jungwirth