Archive

Posts Tagged ‘LiveCode’

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.

Advertisement

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!

LiveCode Navigation Sourcefile

For those of you interested in taking a look at the LiveCode source for the HWLN navigation, feel free to download here. This file was developed in LiveCode Community Edition 7.0.0 | Build 10018.

Navigation QA: Checking the Map

August 22, 2014 3 comments

It’s been a while since the last update, as I’ve had several projects eat into my time both for work and for my dissertation. As it turns out, the dissertation is giving me the excu–uh, reason to reapply some focus on the Historical Williamsburg Living Narrative. I’ll need to have a simple version of the game up and running to provide to instructors willing to use the game in the classroom. That means I need to work on it.

I’ve gone back and forth and back again on the development tool to use for the project, from Inform 7 to Adrift to LiveCode, and right now I’m settled on LiveCode for the amount of control I have in building the interface and interaction framework for the game. Currently I’ve developed a simple version of the program that does nothing but navigate through the map, currently 199 separate locations, using abbreviated compass directions: n, ne, e, se, s, sw, w, and nw. The map is below, and you can access a PDF version: Logical Map – Nav Test.

Logical Map - Nav Test

 

Of course, you will need to actual program to run as well, if you’re interested in checking out the navigation. You may obtain that by accessing it by clicking this link. The file is a Windows version program Zip compressed for faster download. If you’re interested in a Mac version, leave a comment and I’ll compile a version for download.

If you intent to perform quality assurance testing and provide feedback, simply leave comments in response to this post. Be sure to list the error you found, how you encountered the error, and what the error does or doesn’t do. Most likely, errors at this stage will be discrepancies between the visual map and the navigational structure within the program. The visual map (above) is correct; the program will need to be corrected if any discrepancies are found.

One final note: anyone finding errors in the program will be listed as QA testers, being listed in the release version credits. So have at it!