This paper will look at the com.sun.sgs.darkmud.locked package. It supplies
support for keys that can be used to unlock
or lock doors that are lockable. The following are classes that were added to support keys and lockable doors.
As shown above and explained in Exercise 3 of the JavaOne 7400darkstar
Lab, everything in the game is based on the MudObject class that implement
the ManagedObject interface and is Serializable. This allows all game objects
to be managed
by the PDS server database services to give the objects persistence.
NOTE: Game objects are passed around using their ManagedReference, not as ManagedObjects.
The MudObject class (1a) defines a minimal interface that allows all
objects to have a description, maintain an inventory, support
aliases of its name, and parse command the look command. For items that the Player can pick up, put down, and carry around, the GettableObject class (1b) is provided.
The command parsing is where a lot of the game magic takes place and understanding it will be our holy grail.
Example: the Rope object
The Rope is going to be used to interact with a door. Since it has to exsit in the game, it must be (3a) a MudObject which
is a ManagedObject and is Serializable allowing the server to manage its existance. Also, since it is going to be used by the
Player, the Player has to be able to pick it up and add it to their inventory. Therefore, the Rope will be a GettableObject
which extends the MudObject class.
The MudObject provides the look command support. The GettableObject
provide the additional take and drop command
support. Since the actions in the game are done by the target of a command. Rope action commands have to be supported
by objects that respond to the Rope. This will be the Trap Door that will be discussed later.