Simple Chat with Adobe AIR using GameClientSDK Communication API


This is a very simple chat application developed using the GameClientSDK.
There are 2 important components here:


<Communication:ServerCommunication id="client" GuestLogin="true" ExpansionID="TestExpansion" ConnectNow="true" />
and
<Rooms:Room id="room" ServerComm="{client}" RoomID="AnyRoomName" onRPC="this.textChat.text += event.RpcParameters.FetchParameterValue('userName') + ': ' + event.RpcParameters.FetchParameterValue('chatMessage') + '\n'"/>
We only write one actionscript function to handle the enter event of the textinput. Here we send the text to people in the room.
protected function OnEnter():void
{
var params:ParameterCollection = new ParameterCollection();
params.AddParameter("chatMessage",this.textInput.text);
params.AddParameter("userName", this.client.LoggedInUser.UserName);

this.room.MakeRoomRPC("anyfunction", params);

this.textInput.text = "";
}
You can view the source codes here.
You can test the application here.

Card Game Toolkit



We designed generic card and chip components for people who would like to develop card games. Combined with the GameClientSDK you could easily design multiplayer card games like Texas Hold'em Poker. These components can be used with Adobe Flex to speed up game development.

You can right click and see the source code of the application.

You can download the Card Game Toolkit here.

Hello World



This is a very basic "Hello World" application. Click right button to see the source codes.


For the full screen version click here.
To download the source codes click here.

As you can see it is very easy to communicate to the server with just 2 components. (ServerCommunication and Room)
<Communication:ServerCommunication id="client" onConnected="OnConnected(event)"
ExpansionID="TestExpansion" />

<Rooms:Room id="room" ServerComm="{client}" onRoomJoined="OnJoinedRoom(event)"
onRoomLeft="OnLeftRoom(event)" onRPC="OnRPC(event)" RoomID="HelloWorldTestRoom" />
Below you see the code where we handle some events raised by the room component.

import Lib.Communication.ParameterCollection;
import Lib.Communication.Events.RPCEvent;
import Lib.Communication.Events.RoomEvent;
import Lib.Communication.Rooms.Room;
import Lib.Communication.Events.CommunicationEvent;
import Lib.Communication.Events.ServerEvent;

protected function ApplicationComplete():void
{
this.client.Connect();
}

// Server event handlers
protected function OnConnected(event:ServerEvent):void
{
this.client.LoginUser("guest", null, null, null, null);
}

// Room event handlers
protected function OnJoinedRoom(event:RoomEvent):void
{
this.textPublic.text = event.UserName + " has joined.\n" + this.textPublic.text;
}

protected function OnLeftRoom(event:RoomEvent):void
{
this.textPublic.text = event.UserName + " has left.\n" + this.textPublic.text;
}

protected function OnRPC(event:RPCEvent):void
{
this.textPublic.text = event.RpcParameters.FetchParameterValue("userName") + " said \"Hello World\".\n" + this.textPublic.text;
}

// Button event handler
protected function btnClick():void
{
var params:ParameterCollection = new ParameterCollection();
params.AddParameter("userName", this.client.LoggedInUser.UserName);
this.room.MakeRoomRPC("HelloWorld", params);
}


Note that proper namespaces should be included in the flex application tag.
Example:

xmlns:Communication="Lib.Communication.*"
xmlns:Rooms="Lib.Communication.Rooms.*"

These will be automatically added when you start writing code and don't copy and paste it.

Realtime Messenger with Adobe Air



Real-time messenger is a Windows AIR application. It supports the basic messenger functionality.

  • 1 - Lists online people

  • 2 - Opens a new window when double clicked on people

  • 3 - Chat windows show "writing a message" status message when other party is typing a message







You can check out the source codes online or you can download the project here.

Download the installation file

Warning: You need the Adobe AIR framework to run the installation file.