Title: GameNet_CoreGame
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER

Package | Class | Use | Tree | Deprecated | Index | Help |
PREV CLASS   NEXT CLASS | FRAMES    NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

gameNet_cloneable
Class GameNet_CoreGame


java.lang.Object
  gameNet_cloneable.GameNet_CoreGame


All Implemented Interfaces:
java.lang.Cloneable

public abstract class GameNet_CoreGame
extends java.lang.Object
implements java.lang.Cloneable




All of your MyGame classes must extend this abstract class. This implies that your MyGame class must have code for the abstract method: Process

Constructor Summary
GameNet_CoreGame()

Method Summary
java.lang.Object | clone()
abstract  java.lang.Object | process(java.lang.Object inputObj) The "process" routine must be present in your myGame class.
void | startGame(GameControl gameControl) You will override startGame if you need to send out output that was not the direct result of user inputs.

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

GameNet_CoreGame


public GameNet_CoreGame()

Method Detail

clone


public java.lang.Object clone()

Overrides:
clone in class java.lang.Object

startGame


public void startGame(GameControl gameControl)

You will override startGame if you need to send out output that was not the direct result of user inputs. For example you are creating a Pong game and you need to let everyone know the current location of the Pong ball. The normal things you might do in the startGame method:
- Since startGame is called just as the Server is up and running, this is a good place to start any threads.
- Secondly, it is good to save the address of the gameControl object. Whenever you want to send out updates that are not precipitated by a call to "process" (i.e. user inputs), then you can call gameControl.putMsg to send out extra updates to all of your clients.

Parameters:
gameControl - - If you need an instance of gameControl, you can override startGame to get a reference to gameControl.

process


public abstract java.lang.Object process(java.lang.Object inputObj)

The "process" routine must be present in your myGame class. Every time a client calls SendMessage through his GamePlayer class, the object sent is passed to the MyGame "process" routine.

Parameters:
inputObj - - Normally this will be cast to a MyUserInput. This is an object sent through one of the clients GamePlayer.sendMessage calls. MyUserInput must be Serializable.
Returns:
- "process" must return an instance of MyGameOutput. This class must be Serializable. A return of null results in nothing being sent. Any sent object is received in each of the Client's receivedMessage methods.

Package | Class | Use | Tree | Deprecated | Index | Help |
PREV CLASS   NEXT CLASS | FRAMES    NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD