You mention lot's of different Java technologies but I'm not sure this is the correct approach. Have you tried writing anything yet just to validate the moves? this is quite complex in itself - castling and en passant are moderately difficult to implement. Then you must decide how to communicate between processes - I'd suggest looking at xboard / winboard protocols. You probably want to store the moves and players in a database with a separate process looking for time outs etc. Then, before producing the front end, I'd have a good long think about whether your software will offer anything different from the various chess servers already on the internet - if it doesn't then you're going to be spending a long time writing something that no-one will use.marwen Bakkar wrote:So I'm writing a Chess matchmaking system based on a Lobby view with gaming rooms, general chat etc. So far I have a working prototype but I have big doubts regarding some things I did with the server. Writing a gaming lobby server is a new programming experience to me and so I don't have a clear nor precise programming model for it. I also couldn't find a paper that describes how it should work. I ordered "Java Network Programming 3rd edition" from Amazon and still waiting for shipment, hopefully I'll find some useful examples/information in this book.
Meanwhile, I'd like to gather your opinions and see how you would handle some things so I can learn how to write a server correctly. Here are a few questions off the top of my head: (may be more will come)
First, let's define what a server does. It's primary functionality is to hold TCP connections with clients, listen to the events they generate and dispatch them to the other players. But is there more to it than that?
Should I use one thread per client? If so, 300 clients = 300 threads. Isn't that too much? What hardware is needed to support that? And how much bandwidth does a lobby consume then approx?
What kind of data structure should be used to hold the clients' sockets? How do you protect it from concurrent modification (eg. a player enters or exists the lobby) when iterating through it to dispatch an event without hurting throughput? Is ConcurrentHashMap the correct answer here, or are there some techniques I should know?
When a user enters the lobby, what mechanism would you use to transfer the state of the lobby to him? And while this is happening, where do the other events bubble up?
Input is greatly appreciated. Thanks!
Screenshot : http://goo.gl/pYqM3
Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
Mich Robinson wrote:I'd have a good long think about whether your software will offer anything different from the various chess servers already on the internet - if it doesn't then you're going to be spending a long time writing something that no-one will use.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |