• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Creating a multiplayer client/server tic tac toe game

Joined
Jun 19, 2005
Messages
2,474
I wanna do this with either C++ or Java. I'm familiar with both but I wanna brush up on my C++ since it's been a while.

I never did GUI's in C++, nor have I done any client/server programming. So should I stick with a console program or maybe jump right into GUI's and client/server at the same time? Too much of an undertaking maybe? But I'm confident, so let's do it!

Where do I start? Any good client/server tutorials out there aimed towards the newbie? And what about GUI tutorials? Which libraries/frameworks?

I've made a single player tic tac toe before, but it was a console app and non-multiplayer. So this should be a good deal more difficult. I still wanna keep it basic though. One single connection to another computer in which each player takes turns clicking on the board to place X's and O's.

I'd appreciate some help and suggestions on getting started with this! Cheers! :)
 
Actually, if you coded the old part correctly, it shouldn't be much more difficult at all. You'll need to learn about things called "Sockets" for a simple implementation. if you want to get more sophisticated, you can also look into multi-threading.

i would use the language you are more comfortable in, not the one you want to "brush up on"

then once you have learned how to do this, you can port it to the other language.
 
I'm sure someone will jump and scream bloody murder at my suggestion but sometimes creating a very high level UML diagram, or even package diagram, can help greatly. By high level I mean don't bother defining every field and method, but rather just objects and their relation to one another.

I would also take MVC design into consideration.

I know people have mixed feelings on this but you could check out RMI. If nothing else it's a concept to understand / learn.

Also, keeping everything serverside would be a good idea. All of the logic which defines actions in the game. This will require more bandwidth but no one can log in with their 'special' client and destroy everyone.
 
I'm sure someone will jump and scream bloody murder at my suggestion but sometimes creating a very high level UML diagram, or even package diagram, can help greatly. By high level I mean don't bother defining every field and method, but rather just objects and their relation to one another.

Who would yell at you for this? Planning out a project before you start hacking classes and packages together is almost always a great idea. Like you said, you don't need to follow exact UML standards, but having some visualization of what depends on what will be very useful.


Edit: As for GUIs in C++ . . . check out "Win32 API Tutorial" or something similar on Google. If you want more portability, look into GTK or Qt.

Edit2: As for learning about programmin' client/server stuff, there's a nice (cheap!) reference book available called "Sockets in C." IIRC, it gives example client/server/maybe FTP/et cetera code, has nice explanations, is available at the big B&M bookstores (I picked mine up at Barnes and Noble), and costs $25 or so. Link

Edit3: That link has all the sample source code from the book! Maybe you won't even need to buy it ;). Good luck!
 
Last edited:
i coded tic tac toe in starcraft. You can never beat the computer in my map. It is multiplayer if more than 1 person is there.
 
Back
Top