Archive

Posts Tagged ‘Hap Aziz’

The Problems with Paths

Navigation is a fairly straightforward process in Interactive Fiction, and it can be implemented in a number of ways, depending on the authoring system you are using. With Inform 7, which is a powerful yet relatively simple plain-English system, you can create a path between two rooms very easily;


The Library is room
The Parlor is south of the Library.

The code above immediately creates a room/location called Library. The a second room is created in a relative position, south, from the first room, and the second room is call Parlor. Since Inform 7 manages the room relationships, when executing the above snippet will have you “starting” in the Library, and you will be able to go south into the Parlor, and then north again back into the Library simply by typing “south” and then “north” in the automatically provided prompts.

This is one of the advantages in using Inform 7 when creating your game, as the system manages all location relationships (among other things). In this way you can create a fairly complex geographical space which to explore, without having to do a lot of work setting up variables, arrays, conditional statements and so on.

Unfortunately, this kind of high-level ease comes at the price of less granular control and flexibility over what can be done in the program. One of the functions that Inform 7 does not provide (without creating extensions) is the ability to think of paths between map locations as “locations” themselves, with their own descriptions and attributes. Additionally, paths should have different descriptions based on the direction of travel. Using an typical programming language this can be implemented straightforwardly through the use of arrays.

In order to add this and other functionally to the project, I decided to move the program from Inform 7 to the LiveCode language (an open source version is available). I selected LiveCode because of it’s robust built-in text processing functionality, which means the parser that I build can easily identify words and phrases without having to do any character counting. LiveCode is also loosely typed, so I can deal with variables much more easily.

Using LiveCode, I’m able to conceptualize paths as locations, yet I’m able to have the program “pass through” without stopping or identifying the paths as specific places to stop or break the action. This means I can leave one building to cross the street to the entrance of another building, and action can take place in the street along the way. Consider the mini-map below.

There are two locations here. Location 37 which is west of Location 19. There is a path between the two, which you may assume is bi-directional. So if I were in Location 37 and typed “east” as my command, I would be taken to Location 19. It might look something like this in my display:


You are in Location 37.

>> west

You are in Location 19.

Certainly I could change the description of Location 19 to include a little bit of travel observation, such as:


You are in Location 37.

>> west

You walk across the rough grass to Location 19.

But this introduces more programming complexity. First, what if I could enter Location 19 from the north and the south as well? At that point, adding the path description into the location description would not make sense.

Instead, in LiveCode I am able to create another array that keeps track of path descriptions and other attributes. I can use the format:

aPath[x, y, z]

Where aPath is the array name, the variable x is the initial location and the variable y is the destination location. The variable z can be used for a number of attributes such as the path description, path status (if there is an open or closed door), etc. For example:

aPath[37, 19, 0]

would signify the path description when moving from Location 37 to Location 19, and reversing the direction would yield a different description:

aPath [19, 37, 0]

There is quite a bit more that can be accomplished with this separate path designation, including allowing players to find or leave objects on paths, encounter non-player characters, experience different weather conditions, and find barrier puzzles that need to be solved. From my point of view, it’s much easier to manage this through LiveCode (or any other high-level language) rather than using Inform 7, which makes certain assumptions as to how Interactive Fiction should work.

Changes are Coming!

This is just a brief update to mark the change from Inform 7 to LiveCode as the HWLN development platform. There are a number of reasons for the change, including greater programming flexibility and the ability to create executable files for multiple devices and operating systems from a single code base.

I’ll be posting code samples soon!

Timed Events that Vary According to Location

In the traditional sandbox-environment Interactive Ficton game, there are often puzzles to be solved through the discovery and manipulation of objects found in different locations in the game space. Keys to open locks. Code-breaking devices. Hidden treasures to placate or weapons to defeat enemies. In the Historical Williamsburg Living Narrative, the game play is somewhat different, primarily because the narrative is based on factual and well-documented events involving known historical figures. Entering locked rooms or discovering hidden passages, for example, isn’t as effective a way to advance the story, since the point of the game is to retell a story where the outcome is predetermined. To some degree, the player is more an observer rather than actual agent of change. That’s quite all right though, with interactivity being served by giving the player the ability to experience the story from different perspectives of time and place.

The narrative, then, is the main driver of game play, and in order to experience the game, the player needs to be in certain places at certain times. Unfortunately, it is the sandbox environment that challenges narrative integrity. For example, imagine that the player needs to overhear a conversation between two characters at a particular time and in a particular place. What happens if the player is in an entirely different location far removed when the conversation takes place? Here we see the need to provide latitude for the time and place for the occurence of events. Fortunately, creating a flexible framework to ensure exposure to relevant events is fairly straightforward.

