Real-time Silverlight Tic-Tac-Toe Game
January 10, 2011
Above is an image of a real-time Tic-Tac-Toe online game being played in two separate browsers.
The game took about an hour to develop – this time will get shorter as the tools and libraries improve.
To play, open the “DemoBrowser” from the desktop context menu. Or evaluate:
TicTacToWindow openOn: ‘X’ channel: ‘my-channel’
Change ‘X’ to ‘O’ if needed; ‘my-channel’ should be a unique name for your game – all players in the game need to be on the same channel.
TicTacToeWindow uses the “Channel” class to send game state (as a Smalltalk Dictionary) to other players in real-time. The backend communications is handled by the ChannelAPI service of Google’s Application Engine and should be highly scalable.
The TicTacToeWindow class can be viewed in the ClassBrowser:
This is a pretty simple game, but it provides a good foundation for more complex board games like checkers, chess, GO, etc.
There will be more games, “social network” widgets, and business collaboration tools uploaded over the next week.