Preview: Graphical automapping extension (I7 + Glulx)

There’s been quite a bit of interest in mapping, automapping, and roguelikes expressed recently, both here and on rec.arts.int-fiction, so I thought this would be a good time to share a preview of an extension I’ve just completed. This extension provides a graphical frontend (Glulx only, of course) to Mark Tilford’s very nice Automap extension. It renders the map calculated by Automap in a Glulx graphics window using a set of image tiles. Authors can customize tilesets, and can create and distribute their own as I7 extensions (plus image files). Here’s the example file:

dl.dropbox.com/u/947038/Glimmr%20Automap.gblorb

The player is provided with buttons for zooming the map (you can also type ZOOM IN or ZOOM OUT), as well as to query the map. To query the map, press the ? button, then click a room on the map. A tooltip will appear that displays the room’s printed name. This example also includes custom functionality not included in the extension; click on a room in the map when the query button is not active to go to that room.

In order to provide a map that’s both large in scale and reflects realistic game-play, I’ve used the geography of Emily Short’s Bronze for this example (with a couple of modifications). I don’t think there’s much chance of having that game spoiled for you by this map, but if you’re planning to play Bronze in the near future, you might want to refrain from trying out this example until you’ve done so.

Some features:

  • Tilesets are packaged as extensions, so you can create and share
  • Interface is fully–and easily–skinnable
  • Abundant hooks in the code for further customization
  • If your interpreter doesn’t support graphics, should gracefully fall back to Automap’s standard text interface
  • Built on Flexible Windows, so you can have multiple text and graphics windows alongside the map

Many thanks are due to Mark Tilford, not only for creating Automap, but for making it so easy to hook up an alternate output system–and for implementing a few changes that would allow graphical tilesets to be more flexible and aesthetically pleasing.

This graphical implementation of Automap is part of a larger, modular system of extensions tentatively called Glimmr. It will likely be released soon after the next release of Inform, but not before (the new build of Inform incorporates changes to the way images are stored internally, and I’ll need to update Glimmr before it will work with the new build). Apart from implementing these changes, work on the existing Glimmr modules is all but complete. The major task remaining is to write documentation; since there are currently something like 13 Glimmr modules of varying complexity, this is not quite a trivial task (if anyone wants to help out, drop me a line!)

A few notes on interpreters: I’ve tested Glimmr Automap with Zoom and Spatterlight on the Mac, and with WinGlulxe, WinGit, and Gargoyle on Windows. I have not been able to test with a text-only interpreter. Speed comparisons: Zoom is much slower under Snow Leopard than under Leopard (likely to be fixed in an upcoming release), so it feels a little clunky (there is also a bug in Zoom that causes the query tooltip to be displayed as cyan rather than yellow). The latest version of Gargoyle for Windows is extremely fast. Spatterlight works is pretty slow with graphics and requires, as always, double-clicking rather than a single-clicking for mouse input.

Comments, questions, and suggestions are welcome, as are bug reports. I’d also like to hear how it works on different interpreters, especially on Linux and on text-only interpreters.

Thanks!
Erik

Postscript

Some may be in interested in how much work it is to use Glimmr Automap. Below is the full source of the posted example, minus the worldbuilding and textual output. Minimally, all that’s required is to define a window for displaying the map. This code also implements a simple command to allow the player to go to a room by clicking on it.

Include Glimmr Automap by Erik Temple.
Include Glimmr Automap Tileset by Erik Temple.

[Automap settings:]
Use automap reserved area of at least 800. [This looks like a minimum, but it is actually a maximum; specifically, the maximum number of map tiles that can be displayed on-screen at a time.]
Use automap hide paths through closed doors.

[Glimmr Automap settings:]
Use query explanation. [Allows the author to provide an overlay on the map to explain what happens when the map query button is pushed.]

First when play begins:
	activate UI-query. [Add the map query button to the interface]


Chapter - Map window

The map-window is a map-display window spawned by the main-window. The position is g-placeabove. The measurement of the map-window is 50. The associated canvas of the map-window is the map-canvas.

The map-canvas is a g-canvas. The associated canvas of a g-element is the map-canvas.


[We can specify the maximum width and/or height, in tiles, that will be displayed in our map window.]
The maximum map width of the map-window is 40.
The maximum map height of the map-window is 20.


Chapter - Clicking to move

[By default, Glimmr Automap responds to mouse input within the map by displaying a "tooltip" that shows the printed name of the room clicked on. However, we may also want to do other things with mouse input to the map, such as moving to the room clicked, or displaying what the player knows about the room, etc. In this case, we can either deactivate the query functionality altogether, or activate the query button, which allows the player to move between query and custom modes. That is the approach taken in this example. The primary map hyperlink mode is defined here, using the go to any room code from the Safari Guide example in the Inform documentation.]

Understand "go to [any room]" as going by name to. Understand "[any room]" as going by name to. Understand "[door]" as entering.

going by name to is an action applying to one thing.

Check going by name to:
	if the noun is the location, say "You're already in [the location]." instead.

Carry out going by name to:
	while the player is not in the noun:
		let heading be the best route from the location to the noun, using even locked doors;
		if heading is not a direction, say "You can't think how to get there from here." instead;
		let destination be the room heading from the location;
		say "(heading [heading])[command clarification break]";
		try going heading;
		if the player is not in the destination, rule fails.

Automap graphlink rule for a room (called the target):
	change glulx replacement command to "GO TO [the printed name of the target in upper case]";
	exit.

Wow, very cool!

I don’t have much to report for bugs yet (I just tried it with WinGit), but the interface looks good! I’m curious if there’s a way to customize the graphic for exit links as well? I’m guessing there is?

Thanks! The tiles are individual PNG files; all you have to do to customize any of the tiles for your own project is replace the default tile file with your own design. (I don’t much like the inside/outside graphic either–any ideas for something better?)

If you want to create your own tileset entirely, I’ll be distributing a template file to make this easier, whether you just want to use it for reference, or as a starting place for your own tiles. Here’s that file in SVG format (originally created with Illustrator):

dl.dropbox.com/u/947038/Tileset%20template.svg

–Erik

Excellent! Looks nice in Zoom.