Skip to main content
gamedev.net
🔒 Locked

Chess Server

Started by shoeb Aug 28, 2005 at 2:13 AM 1 replies 1.7k views
Original Post
shoeb
shoeb
hi guys I am making a Chess server in WIN32 API.I have almost completed the standalone version of the game i.e. you can play with yourself.All the constraints on the moves of characters are there.Now I want to implement the client server architecture i.e. two players on different machines can connect to the Chess server and play with each other. I need help in following : (1) I want to simulate the client server architecture on a single machine for testing purpose.Is it possible to run chess server and the client on the same machine ? (2)What is the best way to implement client server architecture in WIN32 API? I request all the geeks here to help me in this project
Fruny
Fruny
Quote:
Original post by shoeb
(1) I want to simulate the client server architecture on a single machine for testing purpose.Is it possible to run chess server and the client on the same machine ?


Yes, of course. Just use the 127.0.0.1 address (or your machine's actual IP if you know it).
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Padawan
Padawan
(2)
Use tcp/ip as it guarantees correct packet transmission and ordering.

Make a class that will serve as a connection router. I.e. it will be in the main thread and will listen to a given socket on a given port. Anytime it sees a connection, it should make new thread and bind a socket for it.

Then, think something about game class that will be created inside each new thread. This class must have methods to bind players/spectators to the particular game, to get, check and send their turns and turn reports (to prevent cheating).

Finaly, prepare connection router to enumerate and find free games (i.e. with just one player logged in). You also can let players to choose what games to connect to, between ones that are free.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.