Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Designing a 2 player Tictactoe

  1. Jan 29, 2008 #1
    Hi everyone,

    I have to design a distributed game of Tic Tac Toe. I have to basically write what would be a good way to design this, but I really don't know much about this stuff, I'd be grateful if some of you could give me some design ideas.

    Thanks in advance.
     
    Last edited: Jan 30, 2008
  2. jcsd
  3. Jan 29, 2008 #2
    A great, and easy to use, program is Gamemaker. If you pay $20 for the registered version you can get even better stuff. Anyways, its easy to use, fun, and can include programming in the reg. version. There is also very simple graphical programming, done by dragging icons for commands into position.
     
  4. Jan 30, 2008 #3

    -Job-

    User Avatar
    Science Advisor

    The interface is basic. The functionality is simple turn based action. The only design consideration is in the networking/communication side. For anything multiuser you always have the options of using client-to-client connections or server based. Unless the players are inside the same local network i would go with server based because Firewalls and NAT usually get in the way (you see this alot in P2P apps).

    For a server based tic-tac-toe i would have it be web-page driven - not required but there are no disadvantages. Use a server-side technology like PHP or ASP for the server, or build a game server with JAVA/C/C++, or use existing servers like the Flash Communication Server (if you're using flash at the client).

    For the clients, since the game is so simple, i would use javascript with AJAX or possibly Flash to make a more appealing interface - no Java. Silverlight is now also an option - very much like flash but simpler - it's XML based.

    The javascript/flash/silverlight client, running on a user's browsers connects to the server. The server keeps track of users and game tables. When two users are joined in a game the clients use AJAX (or the flash xmlSocket/loadVars depending on implementation) to query the server every x seconds to get any new messages from the other user, or the other user's game move, or to check if it's the user's round yet. When a user makes a move, the client tells the server what the move was, the server keeps the move in memory and passes it to the other client whenever it does the next of it's x-per-second queries. And so on.
     
    Last edited: Jan 30, 2008
  5. Jan 30, 2008 #4

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Good lord, -Job-, that's incredible overkill.

    An hour with Python and Tkinter or wxPython would be more than enough to write a basic networked tic-tac-toe client. No need for a server or database engine...

    - Warren
     
  6. Jan 31, 2008 #5

    -Job-

    User Avatar
    Science Advisor

    Multiuser? With a client-2-client connection you'll have firewall and NAT issues. For example if you're within your University's network and would like to play a game with someone on the exterior. How do you suggest you get around this without getting into more complex programming or using an existing server or P2P framework (like JXTA)? As far as a multi-user game goes web-based is actually the simpler option - a little bit of Ajax and PHP/ASP and you have a fully working solution.

    I bet i could put together a multiuser tic-tac-toe in Ajax/ASP faster than you can write it in Python and it would be more compatible and accessible.

    It may sound like overkill - but if you're doing this with the purpose of learning then there's no sense in taking shortcuts.
     
    Last edited: Jan 31, 2008
  7. Jan 31, 2008 #6

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Well, -Job-, he didn't tell us anything about his intentions -- particularly whether or not he intended the program to be able to be used across firewalls or NAT. :rofl:

    - Warren
     
  8. Jan 31, 2008 #7
    Seriously, check out gamemaker, with the registered version you can make multiplayer games, even network or peer to peer type.
     
  9. Feb 1, 2008 #8

    -Job-

    User Avatar
    Science Advisor

    Why would i not mention firewall/nat issues when someone asks specifically on the design aspects of a multiplayer game as simple as tic-tac-toe? Should i have focused instead on how big the cells should be, or how to draw the window?
     
  10. Jun 13, 2008 #9


    Hello, Job!!! I'm from Kazakhstan!!!
    I'm writing network game, like tic-tac-toe, called Points. The game technology works like you written above. (I use php, JavaScript and Ajax). Can you help me how to keep data in the server side.
    I'm looking forward hearing from you!!!
    My e-mail is saule2007@gmail.com.
     
  11. Jun 16, 2008 #10
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Designing a 2 player Tictactoe
  1. Design Patterns (Replies: 2)

Loading...