You are probably familiar with the common game of tic-tac-toe. For this chapter I have created a version of the game that can be played by two people over the Internet (or a network). As you probably already know and should, by now! a game that can be played in this way is called a multiplayer game. Tic-tac-toe is played on a simple board (or a piece of paper) that displays a 3-by-3 grid. Each player has a letter that he or she can place in a grid space; this is usually either X or O. After a move is made, the other player can then make a move. The winner of the game is the first person to establish a horizontal, vertical, or diagonal straight line of three of the same letters. If the board is filled and there has been no match, then there is no winner of this game but the game is over. Here is how a game of multiplayer tic-tac-toe would typically be initiated and played. There are at least two people in a room in the chat. One of them decides to challenge another. The challenge is made by clicking the user name in the user list. Let's call the challenger Player 1. The person who was challenged, Player 2, can then either accept or decline the challenge. If Player 2 accepts the challenge, then both players are immediately taken to the game screen. When both players get to the game screen, they are prompted with a pop-up box that tells them the game has begun. Player 1 is informed that it is his turn, and Player 2 is informed that it is her opponent's turn. To move, Player 1 must click any of the nine tiles. When he does this, the letter X appears in that spot, and Player 2 is informed of this move. It is then Player 2's turn, and she can click any of the remaining eight tiles to add an O. The first player to establish three of his or her own letters in a vertical, horizontal, or diagonal straight line wins the game. When the game has been won, a pop-up box displays a little message telling the players if they have won or lost the game. If the board is filled and no one has won, then the game ends in a tie. In this event, a pop-up window tells both players that the game has no winner. Either player can restart the game by clicking the Restart button at the bottom-right part of the screen. When a game is restarted, the board is reset so that it contains no letters, and Player 1 gets the first turn again. There is a chat window on the screen so the players can still chat. One of the toughest things to do in a multiplayer game is to find room on the stage for the chat window. In tic-tac-toe this is not an issue, but in many games it can cause layout problems.
|