Tic-Tac-Toe - Part 3 - Multiplayer, with a Lobby



Attached Files

The following files have been attached to this tutorial:



Download now 908.03 KB


Download now 175.5 KB


11,209 visits, 23,784 views



This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

eGame Event Sheet

There isn't much here. Since there isn't much interaction in Tic-Tac-Toe, the few user events just call functions on the eCommunications event sheet to send messages to the other player. TileHiliting and board-tile-presses are sent.


Communications are broken up into outgoing Commands, and incoming Messages.


CmdTileHilite() - this builds up a hilite message of the X, Y, and hilite value for a tile.

If the message isn't the same as the last one, we send the TileHilite message, store the message to compare against next time, and call HiliteTile() to hilite the tile on our side.

CmdMakeMove() - we send the message to the other player of the X, Y, and move(X or O), call MarkTheMove() to mark the tile on our side, and then check for a winner. If the game isn't flaged as over, call SwitchPlayer() to switch who's turn it is.

CmdRestart() - this just resets everything to start the game over. We flip who starts first, and send a Restart message to the other player with who moves first.


These match what we just covered, only when we are the "other" player.

"TileHilite" message - decode the parameters, and call HiliteTile().

"MakeMove" - decode the parameters and MarkTheMove() and check for game over. Switch players as appropriate.

"Restart" - set the first move ID and go to the Game layout.


  • Order by
Want to leave a comment? Login or Register an account!