|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.crowd.server.PlaceManager
com.threerings.parlor.game.server.GameManager
com.threerings.puzzle.server.PuzzleManager
public abstract class PuzzleManager
Extends the GameManager with facilities for puzzle games.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.crowd.server.PlaceManager |
|---|
PlaceManager.DelegateOp, PlaceManager.MessageHandler |
| Field Summary | |
|---|---|
protected Board[] |
_boards
The player boards. |
protected long[] |
_lastProgress
Tracks the last time we received a progress event from each player in this puzzle. |
protected PuzzleObject |
_puzobj
A casted reference to our puzzle game object. |
protected Interval |
_statusInterval
The client update interval. |
| Fields inherited from class com.threerings.parlor.game.server.GameManager |
|---|
_AIs, _aiTicker, _committedState, _gameconfig, _gameEndTracker, _gameobj, _noShowInterval, _pendingOids, _playerCount, _playerOids, _postponedStart, _startmsgs, _stateListener, _tickInterval, AI_TICK_DELAY, DEFAULT_NOSHOW_DELAY, TICK_DELAY |
| Fields inherited from class com.threerings.crowd.server.PlaceManager |
|---|
_bodyUpdater, _config, _deathListener, _delegates, _dispatcher, _dispatcherFinders, _injector, _invmgr, _locator, _marshallers, _msghandlers, _occInfo, _occListener, _omgr, _plobj, _registry, _shutdownInterval |
| Fields inherited from interface com.threerings.puzzle.data.PuzzleCodes |
|---|
DEBUG_PUZZLE, DEFAULT_DIFFICULTY, PUZZLE_MESSAGE_BUNDLE |
| Fields inherited from interface com.threerings.presents.data.InvocationCodes |
|---|
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR |
| Fields inherited from interface com.threerings.parlor.data.ParlorCodes |
|---|
ALREADY_AT_TABLE, BANNED_FROM_TABLE, GAME_ALREADY_STARTED, INVALID_TABLE_POSITION, INVITATION_ACCEPTED, INVITATION_COUNTERED, INVITATION_REFUSED, INVITEE_NOT_ONLINE, MUST_BE_CREATOR, NO_SELF_BOOT, NO_SUCH_TABLE, NOT_AT_TABLE, PARLOR_GROUP, TABLE_POSITION_OCCUPIED |
| Fields inherited from interface com.threerings.parlor.game.data.GameCodes |
|---|
GAME_CHAT_TYPE, GAME_MESSAGE_BUNDLE, PLAYER_KNOCKED_OUT, WINNERS_AND_LOSERS |
| Constructor Summary | |
|---|---|
PuzzleManager()
|
|
| Method Summary | |
|---|---|
protected boolean |
applyProgressEvent(int pidx,
int gevent,
Board cboard)
Called by updateProgress(com.threerings.presents.data.ClientObject, int, int[]) to give the server a chance to apply each game event
received from the client to the respective player's server-side board and, someday, confirm
their validity. |
protected void |
applyProgressEvents(int pidx,
int[] gevents,
Board[] states)
Applies progress updates received from the client. |
protected void |
assignWinners(boolean[] winners)
Overrides the game manager implementation to mark all active players as winners. |
protected boolean |
checkForInactivity()
Returns whether checkPlayerActivity(long, int) should be called periodically while the game
is in play to make sure players are still active. |
protected void |
checkPlayerActivity(long tickStamp,
int pidx)
Called periodically for each human player to give puzzles a chance to make sure all such players are engaging in reasonable levels of activity. |
protected boolean |
compareBeforeApply()
Returns whether this puzzle compares board states before it applies progress events, or after. |
protected void |
compareBoards(int pidx,
Board boardstate,
int gevent,
boolean before)
Compare our server board to the specified sent-back user board. |
protected int |
computeDifficulty()
When a puzzle game starts, the manager is given the opportunity to configure the puzzle difficulty based on information known about the player. |
protected void |
didShutdown()
|
protected void |
didStartup()
|
protected void |
gameDidEnd()
Called after the game has transitioned to the GameObject.GAME_OVER state. |
protected void |
gameDidStart()
Called after the game start notification was dispatched. |
protected void |
gameWillStart()
Called when the game is about to start, but before the game start notification has been delivered to the players. |
Board[] |
getBoards()
Returns the boards for all players. |
BoardSummary |
getBoardSummary(int pidx)
Returns the board summary for the given player index. |
protected long |
getStatusInterval()
Returns the frequency with which puzzle status updates are broadcast to the players (which is accomplished via a call to sendStatusUpdate() which in turn calls
updateStatus() wherein derived classes can participate in the status update). |
protected void |
handleBoardNotEqual()
Handles the server and client states being out of sync when in debug mode. |
protected void |
initBoards()
Creates and initializes boards and board summaries (if desired per needsBoardSummaries()) for each player. |
boolean |
needsBoardSummaries()
Returns whether this puzzle cares to make use of per-player board summaries that are sent periodically to all users in the puzzle via sendStatusUpdate(). |
protected boolean |
needsPlayerBoard(int pidx)
Returns whether this puzzle needs a board for the given player index. |
protected abstract Board |
newBoard(int pidx)
Creates and returns a new starting board for the given player. |
protected abstract BoardSummary |
newBoardSummary(Board board)
Creates and returns a new board summary for the given board. |
protected void |
playerGameDidEnd(int pidx)
Called when a player has been marked as knocked out but before the knock-out status update has been sent to the players. |
protected void |
sendStatusUpdate()
Updates (in one puzzle object transaction) all periodically updated status information. |
protected boolean |
summarizeAIBoard()
Override to have board summaries for AIs automatically generated. |
protected void |
systemMessage(String msg)
Send a system message with the puzzle bundle. |
protected void |
systemMessage(String msg,
boolean waitForStart)
Send a system message with the puzzle bundle. |
protected void |
tick(long tickStamp)
Gives game managers an opportunity to perform periodic processing that is not driven by events generated by the player. |
void |
updateBoardSummaries()
Applies updateBoardSummary on all the players' boards. |
void |
updateBoardSummary(int pidx)
Calls BoardSummary.summarize() on the given player's board summary to refresh the
summary information in preparation for sending along to the client(s). |
void |
updateProgress(ClientObject caller,
int sessionId,
int[] events)
Handles a PuzzleGameService.updateProgress(int, int[]) request. |
void |
updateProgressSync(ClientObject caller,
int sessionId,
int[] events,
Board[] states)
Called when the puzzle manager receives a progress update. |
protected void |
updateStatus()
A puzzle periodically (default of once every 5 seconds but configurable by puzzle) updates status information that is visible to the user. |
protected void |
updateSummaryOnDeath(int pidx)
Updates the board summary for a player who has been eliminated and performs an update to communicate this change. |
| Methods inherited from class com.threerings.crowd.server.PlaceManager |
|---|
addDelegate, addDispatcher, addOccupantInfo, addProvider, applyToDelegates, applyToOccupants, bodyEntered, bodyUpdated, bodyWillEnter, bodyWillLeave, cancelShutdowner, checkPermissions, createPlaceObject, createSpeakHandler, getAccessController, getConfig, getLocation, getPlaceObject, getPlaceObjectClass, idleUnloadPeriod, init, isValidSpeaker, messageReceived, permissionsFailed, ratifyBodyEntry, registerMessageHandler, shouldCreateSpeakService, shouldDeclareEmpty, shutdown, startup, toString, toString, updateOccupantInfo, where |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected PuzzleObject _puzobj
protected Board[] _boards
protected Interval _statusInterval
protected long[] _lastProgress
| Constructor Detail |
|---|
public PuzzleManager()
| Method Detail |
|---|
public Board[] getBoards()
public BoardSummary getBoardSummary(int pidx)
public boolean needsBoardSummaries()
sendStatusUpdate(). The default
implementation returns false.
protected boolean compareBeforeApply()
true.
protected void handleBoardNotEqual()
public void updateBoardSummary(int pidx)
BoardSummary.summarize() on the given player's board summary to refresh the
summary information in preparation for sending along to the client(s).
pidx - the player index of the player whose board is to be summarized.public void updateBoardSummaries()
protected void playerGameDidEnd(int pidx)
GameManager
playerGameDidEnd in class GameManagerprotected void updateSummaryOnDeath(int pidx)
protected boolean summarizeAIBoard()
protected void didStartup()
didStartup in class GameManagerprotected void gameWillStart()
GameManagersuper.gameWillStart().
gameWillStart in class GameManagerprotected long getStatusInterval()
sendStatusUpdate() which in turn calls
updateStatus() wherein derived classes can participate in the status update).
Returning O (the default) indicates that a periodic status update is not
desired.
protected int computeDifficulty()
protected void gameDidStart()
GameManagerGameObject.IN_PLAY is necessary), but should be
sure to call super.gameDidStart().
gameDidStart in class GameManagerprotected void sendStatusUpdate()
protected void updateStatus()
protected void systemMessage(String msg)
protected void systemMessage(String msg,
boolean waitForStart)
waitForStart - if true, the message will not be sent until the game has started.protected void initBoards()
needsBoardSummaries()) for each player.
protected boolean needsPlayerBoard(int pidx)
protected void gameDidEnd()
GameManagerGameObject.GAME_OVER state. Derived
classes should override this to perform any post-game activities, but should be sure to call
super.gameDidEnd().
gameDidEnd in class GameManagerprotected void didShutdown()
didShutdown in class GameManager
protected void applyProgressEvents(int pidx,
int[] gevents,
Board[] states)
protected void compareBoards(int pidx,
Board boardstate,
int gevent,
boolean before)
protected boolean applyProgressEvent(int pidx,
int gevent,
Board cboard)
updateProgress(com.threerings.presents.data.ClientObject, int, int[]) to give the server a chance to apply each game event
received from the client to the respective player's server-side board and, someday, confirm
their validity. Derived classes that make use of the progress updating functionality should
be sure to override this method to perform their game-specific event application antics.
They should first perform a call to super() to see if the event is handled there.
pidx - the player index that submitted the progress event.gevent - the progress event itself.cboard - a snapshot of the board on the client if the client has board syncing
enabled (which is only enabled when debugging).
protected void assignWinners(boolean[] winners)
assignWinners in class GameManagerprotected abstract Board newBoard(int pidx)
protected abstract BoardSummary newBoardSummary(Board board)
null.
public void updateProgress(ClientObject caller,
int sessionId,
int[] events)
PuzzleGameProviderPuzzleGameService.updateProgress(int, int[]) request.
updateProgress in interface PuzzleGameProvider
public void updateProgressSync(ClientObject caller,
int sessionId,
int[] events,
Board[] states)
applyProgressEvents(int, int[], com.threerings.puzzle.data.Board[]).
updateProgressSync in interface PuzzleGameProviderprotected void tick(long tickStamp)
GameManager
tick in class GameManagerprotected boolean checkForInactivity()
checkPlayerActivity(long, int) should be called periodically while the game
is in play to make sure players are still active.
protected void checkPlayerActivity(long tickStamp,
int pidx)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||