org.starhope.appius.game.maze
Class MazeGame

java.lang.Object
  extended by org.starhope.appius.sql.SQLPeerDatum
      extended by org.starhope.appius.game.GameEvent
          extended by org.starhope.appius.game.maze.MazeGame
All Implemented Interfaces:
Serializable, Comparable<Object>, RoomListener, AcceptsMetronomeTicks, HasName
Direct Known Subclasses:
CastleDungeon, CastleJoustMaze, LavaMaze

public abstract class MazeGame
extends GameEvent

WRITEME: Document this type.

Author:
brpocock@star-hope.org
See Also:
Serialized Form

Field Summary
private  long nextCreateTile
          WRITEME: Document this brpocock@star-hope.org
private  long nextDestroyTile
          WRITEME: Document this brpocock@star-hope.org
private static long serialVersionUID
          WRITEME: Document this brpocock@star-hope.org
 
Fields inherited from class org.starhope.appius.game.GameEvent
freezeTag, gameCode, gameState, players, rooms, scores, scoreWatchRooms
 
Constructor Summary
MazeGame(Zone z)
           
 
Method Summary
 void acceptGameAction(AbstractUser u, org.json.JSONObject action)
          Broadcast message of a game action taking place
 void acceptOutOfBandMessage(AbstractUser sender, AbstractRoom room, org.json.JSONObject body)
          Accept an out-of-band communications packet that was broadcast to a room in which this Listener is listening.
 void acceptPublicMessage(AbstractUser from, String message)
          Accept a public chat message.
protected abstract  void addEntrance()
          WRITEME: Document this method brpocock@star-hope.org
private  void connectMazeRooms(List<MazeRoom> maze)
          WRITEME: Document this method brpocock@star-hope.org
private  void connectSpecialRooms(List<MazeRoom> maze)
          WRITEME: Document this method brpocock@star-hope.org
 void flush()
           
private  List<MazeRoom> spawnMazeRooms()
          WRITEME: Document this method brpocock@star-hope.org
protected abstract  MazeRoom spawnRoom(int i)
          new MazeRoom (getZone (), i); WRITEME: Document this method brpocock@star-hope.org
private  void spawnRooms()
          spawn rooms
private  void startMazeGenerators()
          WRITEME: Document this method brpocock@star-hope.org
 void tick(long currentTime, long deltaTime)
          This method is called periodically from the metronome thread.
 
Methods inherited from class org.starhope.appius.game.GameEvent
acceptCommand, acceptCommand, acceptGameStateChange, acceptObjectJoinRoom, acceptObjectPartRoom, acceptPublicMessage, acceptUserVariableUpdate, changeGameState, decrementScore, destroySelf, disconnect, equals, equals, getCacheUniqueID, getCountdownDuration, getEveryone, getGameCode, getGameDuration, getGameEventPrefix, getGameShortName, getLeaderBonus, getPlayers, getRoom, getRooms, getScoreWatchRooms, getSpectators, getTimer, getZone, hashCode, incrementScore, propagateGameStateChange, resetPlayers, sendEndEvents, sendStartEvents, set, toString, updateRoomVars, updateScore, updateScores
 
Methods inherited from class org.starhope.appius.sql.SQLPeerDatum
changed, compareTo, findInCache, get, saveInCache, set, toJSON
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.starhope.appius.util.HasName
getName
 

Field Detail

serialVersionUID

private static final long serialVersionUID
WRITEME: Document this brpocock@star-hope.org

See Also:
Constant Field Values

nextCreateTile

private long nextCreateTile
WRITEME: Document this brpocock@star-hope.org


nextDestroyTile

private long nextDestroyTile
WRITEME: Document this brpocock@star-hope.org

Constructor Detail

MazeGame

public MazeGame(Zone z)
Parameters:
z - WRITEME
Method Detail

acceptGameAction

public void acceptGameAction(AbstractUser u,
                             org.json.JSONObject action)
Description copied from interface: RoomListener
Broadcast message of a game action taking place

Parameters:
u - the sender
action - The game action. The verb is in action.getString("action").
See Also:
RoomListener.acceptGameAction(org.starhope.appius.user.AbstractUser, org.json.JSONObject)

acceptOutOfBandMessage

public void acceptOutOfBandMessage(AbstractUser sender,
                                   AbstractRoom room,
                                   org.json.JSONObject body)
Description copied from interface: RoomListener
Accept an out-of-band communications packet that was broadcast to a room in which this Listener is listening.

Parameters:
sender - The sender of the OOB message
room - The room in which the OOB message is being broadcast
body - A JSON object containing the OOB message. The contents of this message are not constrained.
See Also:
RoomListener.acceptOutOfBandMessage(org.starhope.appius.user.AbstractUser, org.starhope.appius.game.AbstractRoom, org.json.JSONObject)

acceptPublicMessage

public void acceptPublicMessage(AbstractUser from,
                                String message)
Description copied from interface: RoomListener
Accept a public chat message. This prototype does not specify the room, on the (potentially invalid) assumption that the room listener doesn't care from which room the speech was made.

Parameters:
from - The speaker
message - The spoken text or /emote
See Also:
RoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser, java.lang.String)

addEntrance

protected abstract void addEntrance()
WRITEME: Document this method brpocock@star-hope.org


connectMazeRooms

private void connectMazeRooms(List<MazeRoom> maze)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
maze - the maze rooms

connectSpecialRooms

private void connectSpecialRooms(List<MazeRoom> maze)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
maze - the maze rooms

flush

public void flush()
Specified by:
flush in class SQLPeerDatum
See Also:
SQLPeerDatum.flush()

spawnMazeRooms

private List<MazeRoom> spawnMazeRooms()
WRITEME: Document this method brpocock@star-hope.org

Returns:
the maze rooms in a list form

spawnRoom

protected abstract MazeRoom spawnRoom(int i)
new MazeRoom (getZone (), i); WRITEME: Document this method brpocock@star-hope.org

Parameters:
i - WRITEME
Returns:
WRITEME

spawnRooms

private void spawnRooms()
spawn rooms


startMazeGenerators

private void startMazeGenerators()
WRITEME: Document this method brpocock@star-hope.org


tick

public void tick(long currentTime,
                 long deltaTime)
          throws UserDeadException
Description copied from interface: AcceptsMetronomeTicks
This method is called periodically from the metronome thread. To save computation, it receives both the current time since epoch in milliseconds at the start of the global tick propagation, and the delta time since the previous metronome tick.

Specified by:
tick in interface AcceptsMetronomeTicks
Overrides:
tick in class GameEvent
Parameters:
currentTime - Time since epoch at the start of the global metronome propagation, as per System.currentTimeMillis()
deltaTime - Delta-time in milliseconds since the prior global metronome tick
Throws:
UserDeadException - if a user has died during this tick
See Also:
GameEvent.tick(long, long)