I made the famous game Scissors, Paper, Rock as console application. The game runs great ... Now I want to make it a bit more advanced and allow 2 clients/users to play against each other from different locations. I checked few tutorials on sockets and networking, and in them they have a field "for multiple client" and when I check that part the pseudo code just shows new thread for each client. For my game with 2 clients, do I need to use that? Also, should I put the game code on the server and only ask the user for an input or proccess everything at the client side and send the server information just to take desicion on who wins and reply back with the winner's name

Recommended Answers

All 2 Replies

Client-server automatically needs multiple threads. No matter how you do it at the very least you will be waiting for the local user to do something and simultaneouly waiting for the other user to do something.

If you want to extract maximum learning from this I'd set it up as a server that handles multiple (pairs of) clients - that's more like real life serverland. I would put the game code on the server and only ask the user for an input - the server knows both user's input but each user only knows their own until the result is published.

Thanks JC, got all I wanted to know

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.