Caucho Technology

hmtp sudoku demo


HMTP Sudoku Demo

Sudoku Demo Whitepaper

Files in this tutorial

Auxillary files

resin-web.xmlConfigures the environment
flash/build.xmlBuild file

Introduction

This example shows how to create an interactive Flash game using the Caucho BAM architecture. The game we will create is an interactive version of Sudoku in which two players compete on the same board at the same time to fill in the most number of correct squares.

Our example application has two main components: the server and the client. The server is constructed in Java while the client is in Flash/Flex.

Flash client

Game layout
        <mx:Panel title="Caucho Sudoku" id="panel" width="500" 
          paddingTop="20" paddingBottom="20" paddingLeft="20" paddingRight="20"
          horizontalAlign="center">
          <mx:VBox id="layoutBox" horizontalAlign="center">
            <sudoku:BoardComponent id="boardComponent" 
                                   scoreBoard="{scoreBoard}"
                                   infoLabel="{info}"/>
            <mx:Label id="info"/>
            <sudoku:ScoreBoard id="scoreBoard"/>
          </mx:VBox>
        </mx:Panel>
      

Embedding the client in a page using PHP

Java Server

SudokuService

The SudokuService is a BAM agent that manages players and matches them up in games.

The client's representative on the server: SudokuAvatar

The SudokuAvatar is a BAM agent that represents the player on the server within a certain game. In other words, there is one SudokuAvatar for each player, for each game. The SudokuAvatar is also responsible for routing message from the client agent to the game and vice versa.

Glossary

BAMBrokered Agent Messaging - an architecture in which agents send messages and queries to one another. The broker handles the routing of these messages.
HMTPHessian Message Transport Protocol - the underlying wire protocol on which BAM is built.

Copyright © 1998-2012 Caucho Technology, Inc. All rights reserved.
Resin ® is a registered trademark, and Quercustm, Ambertm, and Hessiantm are trademarks of Caucho Technology.