Class games.Battle.server.EuropaCore.EuropaCore
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class games.Battle.server.EuropaCore.EuropaCore

java.lang.Object
   |
   +----games.Battle.server.EuropaCore.EuropaCore

public class EuropaCore
extends Object
implements Runnable
EuropaCore is the main shell of the server. It manages mutiple connections coming in from the outside, co-ordinates the player file process, and spawns player threads to allow the players to do things in the game.

Variable Index

 o MAX_GAMES
the most games we'll allow to ever run simulteneously.
 o gameProc
an array of actual game threads for each game in the server.
 o games
an array of Game Information for each game in the server
 o who
a vector of who is currently logged onto the game

Constructor Index

 o EuropaCore(String[])
construct the EuropaCore server.

Method Index

 o authorizePlayer(PlayerInfo)
return the player file's official record on this player, or null if the player info passed in does not match any existing player
 o chatMessage(PlayerInfo, String)
register a chat message from user "id"
 o getChatMessage(int)
retrieve a message from the chat history
 o getPlayer(ServerSocket)
block waiting for a player to connect to the given server socket
 o joinGame(int, PlayerInfo)
allow a player to join a game identified by its unique id
 o lastChatUpdate()
report the last chat update id
 o lastGameUpdate()
report the last game update id
 o lastWhoUpdate()
report the last who update id
 o main(String[])
start the client
 o newPlayer(PlayerInfo)
create a new player based on the passed in id.
 o quitGame(int, PlayerInfo)
allow a player to decline to be in a game before it has actually begun.
 o registerGameEnd(int)
Notice that a game is over
 o registerGameStart(int, BattleGame)
Notice that a game has actually begun.
 o resetGame(int)
clear all the players out of a game that is over or failed to start.
 o run()
loop forever getting connections and spawning player threads
 o start()
actually initiate the thread that runs the server
 o stop()
shutdown the server

Variables

 o who
  public Vector who
a vector of who is currently logged onto the game
 o MAX_GAMES
  public final static int MAX_GAMES
the most games we'll allow to ever run simulteneously.
 o games
  public GameInfo games[]
an array of Game Information for each game in the server
 o gameProc
  public BattleGame gameProc[]
an array of actual game threads for each game in the server.

Constructors

 o EuropaCore
  public EuropaCore(String argv[])
construct the EuropaCore server. command line arguments are passed in to allow the user to configure some of the basic parameters like what port to run on nad how many players may connect at once.
Parameters:
argv - command line arguments

Methods

 o lastGameUpdate
  public int lastGameUpdate()
report the last game update id
 o lastWhoUpdate
  public int lastWhoUpdate()
report the last who update id
 o lastChatUpdate
  public int lastChatUpdate()
report the last chat update id
 o joinGame
  public void joinGame(int gameId,
                       PlayerInfo id)
allow a player to join a game identified by its unique id
Parameters:
gameId - the game to join
id - the id of the player who wants to join the game
 o resetGame
  public void resetGame(int gameId)
clear all the players out of a game that is over or failed to start.
Parameters:
gameId - the game to reset
 o quitGame
  public void quitGame(int gameId,
                       PlayerInfo id)
allow a player to decline to be in a game before it has actually begun. If the game is in progress the player must forfeit from the game window rather than the moons window.
Parameters:
gameId - the game to quit
id - the player who wants to bail out
 o registerGameStart
  public void registerGameStart(int gameId,
                                BattleGame game)
Notice that a game has actually begun.
 o registerGameEnd
  public void registerGameEnd(int gameId)
Notice that a game is over
 o chatMessage
  public void chatMessage(PlayerInfo id,
                          String msg)
register a chat message from user "id"
Parameters:
id - the player sending the message
msg - the message to be sent
 o getChatMessage
  public String getChatMessage(int messageId)
retrieve a message from the chat history
Parameters:
messageId - the message to fetch
 o getPlayer
  public Socket getPlayer(ServerSocket ss)
block waiting for a player to connect to the given server socket
Parameters:
ss - the socket that the server is listening on
 o main
  public static void main(String argv[])
start the client
Parameters:
argv - command line arguments
 o start
  public void start()
actually initiate the thread that runs the server
 o stop
  public void stop()
shutdown the server
 o run
  public void run()
loop forever getting connections and spawning player threads
 o authorizePlayer
  public PlayerInfo authorizePlayer(PlayerInfo id)
return the player file's official record on this player, or null if the player info passed in does not match any existing player
Parameters:
id - the player trying to log in
 o newPlayer
  public boolean newPlayer(PlayerInfo id)
create a new player based on the passed in id.
Parameters:
id - the registration packet of hte new player

All Packages  Class Hierarchy  This Package  Previous  Next  Index