Ben
Ben

Reputation: 2578

Silverlight Game Logic on client side or on server side?

I am running into some problems right now.

I am developing a card game (Top Trumps) which is played by two players. I wonder how to best setup the architecture.

Right now almost all of the game logic is calculated on client side.

The game state is saved in a database table. The database is updated every second. But since two players are playing there are some problems. It's really hard to not run into problems with this approach.

Maybe it would be better to handle all the Game Logic on the Server Side with a WCF Service and just use the client side as a presenter. The WCF would handle all game logic, save/load the state in database and the two clients can ask for the game state which is sent via XML.

What do you think about that approach? How about performance? Or does somebody maybe know a better approach?

Thank you in advance.

Upvotes: 1

Views: 333

Answers (2)

Will A
Will A

Reputation: 24988

You should implement some of the state in both the client and the server - for example, a player can't lay down a card and then immediately lay down another card before the opponent has had a chance to play their card. You're right, though - much of the logic should be handled server-side with clients intermittently checking for updates.

Upvotes: 1

tdammers
tdammers

Reputation: 20721

Game logic on the server is the only way to prevent cheating in any effective way. Never trust a client.

Upvotes: 3

Related Questions