Argax Project

Node Status: COMPLETE

Prototype Game: Demeter

To demonstrate and evaluate Marlinspike in practice, I wrote a simple prototype game named Demeter: Blood in the Sky. Set in an alternate 1923, seven wealthy passengers--one of whom is the player's character--are enjoying a pleasant trans-Atlantic flight aboard the Demeter, a Zeppelin-class airship. The story begins on the dawn of the third day when the dying captain awakens the passengers. Speaking through the intercom system, he warns them with his dying breath that the crew has all been brutally slain! Told to lock themselves in the passenger gondola, the passengers must decide what to do as the Demeter drifts onward over the cold Atlantic below.

The Demeter game was designed to take about thirty minutes to play through for the first time.

Game Engine

The Marlinspike architecture could work in a mouse-based, graphical environment. It requires only that the world (as defined by the game engine) report all deeds performed by the player in that world to the drama manager. The drama manager also needs the ability to manipulate the characters and objects in the world in order to produce the content of scenes.

However, in order to simplify the implementation of the prototype game, I chose to use a text-based approach for Demeter. Specifically, I used the interactive fiction system Inform (2010) to define the story world objects, to process user input, and to display output. Therefore, the experience of playing Demeter is much like that of other interactive fiction games: the player types in commands in natural language and the system responds with text describing the results of her actions.

A screen shot of the Demeter game.
A screenshot of Demeter running in the Gargoyle Inform/Glulx interpreter.

To avoid potential communication problems between the Marlinspike drama manager and the story world, Marlinspike was also implemented in Inform. As mentioned in the previous chapter, Marlinspike provides only a framework, leaving all details of game content to the implementing game. This means all specific world objects, characters, verbs, actions, scenes, and triggers are defined by Demeter. Marlinspike consists of the drama manager and the model of the resulting story. The resulting Inform program then requires a virtual machine named Glulx to run. There are a number of possible Glulx interpreters, including Gargoyle and Zag. All of these relationships are shown in the following figure.

Demeter-Marlinspike-Glulx relationship.
Relationship of Demeter game content to Marlinspike within the Glulx virtual machine.

Story World

The events of the story are confined to the Demeter airship. This includes eighteen total locations or "rooms": ten in the passenger gondola and eight within the Zeppelin body. There are a number of scenery objects that the player can interact with in these locations, including doors, bunks, sinks, toilets, engines, and gas bags. There are other objects, such as furniture and corpses, that the player can move around. Finally, there is a small number of props that the user can also pick up and carry around, including a hammer, knife, chair legs, and sacks of food.

Characters

There are seven non-player characters (NPCs): six other passengers and a revenant--the undead creature that killed the crew. Each passenger NPC includes a number of variables that represent their internal state.

NPC VariableDescription
affinity How this character feels about a particular topic, from love (+100) to hate (-100). Every character has an separate affinity for each of the other characters (including the PC and revenant) as well as for the idea of leaving the passenger gondola.
beliefThe degree to which the character accepts the supernatural nature of their foe. Can vary from acceptance of the supernatural (+1), uncertainty (0), or a mental break and denial that there is any danger at all (-1).
evidence The level of evidence this character has witnessed or has been told regarding the existence of the revenant. Values include 0 (none), 1 (Captain's message only), 2 (crew corpses seen), 3 (revenant sighted), 4 (witnessed a revenant attack), and 5 (witnessed revenant's demise).
health Reduced from 3 (healthy) as the character is injured. At 0, the character falls unconscious. At -1, the character dies.
morality A scale that indicates this character's altruism (+100) verses total self-interest (-100).
physical This character's physical abilities, such as strength, dexterity, fortitude, and combat prowess (+1, 0, or -1). This affects how much damage they deal when attacking another and how much damage they might take in return.
propriety How conscious this character is of social convention and manners. Mostly affects how they address others, such as whether they use only first names, etc (+1, 0, or -1).
relationship Some NPCs have pre-existing relationships. Such a relationship will influence how this NPC reacts to the other NPC in the relationship in some situations, rather than reacting solely based on current affinity levels.
will This character's willpower, courage, or mental focus (+1, 0, or -1). This variable affects how a character responds to increased evidence. Strong-willed characters become more determined while weak-willed characters will become more fearful of the revenant and of leaving the passenger gondola. These changes are reflected in changed affinities and belief values.
State variables of passenger NPCs in Demeter

