|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--dualroids.Server
The Dualroids game server.
Field Summary | |
private Arena |
arena
The server's copy of the arena |
private int |
asteroidIndex
A counter for controlling the asteroid updating iteration. |
private ServerModelConnector[] |
connectors
An array holding all the connectors through which the server sends data to the clients. |
static int |
INITIAL_SHIPS
The number of spare ships the player has initially. |
static long |
INVULNERABILITY_PERIOD
The duration of the ship invulnerability period when a player gets a new ship. |
private int |
level
The level number counter |
private static long |
LEVEL_START_DELAY
The delay between the beginning of level generation and the start of the level. |
static long |
MIN_ITERATION_INTERVAL
Constant for the minimal interval (in milliseconds) between the starts of two server model update iterations. |
static long |
NEW_SHIP_DELAY
The delay before a new ships appears when a ship has exploded. |
private String |
playerName
The name of the player who is running the server |
private static int |
SCORE_1UP
The interval in scores when player should get an additional spare ship |
private int[] |
scores
The score table. |
private int[] |
shipsLeft
The table of remaining ships. |
Constructor Summary | |
Server(String playerName)
Contructs a new Server . |
Method Summary | |
private void |
blowUpShip(int shipIndex,
long newAppears)
Blows up a ship |
private void |
checkCollisions(long time)
Checks collisions in the arena (ships or bullets hitting asteroids). |
private void |
flush()
Flushes both connectors and thus causes the buffered data in network streams to flush too. |
private void |
invalidateBullet(int shipIndex,
int bulletIndex)
Marks a bullet non-flying (not visible). |
private void |
registerAsteroidHit(int shipIndex,
int asteroidIndex,
long time)
Register a bullet hit to an asteroid. |
void |
run()
The method that starts the server thread. |
private void |
runLevel()
The method for running a level |
private void |
sendArena()
Sends the arena to the clients. |
boolean |
updateAsteroids(long time)
Updates the fields of one asteroid at time and checks whether there are asteroids left. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final long MIN_ITERATION_INTERVAL
private static final long LEVEL_START_DELAY
public static final long INVULNERABILITY_PERIOD
public static final long NEW_SHIP_DELAY
public static final int INITIAL_SHIPS
private static final int SCORE_1UP
private Arena arena
private ServerModelConnector[] connectors
private int level
private int asteroidIndex
private int[] scores
private int[] shipsLeft
private String playerName
Constructor Detail |
public Server(String playerName)
Server
.playerName
- the name of the player running the serverMethod Detail |
public void run()
run
in interface Runnable
private final void runLevel() throws GameOverException
private final void flush()
private final void checkCollisions(long time) throws GameOverException
time
- the moment in time for which the check is to be performedpublic final boolean updateAsteroids(long time)
time
- the moment in time to be used as the new timestamptrue
if there are asteroids left and
false
otherwiseprivate final void blowUpShip(int shipIndex, long newAppears) throws GameOverException
shipIndex
- the index of the ship to blow upprivate final void invalidateBullet(int shipIndex, int bulletIndex)
shipIndex
- the index of the ship owning the bulletbulletIndex
- the index of the bulletprivate final void registerAsteroidHit(int shipIndex, int asteroidIndex, long time)
shipIndex
- the index of the ship that fired the bulletasteroidIndex
- the index of the asteroidprivate final void sendArena()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Dualroids was written by Oskar Ojala, Yrjö Kari-Koskinen and Henri Sivonen