How to Design a Distributed 2-Player Tic Tac Toe Game?

  • Thread starter FrostScYthe
  • Start date
  • Tags
    Designing
In summary, Job discusses the design of a basic, networked tic-tac-toe game, and how a basic understanding of programming would be enough to create one. He also mentions a possible game called Points, which uses the same technology.
  • #1
FrostScYthe
80
0
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:
Technology news on Phys.org
  • #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.
 
  • #3
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 a lot 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:
  • #4
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
 
  • #5
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:
  • #6
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. :smile:

- Warren
 
  • #7
Seriously, check out gamemaker, with the registered version you can make multiplayer games, even network or peer to peer type.
 
  • #8
chroot said:
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. :smile:

- Warren

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?
 
  • #9
-Job- said:
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.



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.
 
  • #10

FAQ: How to Design a Distributed 2-Player Tic Tac Toe Game?

How do you determine who goes first in a 2 player Tictactoe game?

The most common way to determine who goes first in a 2 player Tictactoe game is by flipping a coin or having each player choose a number between 1 and 10, with the highest number going first.

What is the most effective strategy for winning a game of 2 player Tictactoe?

The most effective strategy for winning a game of 2 player Tictactoe is to try to get three in a row while also blocking your opponent from getting three in a row. This requires thinking ahead and anticipating your opponent's moves.

How do you prevent the game from ending in a tie?

To prevent the game from ending in a tie, it is important to have a detailed algorithm for the computer to follow. This algorithm should prioritize winning and blocking the opponent over making random moves.

Can the game be modified to allow for more than 2 players?

Yes, the game can be modified to allow for more than 2 players by expanding the grid and creating more winning combinations. However, this may make the game more complex and time-consuming.

Is there a limit to the number of games that can be played before the computer becomes unbeatable?

There is no exact number of games that can be played before the computer becomes unbeatable. It depends on the algorithm used and the skill level of the players. With a strong algorithm and skilled players, it may take only a few games for the computer to become unbeatable.

Similar threads

Replies
9
Views
2K
Replies
1
Views
1K
Replies
5
Views
2K
Replies
5
Views
1K
Replies
195
Views
21K
Replies
1
Views
950
Replies
3
Views
3K
Back
Top