Each NPC also has a preferred plan. There are nine possible plans selected based on the NPC's current affinity for the revenant and for leaving the passenger gondola. The plans include: facing the revenant, escaping the Zeppelin altogether, hunting the revenant, self-preservation, exploring cautiously for supplies and more information, gathering weapons, doing nothing, defending the passenger gondola, or luring the revenant into a trap in the passenger gondola.

The execution of these plans may then be modified by other NPC states. For example, an NPC with a plan to face the revenant believes the revenant is too powerful to be killed but that it should still be sought. For an NPC of high morality, this will manifest as a sense of brave futility. On the other hand, an NPC of low morality will seek the revenant in hopes of joining it or somehow negotiating their own survival (possibly at a cost to others). Similarly, if an NPC has a plan to do nothing, her current belief state will determine what that NPC says while suggesting the futility of all other plans.

These plans are not complex models. That is, they are not a series of steps towards an objective. Rather, they are simply flags used to customize the content of certain scenes. For example, if an NPC with a plan to gather weapons is the same location as an available weapon, the Pursues_Plan scene could play to have that NPC pick up the weapon.

Aside from those states listed in the table above, NPCs have other states that is less story-relevant. For example, each NPC has a first and last name, a current location, and might be carrying an item. NPCs also have a limited amount of individual behaviors, such as how they respond to some questions.

Overall, NPCs are fairly simple in Demeter. This is because the intention for this prototype game was to evaluate the effect of the Marlinspike drama manager on story structure, rather than the presentation of believable characters.

Verbs

The standard Inform library provides a number of pre-defined verbs. A game author can then define more. Demeter uses twenty-seven different verbs, most of which are standard to Inform.

Verbs
Ask
Attack
Close
Drop
Eat
Enter
Examine
Give
Go
Insert
Kill
Kiss
Knock
Lock
Look
Open
Push
PushDir
PutOn
Rape
Take
Talk
Tell
Touch
Unlock
Use
Wait
Verbs used in Demeter

These are the only verbs that produce deeds that are reported to the Marlinspike drama manager. Because there are additional verbs defined in the Inform library, the game will recognize additional verbs. However, these extra verbs will produce only a bland response and the world will remain unaffected. For example, if a player tries to sleep, the Inform response is "You aren't feeling especially drowsy." If the player types jump, the reply is "You jump on the spot, fruitlessly."

In addition, Demeter defines some verbs that simply map to those in the list above. For example, Excrete will produce a Use(toilet) deed if a toilet is present, or else gives the message "Your socialization is just too strong to do that here. You'll have to find a toilet first." (This verb is important in the pre-game tutorial, described below.)

Similarly, the Talk verb provides a menu of options that produce valid Ask and Tell deeds. I used a menu for conversations in the hopes of increasing the affordances of the system. Without it, players would have to guess the appropriate keywords for supported conversation topics while having no idea which topics or even how many topics are supported. The required "ask npc about topic" syntax required is not obvious either. However, it is still possible to use the Ask and Tell verbs directly without going through the Talk menu for those players familiar with other interactive fiction games.

Finally, all verbs have multiple synonyms. For example, the commands kiss, hug, and embrace all map to the same Kiss verb.

Actions

The player character's world-level deeds are then represented at the story-level using actions. Demeter has twenty-six such actions.

