Advanced graphics for Inform 7

Posts tagged ‘releases’

Glimmr Canvas Animation released

Glimmr Canvas Animation–previewed here, here, and here–has been released and is available for download at Google Code. (The extension can also be downloaded from the Inform site, though without the image assets needed to compile the examples.)

The "Scourge of the Vampyr" demo

What is Glimmr Canvas Animation? Glimmr Canvas Animation sits on top of Glimmr Canvas-Based Drawing and allows for graphic elements of any type to be animated. GCA is built on the concept of the animation track. An animation track handles one kind of animation effect for one graphic element, but tracks are stackable, so it’s possible build up quite complex animations. GCA allows for flipbook-style animation of sprites or background images, for dynamically scaling graphic elements, for (limited) fade-ins and fade-outs, and much more. All of these preset animation types can be invoked in just one or two lines of code, or tweaked and customized with as much additional logic as you like. GCA supports 15 different equations for the automated “easing/tweening” of animations to make them more natural or more interesting. The extension includes a robust debugging log, as well as a number example code demos (see screenshots in this post).

There have been a number of new features added to Glimmr Canvas Animation since it was first previewed. The most notable of these is the introduction of “virtual timers,” which allows multiple concurrent animations to run at different speeds. The beta version of GCA required all animations to run at the same speed, so this should allow for more flexibility.

I hope you’ll check out GCA!

Download Glimmr Canvas Animation

Screenshot of the "Eased Movements" demo. Movement simulated (poorly).

New Releases: Glimmr Form Fields and Glulx Input Loops

UPDATE 11/3/2011: Glimmr Form Fields is now available in release 3 of the full Glimmr release zip archive, as well as at the Inform 7 extensions library.

I’ve finally come to the end of a rather quixotic quest. A strange bug bit me while I was finishing up the main Glimmr package a few months back: I wanted to leverage Glimmr’s capabilities to create a relatively easy way for authors to offer HTML-style form fields within an IF game. Why on earth did I want to do that? Not for any good reason; in fact, I still haven’t come up with a practical IF-related use for it that would justify the hours it eventually took from me! Other than perhaps to remake Bureaucracy (see image below for a form from that game).

Screenshot of color picker

A simple RGB color calculator made with Glimmr Form Fields

In the end, I had to create two extensions to accomplish this goal: Glimmr Form Fields and Glulx Input Loops. (If you’re curious about the form fields, you can download compiled example games here; this will let you see how it works without firing up Inform 7, installing dependencies–of which there are many–etc. See the note about interpreters below.) A short discussion of how the one led to the other follows.

The basic mechanics for graphic form fields were easy and I was able to put a prototype together in just a few hours. I had good, general-purpose yet customizable ways to control text entry into the field, the backspace key, moving the cursor within the field, and so on. This rested (and still rests) on a couple of subterfuges: First, of course, the “text” in the form fields is not actually text but individual letterform graphics strung together to form words. Second, one doesn’t type really anything “into” the text fields; instead, we are receiving per-character input in the main text window and converting that for display in the graphics window.

Pre-HTML form fields from Infocom's Bureaucracy, by Douglas Adams (screenshot by Moby Games user Belboz)

It was the latter that caused me real headaches. Not because it was difficult to create something basic, but because I wanted the user (player) to be able to interact with multiple fields, clicking on one to type and then clicking on another to enter text there. Inform’s built-in input routines are very simply structured, and this turned out to be a sticky problem: Multiple fields easily led to nested loops that would quickly crash the program, or lead to other difficulties.

So, I had to make a bit of detour, and get an education in the finer points of Glulx input and Inform 7‘s (and Inform 6’s) implementation of input (special thanks to Zarf, the creator of Glulx, for his help–and patience). In the end, I decided to more or less rewrite the library input routines. Without going into great detail, the Glulx Input Loops extension gives the author many more hooks for decision-making within the overall “loop” of input to action-processing. It also introduces named input loops, as well as the idea of the “secondary” input loop, which shares input-handling with the “primary” loop; this goes a good way toward preventing the kinds of nasty nesting problems that can result when some types of input spawn new requests for input.

A diagram of primary vs secondary input loops

A (perhaps somewhat cryptic to the uninitiated) flowchart showing the relationship between primary and secondary input loops as defined in the Glulx Input Loops extension.

