Skip to main content

The Mud Situation

This article describes a system of "situations" I have been developing to add atmosphere to mud rooms beyond that of simple room chat messages.

The real world is a very dynamic place and the situation on any street corner is constantly changing: pigeons might float down, peck at the pavement for a while and then be chased off by a local cat. Later a fellow passing with a crate of fruit might lose a handful of over ripe plums. The plums splat and produce an aroma and a purple stain that is worn away with the passage of feet. Little everyday scenes play themselves out, often leaving little things like splatted plums or pigeon poop to show what went before.

Wood Pidgeon

Wood Pidgeon (from New Zealand)

Compare this to a typical mud room: the descriptions are generally static and though most muds have chat messages one is limited in what one can do without additional coding for the room. Typically a fixed set of chat messages is specified when the room is made and the messages delivered at random intervals. If one sat in a street room for 15 minutes the screen would fill with repeated copies of messages such as "Some pigeons flutter down", "A cat runs out amongst the pigeons", and "Several over ripe plums fall *splat* from of a crate being carried past" in a random order.

One can try and tell little stories with chat messages but it isn't very satisfying. For the street corner one might try: "Some pigeons flutter down and peck for a while until a local cat comes and chases them away" but the attempted scene would be over instantly with no pigeons or cats to look at nor any trace afterwards.

I wanted to create little scenes and stories in rooms. Not necessarily important events or lead-ins for quests, just a background of daily happenings that enrich the atmosphere. One might try this with non-player characters and scripting but I wanted something not much more complex than chat messages. Putting extra effort into making a mobile or non-player character pigeon or fruiterer allows Kerzak the Berserk to chop it up for experience but doesn't really help the atmosphere in the room. Also, city streets can be full of people and it isn't practical to generate non-player character objects for all of them.

Coding on Discworld (MudOS) there are a lot of simple mechanisms one can use to enrich the feel of a room. One can temporarily add extra lines to the basic room description at any time. One can also add items which can be looked at and manipulated to a limited extent. These items aren't objects in the normal mud sense: they are just a keyword paired with descriptive text that is given to the player when he types "look <keyword>". And there are always room chat messages. Code wise I define each situation with an instance of an LPC class whose components include start and end message text, pointers to starting and ending functions, extra room description text, extra items for the room, and additional chats messages all associated with the situation. All the above are optional: a situation can be as simple as a single message when it starts.

As an example, here is a simple situation about pigeons that starts with pigeons flying in, runs for a while with pigeons one can look at that do appropriate pigeony things via the chat messages, and then wraps itself up neatly when they fly off:

Starting message:
"Pigeons flutter down to the pavement from above."
Extra room description text:
"There is a flock of pigeons here."
({ "pigeon", "There are half a dozen fat little pigeons pecking at the ground." })
Chat messages:
"A pigeon mistakes some string for a worm and gets all excited."
"A pigeon who just found a hunk of bread is mobbed by the rest."
Ending message:
"A cat leaps among the pigeons and they scatter with a flurry of wings."

The code I wrote for commencing and shutting down situations uses random numbers seeded by the machine clock. This makes the timing appear random but leaves the situation unaffected by loading and unloading of rooms (or crashes): when the room reloads the situation will have progressed to the right place. This also means that most of the time players will walk in on the middle of a situation which is realistic.

Related sets of situations can give a strong sense of development while the random chats in the individual situations prevent it from being too predictable. One can have a series of haggling sales to different customers in an outdoor market, each modeled with an independent situation and occurring at random times through the day. A dog that starts barking at night, is later chastised by the owner and then is finally quiet may be simulated with a sequence of three situations.

Simple situations add depth, making it easier to feel something is really going on, but one can go a step further by calling functions to create objects or make other changes in a room. For example, a set of situations created for a red light district could include an increasingly loud and suggestive progression of chats apparently originating from a nearby house with the eventual emergence of a smirking sailor into the street. The sailor is a non-player character object that the lead-up situations have given a background. This is an improvement over the more common, "A sailor enters from the east" method of introducing random non-player characters.

Anyone who has faced the task of coding a row of practically identical rooms knows the pain of trying to be creative with different room chats for each one. Instead of a few chats for each room, an alternative is to create a dozen or more situations to be shared by several rooms. While one room has pigeons another can have a barking dog and most can have a nothing all that special. Given enough time the situations get shared around all the rooms. For the dock area in the city of Ankh-Morpork on Discworld we are doing something along these lines for the tens of waterfront dock rooms. We have several situations describing ships: ships arriving, docking, unloading, loading and departing. Sewing these together — with variations in the cargo, names and descriptions of the ships — makes the docks a pretty dynamic place where one might find a passenger ship discharging non-player characters here and a foreign trading ship unloading bolts of cloth further along.

Situations are developing into a nifty tool for creating mud rooms with a rich and dynamic feel. The best part of it is that the creative burden isn't that high for a great result.