|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The GameImplementation interface needs to be subclassed in order to implement a concrete FRAG-based game. In order to start a new game on the FRAG framework, it is recommended to initialize a GameManager by using the GameManagerRegistry method createGameManager(..). After that the initialization of the concrete GameSetup implementation takes place. By using the setSetup(..) of GameManager, the GameSetup is associated to the GameManager. The PeerConnectionServer needs to be created by using the newPeerConnectionServer(..) method of GameManager. When this is done, the methods for the real initialization of the concrete game e.g. initGame(..) (for starting a new game without joining/loading) or loadGame(..) can be called. As the framework uses "events" to talk between components (diffrent peers, components on the local peer) to notificate or keep the actual state on all peers, let's take a closer look at this. The pattern used to realize this, is the Observer Pattern. Therefore a sender (source) of an Event needs to implement the EventSource interface. Every EventSource descendant needs to provide an EventDistributor where event listeners can register themselves. An EventDistributor handles a list of recievers and disributes events to all of them. To recieve events an object needs to implement the EventSink interface and register itself at the EventDistributor. An additinal utility is the EventDispatcher, which is an EventSource and EventSink. It is referenced from GameManager and is the centralized component, all events pass. To register object "tree" for sending events: +register the EventDispatcher from GameManager at the EventDistributor of the tree To register object tree for recieving events: +register the tree at the EventDistributor of the EventDispather from GameManager In the konstructor of GameManager GameManager and ObjectManager are registrated as EventSource and EventSink. Also a PeerConnection is registrated as both. $Id: GameSetup.html,v 1.1 2003/02/12 18:06:19 schoecke Exp $
Method Summary | |
void |
gameJoined(GameManager gameManager)
is called when the sombody joins to the game over the network |
void |
initGame(GameManager gameManager)
This code initializes the game |
void |
loadCharacter(GameManager gameManager,
java.util.Vector v)
loads a saved Character |
void |
loadGame(GameManager gameManager,
java.util.Vector v)
Method loadGame: loads a saved Game |
java.util.Vector |
saveCharacter(GameManager gameManager,
java.lang.String name)
saves a character |
java.util.Vector |
saveGame(GameManager gameManager)
Method for saving a game. |
Method Detail |
public void initGame(GameManager gameManager)
gameManager
- The instance of the GameManagerGameManager != null
GameManager
public void gameJoined(GameManager gameManager)
gameManager
- The instance of the running GameManagerGameManager != null
GameManager
public void loadGame(GameManager gameManager, java.util.Vector v)
gameManager
- GameManager is the already gameManager.v
- : this Vector contains the information in the same order, as it
has been savedpublic java.util.Vector saveGame(GameManager gameManager)
gameManager
- The instance of the running GameManagerpublic void loadCharacter(GameManager gameManager, java.util.Vector v)
gameManager
- The instance of the running GameManagerv
- The Vector contains the information in the same order as it
has been savedpublic java.util.Vector saveCharacter(GameManager gameManager, java.lang.String name)
gameManager
- The instance of the running GameManagername
- The nae of the character to save
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |