Game Development Reference
In-Depth Information
The Pulse runtime needs a unique game ID for each game, as many games could be
hosted on a single server. This ID is also used by the server to match up other players
playing the same game. It means players of jigsaw will not be able to go into a room
that is playing tic-tac-toe.
Overriding the initNetClient method
A factory object must be created as shown below. The factory class is one of the
classes that are created for us during code generation. The m_netClient is a
protected property of the parent class PulseGame.
import tictactoe.gsrc.client.GNetClientObjectFactory;
protected override function initNetClient():void {
var factory:GNetClientObjectFactory;
factory = new GNetClientObjectFactory();
m_netClient = new GameClient(factory, this);
}
This (m_netClient) is the main API class through which we send all the game states
to the server, which are then broadcast to all the players in the room.
We will also override two more methods, one for the game screen where the tic-tac-
toe game will be played and the other for the new game screen where a new room
will be created by the player.
protected override function initGameScreen():void {
m_gameScreen = new TictactoeGameScreen(this);
m_gameScreen.init();
}
protected override function initNewGameScreen():void {
m_newGameScreen = new TictactoeNewGameScreen();
m_newGameScreen.init();
}
 
Search WWH ::




Custom Search