Package marauroa.server
Class marauroad
java.lang.Object
java.lang.Thread
marauroa.server.marauroad
- All Implemented Interfaces:
Runnable
The launcher of the whole Marauroa Server.
Marauroa is an arianne server application with an TCP transport.
Marauroa works by loading core class from your game server.
So marauroad has:
The pseudo code behind NetworkManager is:
The hardest part of the Manager is to consider all the special cases and all the exceptions that can happen. The main pseudo code of the GameManager, if we skip exceptions, is:
Marauroa is, as you know, turn based, so actions when received are queued for the next turn, and when that turn is reached all the actions pending on that turn are executed.
RuleManager is a class that encapsulates all the implementation related to rules.
Marauroa is an arianne server application with an TCP transport.
Marauroa works by loading core class from your game server.
Marauroa server is and it is built using threads. marauroad has the following set of threads:
- 1 thread to receive data from clients
- 1 thread to send data to clients
- 1 thread to handle the data into server actions
- 1 thread to handle RPG itself.
So marauroad has:
- NetworkManager
- GameManager
- RPManager
The pseudo code behind NetworkManager is:
forever { Read stream from network Convert to a Message store in our queue }One level (conceptually) over NetworkManager is the GameManager, this is the part of the server that handles everything so that we can make the server work. Its main task is to process messages from clients and modify the state on the server to reflect the reply to that action, mainly related to:
- Login
- Logout
- ChooseCharacter
- Actions
- Transfer Content
The hardest part of the Manager is to consider all the special cases and all the exceptions that can happen. The main pseudo code of the GameManager, if we skip exceptions, is:
forever { Wait for Message to be available if(Message is Login) { check player. ask for character } if(Message is Choose Character) { check character add to game } if(Message is Action) { add action to game } if(Message is Transfer Request ACK) { send client the content requested } if(Message is Logout) { remove from game } }And finally RPManager is the active thread that keeps executing actions.
Marauroa is, as you know, turn based, so actions when received are queued for the next turn, and when that turn is reached all the actions pending on that turn are executed.
The idea in RPManager is to split up complexity as much as possible: we have 2 entities to help it: Scheduler and RuleManager.
forever { for each action scheduled for this turn { run action in RuleManager } Send Perceptions wait until turn is completed next turn }Scheduler handles the actions as they are sent by the GameManager.
RuleManager is a class that encapsulates all the implementation related to rules.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
marauroad
protected marauroad()Constructor
-
-
Method Details
-
main
Entry point- Parameters:
args
- command line arguments
-
run
public void run() -
getMarauroa
returns the marauroad object- Returns:
- marauroad
-
init
Initializes the game. Returns true when all is OK, else false (this may terminate the server).- Parameters:
args
- command line arguments- Returns:
- true, in case the startup was successful, false otherwise
-
getNetMan
gets the network server manager- Returns:
- INetworkServerManager
-
getRPServerManager
gets the RPServerManager- Returns:
- RPServerManager
-
finish
public void finish()shuts down Marauroa
-