Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am making multiplayer (2 players) Minesweeper like the one that's available on MS Live Messenger.

Client side is going to be silverlight, server side will be MVC Application. Client (the one who is waiting for his turn) will poll server every X seconds to get current state, the other client (who's turn it is will post his click to server and than roles will reverse)

Now my question is: should domain model classes be the same for client and server side? I mean you need Minefield class on both sides, but while server-side class will have rules and logic, client-side will be more or less a data holder.

share|improve this question

2 Answers 2

I suppose you could use the same objects on the client side to represent the state of the "game board", but the client shouldn't need much more than that. When a player makes a move (clears a block), the client should only need to issue a command to the server (with the payload being the coordinates of the block to clear). The server could then process the move, and the clients would download the new game board state. The game board state itself should not contain any logic, so it could be quite appropriately used by both the clients and the server.

share|improve this answer

I know the question is kind of old but...

I've found that having a common DLL containing domain model classes is useful. The server classes inherit from these and add some logic. The client classes also inherit from these and add some animation data to them.

For network performance reasons I had custom serialization and deserialization routines in the common DLL as well. Deserialization took a factory as parameter such that new objects were of the server or client type depending on usage.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.