ActionDescriptionImport
ACQUIRE To take or otherwise come into possession of an item. 4
AFFRONT To make another character think less of you.
(DEFY, HINDER, OFFEND, ASSAULT, BATTERY, and HARASS are also affronting actions.)
3
ASSAULT To physically injure, sexually harass, or significantly threaten someone (such as with a weapon). 6
ASSIST To help another, such as by providing them with valuable resources. 4
ATTEMPTTo try to perform an action, but to be interrupted in some way so that it does not complete. 3
BATTERY1 The height of physical attacks and depravity: murder, attempted murder, etc. 8
CHANGE_STATE To significantly change the details of an existing story state. 0
CONVERSE To ask, tell, or otherwise verbally interact with another character. 3
DAMAGE To disable, break, or destroy an inanimate object. 4
DEFY To violate or oppose some NPC's previously expressed interdiction, request, or desire. 5
DELAY To be inactive for a period of time, generally with the purpose of allowing more exciting events to unfold. 3
END_STATE To end an existing story state. 0
ENDEAR To make another character think more highly of you.
(ASSIST and ROMANCE are also endearing actions.)
3
EXAMINE To look at or examine a physical object in a non-invasive manner. 1
HARASS Unwanted physical contact, significant taunting, or threatening that does no physical damage or serious lasting psychological harm. 3
HINDER To obstruct another's goals. 4
INTERACT To communicate in some neutral way other than verbal conversation. 3
LOSE To lose possession of an ACQUIREd item, such as when dropping it or giving it away. 2
MANIPULATE To physically interact with an inanimate object in a normal manner, such as by picking it up, putting it down, turning it on, using it, etc. 2
OFFEND To insult, argue vehemently against, order around in an insulting or abrasive manner, etc. 3
OPPOSE To express or demonstrate opposition to someone regarding another NPC or plan. 3
ROMANCE To woo someone, seeking their favor. 5
START_STATE To start a new story state. 0
SUPPORT To express or demonstrate support to someone for another NPC or plan.3
TRAVEL To move from place to place or otherwise change physical orientation. 2
USE To use or apply some possessed or otherwise handy item to some story-significant purpose or end. 2
Actions used in Demeter

In accordance with the Marlinspike design, actions do not change the state of world objects; that is the job of verbs. However, actions can change the states of NPCs. Indeed, most of the Demeter actions affect NPC affinities. The ENDEAR and AFFRONT groups of actions directly change the feelings of the recipient for the actor. The HARASS, ASSAULT, and BATTERY actions can additionally affect the affinities of witnesses.

The SUPPORT and OPPOSE actions are more subtle. Many different events in the story can be recast as supporting or opposing a plan or individual. Witnesses of a SUPPORT action then change their own opinions of either the supporter or the supported topic depending on how they feel about both. For example, if a witness has a high affinity for the supporter of some topic but is rather ambivalent about the topic itself, the witness will be encouraged to favor the supported topic a little more. On the other hand, if an actor that the witness doesn't feel strongly about supports a topic that the witness despises, then the witness will think less of the supporter. OPPOSE rules works similarly but in reverse.

Scenes

Demeter has twenty-six possible scenes plus two scene components. Scene components were used in authoring Demeter to break some of the more complicated scenes into more managable pieces. They cannot play on their own as scenes; instead, they are only played as part of certain other scenes. Scene output varies from a line or two of NPC conversation to three screens of text. However, the average scene produces one or two paragraphs of text.

