Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite 6
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions
  • Government

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / Adobe Connect Developer Center /

Building a multiuser Sudoku contest game using the Adobe Connect Collaboration Builder SDK

by Rajesh Kumar

Rajesh Kumar
  • connectusers.com

Content

  • Game overview
  • How the game works
  • Where to go from here

Created

17 January 2011

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Adobe Connectcollaboration
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

Prerequisite knowledge

Knowledge of ActionScript 3 and Flex is required to make the most of this article.

 


Additional required product:

Adobe Connect Collaboration Builder SDK

User level

Intermediate

Required products

  • Flash Player 10.1
  • Adobe Connect (Download trial)

Sample files

  • multiuser-sudoku.zip (596 KB)

In a previous article, I described a simple multiuser snake and ladder game that I built using the Adobe Connect Collaboration Builder SDK. That article showed you how to synchronize SWF files that are loaded into Share pods in Adobe Connect meeting rooms using a Flex component included in the Adobe Connect Collaboration Builder SDK. This capability makes it easy to build multiuser games in which the SWF applications communicate with one another. In this article, I describe Sudoku Contest, which, unlike the snakes and ladders example, supports more than two players.

Sudoku Contest is a multiplayer game in which each contestant receives the same Sudoku puzzle that is generated by the host. The host has the ability to stop the contest (after a sufficient amount of time has elapsed), broadcast the solution, and end the contest.

Game overview

After uploading the SudokuContest.swf into a Share pod, the host generates a Sudoku puzzle by clicking Generate Sudoku (see Figure 1).

The host clicks Generate Sudoku to start the game.
Figure 1. The host clicks Generate Sudoku to start the game.

The Sudoku puzzle is then presented to all meeting attendees, including the host. Once a user solves and submits the puzzle, the user's name, result, and elapsed time is added to a data grid, which is visible to all attendees. After an attendee has submitted a solution, his Sudoku puzzle panel will be disabled. The host can stop the contest at any time by clicking the Time Up button, which disables each contestant's Sudoku puzzle panel. The host can also broadcast the solution to all contestants.

How the game works

The Sudoku Contest game was written completely in ActionScript 3, making use of the Collaboration Builder SDK to synchronize events.

As with the snakes and ladders game, I loaded SyncConnector.swc—a Flex component that enables synchronization of multiple SWF files—as a library in Flash Builder and added it to the application.

To access the Collaboration Builder SDK API from an application, you need a SyncConnector instance; for example:

<components:SyncConnector id="sudokuConnector"/>

The application uses sudokuConnector, an instance of SyncConnector, to communicate with other application instances.

On creationComplete, the Sudoku Contest application adds event listeners for the CAUGHT_UP and SYNC_MSG_RCVD events:

syncConnector.addEventListener(SyncSwfEvent.CAUGHT_UP,<caughtUpHandler>); syncConnector.addEventListener(SyncSwfEvent.SYNC_MSG_RCVD,<syncMsgRcvd>);

You may recall that every application that uses the SyncConnector component goes through a catch-up phase when it is loaded into a Share pod. This phase allows new attendees to receive the accumulated state of the application. After all messages are received, SyncConnector dispatches a CAUGHT_UP event.

The CAUGHT_UP event handler can perform any operations that are required immediately after the SWF loads (as long as they do not need to dispatch any sync messages). In this application, for example, the handler ensures that any new participant entering the room is shown the current puzzle if a contest has already started.

The SYNC_MSG_RCVD event handler is invoked when events are received. For example, in Sudoku Contest, this event handler is invoked when a new puzzle is generated and sent to the attendees. When the host clicks the button to generate a Sudoku puzzle, the application creates a random puzzle in the form of a 9 × 9 matrix (see Figure 2). This matrix is dispatched to all the attendees using the dispatchSyncMessage API of the Collaboration Builder SDK:

sudokuConn.dispatchSyncMessage("sudokuGenerated", Sudoku, false);

It is received by all the contestants in the SYNC_MSG_RCVD handler, syncMsgRcvd(evt:SyncSwfEvent). For example:

if (evt.data.msgNm=="sudokuGenerated"){ Sudoku=evtData.msgVal as Array; currentState="contest"; ..}
The puzzle is a 9 x 9 matrix. View larger
Figure 2. The puzzle is a 9 x 9 matrix.

Each client uses the matrix received in syncMsgRcvd to create and display the puzzle.

When a contestant completes the puzzle and submits a solution, it is evaluated on the client side and the user's information is added to the DataGrid component, which is also synchronized across all attendees. When the host selects Broadcast Solution, the correct answer will be revealed to all attendees (see Figure 3).

The application uses states to manage the different views. The main screen, for example, is different for the host and participants. The code checks sudokuConn.role and sets the value of currentstate appropriately:

if(sudokuConn.role=="owner") currentState="host"; else currentState="participant";
The host can click Broadcast Solution to reveal the puzzle solution to all attendees. View larger
Figure 3. The host can click Broadcast Solution to reveal the puzzle solution to all attendees.

The data grid displays information on any contestant who has submitted a puzzle solution. Each participant must have permission to publish his or her information before calling dispatchSyncMessage:

dispatchSyncMessage: sudokuConn.allowParticipantPublish("gridObject", true); sudokuConn.dispatchSyncMessage("gridObject", obj, false);

The Flex DataGrid component can be easily sorted by elapsed time to identify the winner. When the host clicks End Contest, the game is over (see Figure 4).

The "Thank you" message is displayed after the host clicks End Contest.
Figure 4. The "Thank you" message is displayed after the host clicks End Contest.

Where to go from here

The current version of Sudoku Contest has just one level of difficulty and supports only 9 × 9 puzzles. One possible enhancement is to allow the host to select easy, medium, and hard puzzles as well as use a bigger matrix.

If you have not already done so, you may want to read my companion article, Building a multiuser snake and ladder game using the Adobe Connect Collaboration Builder SDK.

See Using the Adobe Connect Collaboration Builder SDK 2.0 (PDF, 200 KB) for additional details, including instructions on how to test an application in Flash Builder without Adobe Connect 8.

To download the Adobe Connect Collaboration Builder SDK, visit the Adobe Connect Developer Center.

If you are interested in seeing the current state of the sample files I used when writing this article, send me an e-mail at rakumar@adobe.com.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

More Like This

  • Building a multiple-question survey application for Adobe Connect 8
  • Building a multiuser snake and ladder game using the Adobe Connect Collaboration Builder SDK
  • Creating a custom stamp for Adobe Connect 8
  • Saving data locally in a custom application for Adobe Connect
  • Integrating the Asterisk MeetMe audio conferencing service with Adobe Connect 8

Products

  • Adobe Creative Cloud
  • Creative Suite 6
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy (Updated) | Cookies

Ad Choices