My favorites | Sign in
Logo
                
Search
for
Updated Jul 19, 2009 by matt.corby
Labels: Phase-Implementation, Featured
BasicMudObjects  

Basic Mud Objects

The main classes that anyone should be aware of are:

MudObjectImpl

A base object which all mud objects should extend. This object has the following attributes:

ContainerImpl

This is any kind of container, from a room to a cardboard box. These have an inventoryHandler object, which contains a Map of all the items and their various names.

MOBImpl

Abstract MOB, with basic race, guild and skill behaviours. You can also attach a terminal io to the MOB to read messages. MOBs extend ContainerImpl, and have all its methods as well as:

PlayerImpl

Extends MOB, but allows username, password and overrides "dest" so they don't lose their character stuff if they leave.

Alive

An interface: both monsters and players are "alive" and will receive mud heart beats. A heart beat can be used in the doHeartBeat method to make the character do stuff every so often.

Player

Players are also MudObjects and Alive, and this interface gives you access to these abilities for AbstractPlayers without having to cast objects around.

ExitImpl

Allows Monsters and Players to move between one room and another. Sends a MovementEvent so the mud moves the character and relevant MessageEvents to inform players something has moved.

View

A view is an interface (yes, I know) by which an MudObject exerts a presence in the mud. Every mudobject must have an associated View object. This defines how an object is seen to Mobs and Players and is invoked using the look.groovy script.

The view object can render dynamic text by parsing [Templates]. This is a very powerful tool, as you can build very large areas with very little coding, reusing templates and views as you need them.

Using Spring and Beanbuilder power, you can assign a single view object to a number of MudObjects, thus sharing views over particular object types (weapons, rooms) or special views for individual objects.

RoomImpl

A groovy implementation of a room. This groovy object is an example of a room with exits. The description of rooms can be defined in [Templates] and is dynamically loaded by the RoomImpl's View object.


Sign in to add a comment
Hosted by Google Code