Building a New Interactive Fiction System
This is an index that will help those that wish to develop their own interactive fiction system. Feel free to edit this index.
World Models
A couple of quick notes: First, I hate text where Random Words are Capitalized for No Good Reason. I don't know about everyone else, but I find capital letters to act as speed bumps when I'm reading something; they really slow me down. Wiki's typically use CamelCase as a way to generate quick links, but this page isn't even doing that. Second, this section seems to confuse the idea of a world model with it's implementation. I'm going start by paraphrasing Graham Nelson's definition from DM4, and then insert a few notes throughout the text.
[A world model] is a self-contained summary of the concepts and systematic organising principles used by [an interactive fiction system] to present the illusion of describing a physically real environment, with which the protagonist of a game interacts. All details of implementation [should be] ignored and [implementation details] either avoided or explained. While many of the rules are standard to all world models used for interactive fiction, some are not, and [the author should] remark on some of the more interesting cases. [One possible breakdown of a world model is] as follows: 1. Substance; 2. Containment; 3. Space; 4. Sense; 5. Time; 6. Action.
A World Model is the collection of rules and concepts that define how things are modelled in Interactive Fiction. There are many aspects of world models, and they are arguably the most important aspect of building a new IF system. Designing the world model is definetly the first step in any IF system. [Samwyse] Good start!
Most systems will use the Object as the basis for everything. [Samwyse] Look out! We're starting to discuss how to implement a world model, instead of how to write one.
An Object is simply something in the game world. It could be the Player, a room, a key, and so on. Objects have many sorts of data associated with them. Properties are any sort of data, usually, like Name or Description. Attributes are yes/no variables stating whether or not an Object is a weapon, container, etc. Usually giving an Object an Attribute also makes it inherit data and methods from a Class or Template, a predefined Object. States or Conditions are similar to Attributes, but more dynamic. If an Object is switchable, it can be on or off. A candle can be lit or unlit. A dial on a machine could be 0, 1, or 42. [Samwyse] Ok, now we've jumped the tracks. This paragraph and the following, IMHO, needs to go in a page on objects, to which a section on world model implementation could then point.
Usually NPCs, Players, and Rooms are implemented as Objects, too. But how are Objects organized? By an Object Tree, usually. Objects have a Parent, Siblings, and Children. If two keys are in a box, then the box's children are the keys, the keys' siblings are each other, and the keys' parent is the box. There have also been proposals to implement more abstract Relationships between Objects. For instance, you could say that John IsA EmployeeOf Mike. This has never really be implemented before, but is a good idea. One-to-one, one-to-many, and many-to-many Relationships would be an absolute must.
The second most important aspect of the World Model is Events. Events are simply things that take place in the game world and how Objects react to them. In Inform, this is known as the Before/After rule system. [Samwyse] We get back on track here, although I'd drop the bit about Inform.
An Event is simply something that happens. It's usually an Action, such as the Player eating a cookie. It could also be when something changes States or Conditions. This Event triggers a Stimulus, which is forwarded to the appropriate Objects. They may respond to this trigger in any way they see fit. Usually this style of Events will merely change the default library action. [Samwyse] Again, this paragraph and the following, IMHO, needs to go in a seperate page that defines events.
There are many more aspects of Events, but will be covered later.
These two elements make up the majority of modern IF world models. However, recently there have been ideas floating around about a higher level of abstraction. Such things as Scenarios or Puzzles could be implemented? Perhaps. [Samwyse] From here on, the discussion is pretty good, but I'm not sure it's appropriate for this page. Puzzles and scenarios are perhaps better discussed in a page devoted to writing a game, not a system. OTOH, a world model probably should recognize that puzzles and scenarios exist, setting things up for a discusion in the implemenation section.
A Puzzle has a Goal and one or more Problems and Solutions. The exact implementation details depends on the IF system being built.
The same goes for Scenarios, which are parts of the game. For example, in Christminster the first Goal is to enter the college. This has a specific Goal and many Puzzles. The main use of Scenarios is Context, the idea that Objects should behave differently under different conditions. Scenarios merely organize these conditions into logical components of a game.