JavaMudServer [JMS - 2000] ========================== - Players register using a preferred alias - Players can move between rooms that are connected by a door - Crystals appear occasionally in the rooms throughout the MUD - Players can pick up these crystals to store them for later use - Players can use crystals from their store - Some crystals serve to increase the healthLevel of the player - Other crystals can be used as weapons agains other players or animals in the rooms - The gryphon is an animal that, if provoked, will attack viciously - The gryphon, if has been provoked, will become calm eventually - The phoenix can be used to get teleported to some random room - The unicorn is an animal that, if provoked, will attack viciously - The unicorn, if has been provoked, can be appeased/made calm JMS Extra features ================== - Messaging system - Private messaging system - Prompt dead players removal - Inactive players detection and removal 3 Mud-specific amnmals with independent characteristics - Gryphon: behaviour determined by finite state machine - Phoenix: behaviour is largely consistent and unaffected - Unicorn: behaviour determined by finite state machine ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Classes and Interfaces ====================== ---------------------------------------------------------------- + PlayerInterace This interface determines the various methods that a client can invoke on a remote server. --------------------- + Status This class is the return type of the *getStatus* remote method that *PlayerInterface* declares. Clients invoke this method, and the return object contains complete information that the client would need to play the game. This class has various fields to represent various pieces of information like: *healthLevel*, *numPlayersInRoom* ---------------------------------------------------------------- + JavaMudServer This is the main server object. It is the *remote* object and it implements *PlayerInterface* so that clients can invoke its methods remotely through RMI. JavaMudServer executes by setting up the dungeons in the MUD, and also by creating the 3 different animals: Gryphon, Phoenix and Unicorn. A separate thread is created for an object of class *ServerThread* [see later] too. JavaMudServer then proceeds to register itself as an RMI service: *JMS* through the rmiregistry running on port 9990. Once this has been done, the clients can lookup the server, and then connect and perform the various client operations like: - new player registration and unique ID assignment - navigating through the MUD, - picking up *crystals*, - using these *crystals* on themselves and other entities in the MUD: other players and/or the MUD animals, - sending messages to everyone in the room they're currently in - sending private messages to some other player in the same room So, the responsibilities of JavaMudServer could be summarised as being the following: - maintaining information regarding all the players who've ever registered, including those who're dead, and hence, expunged from the system - maintaining information regarding all the MUD-specific animals that exist in the system - maintaining information regarding the actual rooms in the MUD - accepting actions/events from players/animals and applying, where applicable, the effects to the other entities in the same room - maintaining the MUD as a whole, and have an ever-evolving system that will make the system a fun and interesting place for the players --------------------- + JavaMudServer.Player This class is a subclass of *Status*; all the extra information that this class has in addition to whatever it inherits from its parent is used by JavaMudServer to keep track of each active player's status with regards to its environment. --------------------- + JavaMudServer.Room Objects of this class are created for each Room that exists in the MUD. In order to make it easier to "apply certain effects to all entities in a certain room," this class keeps track of all the players and MUD-specific animal that are present in the room. ---------------------------------------------------------------- + ServerThread There is a single object of this class, and it runs in a thread of its own. This object has the task of continually cycling through all the existing players and animals in the MUD and determining which, if any, to expunge from the system -- the single criterion for expunging is that *healthLevel* of the player has diminished down to zero. ServerThread is also capable of identifying inactive players, and gradually, but eventually, expunging them from the system. This needs to be done so for a variety of reasons: - Actual end-user's browser crashed, but its *Player* object is still active in the system - Actual end-user dozed off, and so needs to be removed from the system. Another main function of ServerThread is to create *crystals* into the rooms in the MUD every so often. The object has the opportunity of creating a crystal quite often, but it does not create one at each chance it gets -- whether a crystal is generated or not is determined using a random value at runtime. --------------------- + Gryphon The Gryphon is a MUD-specific animal who's behaviour is determined by its finite state automaton. Its states are: CALM_STATE and RAVING_MAD, and it transitions between these states when players perform certain actions on the Gryphon. In such circumstances, the Gryphon is either *provoked* or *made calm*. --------------------- + Unicorn The Unicorn is another MUD-specific animal who's behaviour is also determined by its finite state automaton. Like before, its states are: CALM_STATE and RAVING_MAD, and the transitions between these states are the results of certain actions as performed by the players on the Unicorn. As for the Gryphon, the Unicorn can either be *provoked* or *made calm*. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++