PDA

Click to See Complete Forum and Search --> : Chessgame?!


persian_83
Apr 29th, 2003, 09:36 AM
ChessGame.Questions.Part1.ShowDialog


hello,

I'm writing a client/server chess game application ( of course 2clients play against eachother), i'm finished with the parts that have to do with chess, its working fine , but i had some big architectural questions, i'm new to programming so i have no idea what to do.

The clients connect to the server using TCPCLIENT, so here are my first set of questions

Proccessing:
Should i put the main proccessing on the
client side app, and just use the server to transform
data and keep state? how do they usualy do it? like
for example in yahoo!games
DataTransoformation:
1)If the proccesing is done on the client, the data
transformed each time is just going to be 2numbers
(initial and final position of the move )

2) if the proccessing is done on the server(as it is
now) :
the server before each move, gets all the boxes
that can be moved in the next turn , and where they
can be moved, how do you guys suggest for
transfering the data to the client? ( this info is
stored in a dataset on the server, for each game)

*** I'm trying to make the game work like Yahoo!Chess Game, its a multitable game, and clients can play or watch others playing, know i'm still working on vb applications, and dont know anything about web development, but later i want to put the game up on the internet, so while answering my questions, please have that in mind, thanks allot


ChessGame.Questions.Part1.Close

Cander
Apr 29th, 2003, 09:42 AM
The server should only take the data from a client and pass it around to the other clients. The client should be the only thing processing that data. The only real processing the server needs to do is to determine who should be getting the data.

Like client1 makes a move. Your client app sends a chunk of data that may be something like

"BlackPawn1:A5"

Server gets that, determines who the other player is, then sends that exact same data to the c lient. then the client can parse that out and know to redraw the chess board by placing BlackPawn1 into square A5.

Cander
Apr 29th, 2003, 10:28 AM
Depends on how efficient your code is, internet connection speed, and clients computer speed. Ther is no simple answer to that question. You can process and redraw the chess board in the blink of an eye. But you still are constrained to the possiblty of slwoer internet connections making one client wait for the other.

persian_83
Apr 30th, 2003, 12:25 PM
okay, so now that the server is gonna pass around the data, what do you think is gonna be the fastest way to save and retrive the state of the clients on the serever? database, xml ?

the for thing that is going to be saved for each connection is ,
*ID
*Connection Object(each user has his object, to send and receive
* Table ID (integer)
* Stat in table (3choices, White, Black,View)

Cander
Apr 30th, 2003, 12:32 PM
just use collections. You can keep track of what socket each player is on, his username, ip address, a unique number that signifies what chess game he is in, or anything else you may need. When the server recieves data from soemone in chessgaem '3' for example, you can loop the collection looking for connected player that are also in chessgame '3', then send the data to only them. This is what I did in a chat application I wrote in VB6. I used collections to keep track of who joined what chat room, so that when someone was in chat room 'A', their chat text wouldnt go to other users in different chat rooms. Only to those in room 'A'.

persian_83
Apr 30th, 2003, 02:04 PM
what kind of collection should i use? i just know about the hash table which only has 2 columns, pleaze tell me the collection that suites this program , so i can go read about it
thanks,

Cander
Apr 30th, 2003, 02:51 PM
hash table. You make a class that holds the different properties you need to store. The use the class as the object for the hash table.