SceneDescription
A_Long_Night A fast-forward through the night, during which a surviving revenant will attempt to assault the passenger gondola.
Awaiting_GoParty What happens among the stay party (when PC stays) in the absence of the GoParty.
Captains_Message The beginning of the story, where the captain issues his warning about something being aboard the ship.
Discussion_Concludes An NPC summarizes the discussion and thus establishes the GoParty story state.
Discussion_Continues A random NPC who has not already contributed to the discussion throws in her two cents.
Discussion_Curtailed An NPC curtails a PC-started discussion during the GoParty stage.
Discussion_Interrupted Played when a discussion state ends before a Discussion_Concludes can play.
Discussion_Offscreen A quick discussion when PC is offscreen in order to form the first GoParty.
Discussion_Query An NPC asks the player for her opinion regarding the current discussion.
Discussion_Starts An NPC, chosen at random, opens a discussion about what the best plan of action would be.
Evidence_Revealed An NPC witnesses evidence of the revenant or that the command gondola is irrevocably sealed.
GoParty_Departs Marks the initial departure of the GoParty from the passenger gondola.
GoParty_Eviction The PC gets kicked out of the GoParty for being violent to other NPCs.
GoParty_Moves_Along Moves the GoParty to a new location.
GoParty_Offscreen The GoParty moves along offscreen, revealing various evidence and possibly encountering the revenant (if possible in that part of the airship).
GoParty_Reentry The GoParty and/or PC needs someone in the passenger gondola to unlock the hatch. Those in the gondola may refuse the request, thus betraying the GoParty.
GoParty_Reports* As part of GoParty_Returns, a member of the GoParty reports what it saw since GoParty_Departs.
GoParty_Requests_Follow If a GoParty leaves the PC behind, it will request the PC to follow along on the following turn (or as soon as it can play after that).
GoParty_Returns Marks the return of GoParty through the hatch into the passenger gondola.
Impromptu_GoParty A GoParty that forms quickly based on action rather than through discussion.
Landfall The Zeppelin reaches the US shoreline, which ends the story.
NPC_Proposes_Plan* A discussion scene component in which an NPC will lobby for a certain course of action to everyone present.
NPCs_React A special middle scene that handles all the possible reactions that various bystander NPCs might care to perform this turn.
PC_Dies The PC dies from injuries, a Zeppelin crash, or leaping from the Observation Deck. This ends the story.
PC_Unconscious The PC succumbs to injuries that prove non-fatal. The PC will wake up in various locations depending on the situation.
Pursues_Plan An NPC attempts to fulfill one of the nine possible plans.
Revenant_Acts Depending on various factors, the revenant may not act, be foreshadowed, enter the location, attack, or flee.
Waiting_through_the_Day The day passes because no one can think of anything else to do.
Scenes and scene components* in Demeter.

Demeter has only one beginning scene (Captains_Message) and two ending scenes (Landfall or PC_Dies). The story ends as soon as either of these two ending scenes can play.

Demeter uses only two story state triggers. One marks that a discussion is currently under way. The other marks that an exploration "GoParty" is currently active, as well as tracking which characters are currently in that party.

Due to the use of these two story states to group scenes and due to the preconditions of the various scenes, a general story structure of Discussion - Exploration - Waiting tends to emerge in Demeter stories. However, depending on the actions of the player, some of these story stages can be skipped in any particular story. For example, if the PC immediately tries to leave the passenger gondola, he can circumvent all discussion by the NPCs. Similarly, exploration can be skipped if neither the PC nor any NPCs are motivated to go. Or exploration can happen offscreen in a scene or two if the PC does not join or follow the exploration party. Finally, the passage of time through the day and final night of the trans-Atlantic flight can be quickly summarized in the ending Landfall scene if the revenant is slain before this point in the story.

So, similar to Propp's (1968) folktale functions, higher order "functions" do emerge over multiple Demeter sessions. However, this higher level structure is only implicitly defined within the system itself. It is also very flexible, since any single part of this structure is generally optional. That is, except for the beginning Captains_Message scene, it is possible to play the game in such a way as to avoid any one particular scene.

Even when the same scene plays in different stories, the content can vary significantly depending on the world state and story context that exist at the time the scene runs. For example, PC_Unconscious plays as soon as the PC has sustained significant injuries. The most recent injury can come from either the revenant or another passenger, and this determines how the scene plays.

If the PC's injury came from the revenant and another passenger NPC is present at the time, the NPC might rescue the PC. Whether the NPC is motivated to rescue the PC depends on both the NPC's morality and her affinity for the PC. The rescuing NPC may also need to be healthy enough to survive an attack from the revenant while performing the rescue. If rescued, the PC will wake in his bunk and the rescuing NPC will briefly summarize what just happened. If the PC is not rescued from the revenant--either because no other passenger is present, survives the revenant, or cares to perform a rescue--this scene becomes PC_Dies as the revenant moves in for the kill.