The method is to determine a zone rather than particular location in which narrative drivers may occur, and then the actual event may occur after a particular time rather than exactly at that time. Finally, once the event has taken place, there needs to be a way for the game to track that so the event does not continue to trigger. The following code shows a way to handle this in Inform 7.

informcode

Here we see that the event is triggered if the time is after 5:08 PM (and not exactly at), as long as the variable placeevent has not been incremented from its initial value of 0. Once these criteria are met, the actual event occurs differently across six different locations. Finally, when the event takes place in one of two locations with the player there to witness it, the placeevent variable is changed.

This framework allows us to set up event conditions throughout the game (both in time and space), with enough latitude to ensure that the player experiences everything necessary to understand the game. The Historical Williamsburg Living Narrative is built on this foundation.

Latest Williamsburg Game Map

I’ve been working on updates to the building interior locations. This map reflects the latest navigation scheme. I’ll have the next playable release available to Kickstarter backers up shortly.

williamsburg-game-map-15

A Sequential Calendar with Inform 7

The Historical Williamsburg Living Narrative depends on having an internal calendar so that days and dates may be tracked, thereby driving the narrative forward with some measure of historical accuracy. The story begins on April 20th, 1775, and what happens in the early hours of April 21st are key to the story. While Inform 7 has some built-in functionality to deal with the time of day, I haven’t found any functionality around tracking the days that pass. Specifically, I want to be assured that the day and date change when the time crosses midnight.

To deal with this, I developed a little bit of code logic to handle the passage of time from one day to the next. One of the key things I discovered about Inform 7 is that its day marker is at 4:00 AM rather than at 12:00 AM. Once that is understood, writing the code depends on a three-way conditional rather than a two-way version. The following code can be modified for your specific needs:

calendarcolde

The code is generic, so you can alter to adjust for your needs. I’m using a version that’s only very slightly modified to meet my game needs.

If anyone has a more elegant solution (or knows of an existing Inform 7 command that might help), please drop me a line!

EDIT: I’m using time spans rather than a specific time (11:59 PM) to check the state because the player character may be asleep from before 11:59 PM to well after.

 

Latest Playable Release – HWLN13

The latest version is up for Backers to download. The new map includes the layout of the Governor’s Palace from the cellar to the third floor.

Latest Playable Release – HWLN12

This report recently went out to all of the game Backers on Kickstarter. The actual download location is available only to the Backers.

**********

Greetings, Backers!

I new version is available for download at [URL HIDDEN]. Included in the .zip archive is a map of the locations.

A quick word about the map: where you see the location names highlighted in blue, the blue portions indicate a shortcut in the game navigation system (meant for speedier play testing only). For example, on the map is the “Military Encampment” location with the word “Military” in blue. When you are playing the game, type “xmilitary” at the cursor and you will be immediately taken to the Military Encampment. This will work for any of the locations in blue.

A big “thank you” goes to backer Vivianne D. for her work on the navigation code in Inform 7. Now when you type “dir” at the cursor, the game will display all possible directions (unless specifically hidden) based on room relative location definitions. Previously, I had been hand coding all those directions.

Otherwise, changes in this version are not major. Cleaned up more descriptions, added some detail, etc. Feel free to play it and let me know what you find.

In an upcoming release I will be publishing a guide that provides a listing of the possible commands.

Hap

Interested in getting started with Interactive Fiction?

If so, this primer by Andrew Plotkin will give you an introduction. The handy-dandy reference card is especially helpful.

http://eblong.com/zarf/if.html

Other Historical Communities and Locations

While historical Williamsburg (as managed by the Colonial Williamsburg Foundation) has been my focus, there are other historical communities, sites, and museums that are definitely worth visiting. A few that I want to mention here are

  • Deerfield, Massachussetts – an authentic 18th-century New England village in the Connecticut River Valley of Massachusetts
  • Gettysburg, Pennsylvania – site of one of the most famous battles of the American Civil War
  • Monticello – Thomas Jefferson’s home and plantation in Charlottesville, Virginia
  • Mount Vernon – The Virginia home to the first President of the United States, George Washington
  • Winterthur, Delaware – a rich museum of American decorative arts that reflects both early America and the life of the du Pont family

Navigation Test

For the Backers of the Kickstarter project, I’ve posted a Blorb Glulx Game file that will allow the player to go through the physical location map, seeing descriptions, and testing a few other commands as well. If you’re a Backer, check your email for the Update that has the location of the file download.