Journal of the Association for Computing Machinery at UIUC
foo
foo
[ Home ]

MacWarriors: Tic Tac Icon?

MacWarriors decided to pursue the Cheesiest Project Award with our EOH efforts this year: behold, Speech-activated Network Desktop Games! Actually, we're went for something that could be fun and educational for our members and also provide a few surprises for the EOH crowd. Curious? Stop by our booth in the DCL atrium tomorrow.

How did we do it, you ask? Well, most of what we used to create and run the project comes with every Power Mac, and the rest is freely available. (The only exceptions are Adobe Photoshop for graphics creation, which we chose over free alternatives just so things would look better, and some microphones from Radio Shack to better handle speech in a busy atrium.) The games and their network communication run in AppleScript, and speech commands are passed to the scripts through Mac OS Speech Recognition. We installed a couple of scripting additions to automatically handle a few things AppleScript can't by default, and our iMacs have a freeware patch to enable speech recognition since it's not yet officially supported.

The games were designed on a client-server architecture to allow ease of programming and expandability. One of our Macs runs server script-applications, each of which administers a game running on two client Macs. The server handles all the game logic--whose turn it is, the state of the game board, win conditions, et cetera--while the client script only deals with the placement of icons. We handle speech input by putting a bunch of simple script applications in the Speakable Items folder, where they can be run whenever the user says their name. As shown in the diagram, all the scripts communicate to make the game work.

Let's dissect TicTacToe as an example: When a game starts, the initiating client notifies the server, which initializes the game for both clients and establishes which letter each player has. Both client scripts and the server script sit idle until a player activates the "speakable" script indicating what move he wants to make. The speakable script sends a number representing its space (we numbered the spaces on the TicTacToe grid 1 to 9) to the client script, which encodes the number to identify itself (by adding 10 if it's player O) and sends it on to the server. The server decodes the position and player information from the number and verifies that the requested move is legal, then sends the number back to both clients. The clients each decode the number and use it to place the appropriate icons in their proper places on the desktop. Meanwhile, the server updates its grid to reflect the new move and looks it over to determine if the last move won or tied the game, in which case it would tell each client to notify the player and reset in preparation for another game.

Still want to know more? Our scripts, heavily commented, will be available from the MacWarriors home page soon after Engineering Open House.

MacWarriors is the ACM@UIUC Special Interest Group for Macintosh users, developers, enthusiasts, and fanatics. We meet every Saturday at 3 pm in the ACM office (1225 DCL).