On the other hand, if the PC falls unconscious due to an injury from another passenger while in the passenger gondola, the PC will wake up disarmed and locked out on the Observation Deck. If the PC was instead up in the body of the Zeppelin at the time, he may be left where he fell or he may be dragged back to the Observation Deck depending on the motivation of any present NPCs to rescue the PC from potential danger.

This is a fairly typical example of the internal complexity and variation possible from a single scene in Demeter. The original Inform code for this scene is available in Appendix 1.

NPCs_React is a special scene that deserves explanation. As discussed in more detail in the following chapter, I discovered that NPCs must respond to certain events immediately. The current Marlinspike design does not accommodate this well, and so I wrote a special scene to handle any NPC reactions to the current action event. NPCs_React can play as a scene in its own right, but it is also used as a component at the start of nearly every other scene. When it plays, NPCs_React can play a combination of one or more of the following thirteen reactions (and one reaction component).

ReactionDescription
NPC_Annoyed The given NPC expresses displeasure or annoyance.
NPC_Defends The given NPC reacts to being physically attacked.
NPC_Defends_Other Similar to NPC_Defends, but does so on behalf of another NPC.
NPC_Defied The given NPC expresses disappointment that the actress did something that the NPC explicitly asked her not to, usually in an NPC_Interdicts.
NPC_Interdicts* A reaction component in which an NPC forbids another character from performing some specific future action.
NPC_Observes_Destruction The NPC observes a successful attack on an object.
NPC_Offered_Item_By In reply to an ASSIST[Give], the NPC either accepts or refuses the offered item.
NPC_Outraged The given NPC expresses either incredulity, great rage (by screaming, cursing, etc), pushes, or attacks the offending character, depending on affinity for the character.
NPC_Rebuffs The given NPC expresses disinterest in a physical/sexual advance.
NPC_Replies The given NPC replies to a neutral statement made by another character.
NPC_Replies_To_Plan_Action The given NPC expresses support or opposition for a non-verbal action made by another character because the action supports a plan the NPC favors or opposes.
NPC_Replies_To_Opinion The given NPC replies (possibly non-verbally) to a verbal statement of opinion.
NPC_Wooed An NPC replies to a pleasing kiss, touch, gesture, etc.
Revenant_Attacks Trumps normal NPC reactions for the revenant. The revenant's only reaction is to attack.
Reactions and one reaction component* in Demeter.

Because Demeter was designed to evaluate Marlinspike's reincorporation feature, Demeter scenes are written to respect whether Marlinspike's reincorporation feature is currently on or off. When it is off, Demeter scenes do not include any of their optional hooks when reporting what events they would reincorporate if played. They also do not include any reference to these hook events when they play. For a full list of all the specific scene changes that result from turning off reincorporation, see Appendix 2.

Tutorial

The Demeter also includes a pre-game tutorial scenario. In this scenario, the PC wakes up in the middle of the night and has to use the restroom. Through a series of in-game prompts and instructions, the tutorial teaches the player the most essential verbs, how to navigate from room-to-room, and how to interact with objects and other characters.

The tutorial uses the Marlinspike drama manager in the same way as the main story. The tutorial is comprised of eighteen scenes. Most of these scenes are very simple: they just prod the user in a certain direction or provide a couple paragraphs of instruction. However, one scene--Miriam_Acts--that controls how an NPC responds to what the PC has done, has over thirty possible permutations.

Conclusion

This completes a brief overview of Demeter: Blood in the Sky. The full game can be played online (Tomaszewski 2011). Also available at this location is the full documentation and source code of both the Marlinspike and Demeter implementations.

Works Cited

Notes

  1. This is the only action name that is clearly a noun where all the others names are verbs. (Verb as in part-of-speech, not world-level-behavior.) I originally thought of this action in terms of "assault and battery". The more correct form--BATTER--made me think of raw cupcakes. So this action is still called BATTERY in the code, and so I am representing that accordingly here.

ToDo