The new hooks provided by Glulx Input Loops let me complete Glimmr Form Fields as I wanted, avoiding the issues with event nesting. Glulx Input Loops also resulted in the keystroke input experiment I posted a month or so back. I hope that it proves to be a useful extension, and I think it will, particularly to those experimenting with alternate input paradigms.

I’m still asking myself why I dedicated myself to implementing form fields, though. The end result is pretty neat, but its neatness is not really IF-related… Who knows, maybe someone will think of something to do with it; the tool is there, at least. In the meantime, if you have your any ideas for using Glimmr Form Fields in IF, please feel free to leave a comment below–I’d love to hear that someone might actually get some use out of it!

A note for Mac users who might want to check out the Glimmr Form Fields compiled examples: If you are using a Mac, you probably default to using Zoom or Spatterlight as your interpreter of choice. Neither is a good fit for Glimmr, however. The current version of Zoom (1.1.4.1) has a few bugs that impact heavily on Glimmr games, while Spatterlight is too old to have taken advantage of recent advances in speed (or bugfixes). Please consider downloading Gargoyle instead. (Gargoyle is also recommended for Linux and Windows users, though the latter have the option of Windows Glulxe/Windows Git.)

A minimalist exercise with Glimmr Form Fields, showing just one field.

A minimal implementation of Glimmr Form Fields.

Glimmr extensions updated for Inform build 6F95

UPDATE 1/3/2011: Glimmr Canvas Editor has now been updated and a new full release archive (release 3) of Glimmr has been posted at the Google Code site.

Inform build 6F95 has been released. This release of Inform is primarily a maintenance release, but it still required quite a few changes in the Glimmr extensions. Updated versions of all of the Glimmr extensions have now been submitted to the extensions library, except for Glimmr Canvas Editor (which requires Dynamic Objects, which has not yet been updated for 6F95).

If you prefer, you can also download them directly from the SVN repository, or by browsing the source here (click on the “view raw file” link on each extension’s page). You can also get Glimmr Automap and Glimmr Form Fields as separate 6F95-compatible archives on the downloads page.

A zip archive of all extensions and related image resources will be released when Glimmr Canvas Editor is updated.

Glimmr released

Glimmr, a set of extensions for use with Inform 7 and the subject of this occasional blog, has finally been released. For the uninitiated, Inform is software for writing interactive fiction, otherwise known as “text adventures,” using English-like sentences. Inform can compile to the Glulx virtual machine, which allows for graphics, sound, and other features. But Inform’s native support for these features is quite meager, and Glimmr is an attempt to bring Inform’s support for graphics up to the level of Glulx’s potential.

Glimmr is a modular system of extensions. Several of these extensions can be used independently of other Glimmr modules, but they gain additional capabilities when used in conjunction. The bedrock extension, Glimmr Drawing Commands, provides basic instructions to draw a wide variety of entities, from simple rectangles, to external images files (PNG or JPEG), to bitmaps and even painted text. Here are some representative drawing commands:

Representative drawing commands available using Glimmr

Other extensions are what we might call “data” extensions, which don’t themselves provide new functionality. Fonts and tilesets are distributed in this way. Examples include Glimmr Bitmap Font and Glimmr Image Font.

But the core of Glimmr is the Canvas-Based Drawing extension. This module supplies a complete screen model for graphics windows, using the notion of the “canvas”. Graphic elements–anything that can be drawn using Glimmr Drawing Commands, or any new command the user wishes to invent–are assigned to a canvas. The canvas can then be shown in a graphics window. The scaling and the framing of the canvas within the window can be controlled, and canvases can be swapped out at will. It is easy to specify the layering of elements on the canvas, so that in effect graphics can be displayed along three axes (x, y, and z). Canvas-Based Drawing allows for complex and dynamic compositions to be created relatively quickly. The Glimmr Graphic Hyperlinks extension automates the handling of mouse input to any element.

Glimmr ships with another extension, built on Canvas-Based Drawing, called the Glimmr Canvas Editor. The Canvas Editor is meant to be compiled as an independent project, not as a part of another game, and it produces a complete GUI graphics editor that can be used to draw elements of various types to a canvas, visually. Once the canvas is complete, you can export it as Inform source code for use with Canvas-Based Drawing. Special features are included to deal with canvases that change over time, such as maps that dynamically reveal themselves as the player discovers new locations in the game.

Download Glimmr.

Follow

Get every new post delivered to your Inbox.