Client/Server Design Concept

Discussion about everything. New games, 3d math, development tips...
Post Reply
nebukadnezzar
Posts: 25
Joined: Tue Dec 02, 2003 7:45 pm
Location: Germany - Bornheim

Client/Server Design Concept

Post by nebukadnezzar »

I want to code a turnbased Card Game and i don't know how i should make my client/server design.

First of all This is my first question:

Should only the server calculate the game and send the info to the clients to show it. And the clients are only sending the commands to the server.
Or should every client calculate the game and if there are differences the server decides?
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

I'm not exactly sure what you mean by calculations, but if you mean things like randomizing the deck...

Send a seed that you will generate the deck "shuffle" to the clients. The clients would both randomize off this seed and therefore the deck would be in the same order on each client.

This would take a burden off the server, but be slightly less secure as someone could change the memory or the key and get their deck randomness out of sync.

The server could then verify the order when the clients draw. (if you want it to be that secure)
Crud, how do I do this again?
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Re: Client/Server Design Concept

Post by rt »

nebukadnezzar wrote:I want to code a turnbased Card Game and i don't know how i should make my client/server design.

First of all This is my first question:

Should only the server calculate the game and send the info to the clients to show it. And the clients are only sending the commands to the server.
Or should every client calculate the game and if there are differences the server decides?
it would depend on what kind of game you are creating.. for you case it will not require blazing speed so i would suggest letting the server do all the work. for example, the server would randomize the deck and then when a card is dealt it would send a CARD_DEALT packet to each client specifying which card was dealt and who it was dealt to. if the client wants to do something it should first send it to the server and if the action is allowed, then the server will send it back as a command packet such as PLAYER_RAISED_BET($50,playerid=2)

for realtime games like UT where you want to reduce lag a much as possible it doesn't matter if the client is out of sync for an update or two, so long as the server corrects it later.. but in realtime games like CLONES the clients can never ever be out of sync so a method like i proposed above is more suitable

as for security, you could perform a simple XOR on all network data using a randomized number from the server to protect traffic from sniffers. you could also compress the traffic with zlib for more protection 8)
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

rsa for strings!

Post by buhatkj »

i found and adapted a simplified form of RSA encryption for this same purpose. i havent integrated it in yet because i haven't tuned it for speed yet, but for a card game...no biggie eh? here is a link to the file from fmorg that contains this:http://buhatkj.dyndns.org:4242/tempfiles/fmorgUtils.h
hope it's of use :-)
-Ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
nebukadnezzar
Posts: 25
Joined: Tue Dec 02, 2003 7:45 pm
Location: Germany - Bornheim

Post by nebukadnezzar »

I have done an essay ("facharbeit" in german) in school about RSA and i think it is not very suitable to be effective in network.
because it increases the amount of data to transmit and takes a lot of cpu-time
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

your prolly right..

Post by buhatkj »

yeh you are probably right about this, the routine i have is reasonably fast but under high load or on a slow network its overkill. as rt said above a simple XOR with a "key" of some kind is prolly good enough. all the same it only sorta half-assed rsa, so it may be a bit faster.
-ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Post by rt »

nebukadnezzar wrote:I have done an essay ("facharbeit" in german) in school about RSA and i think it is not very suitable to be effective in network.
because it increases the amount of data to transmit and takes a lot of cpu-time
I wrote an essay on RSA and quantum computers back when i was an undergrad student :D read it at the bottom of this page http://www.tomkorp.com/clones/links.asp
Post Reply