Glk: An Interface Standard for Interactive Fiction
Here's where I talk about what Glk is, why Glk is, and what it's good
for. Unfortunately I haven't actually written this bit yet. Until
I do, please refer to
chapter zero of the specification document,
which explains all the basic ideas.
I do, however, have a glowing
Glk is a free standard. Here's
what I mean by this.
This is the Glk API Specification, version 0.7.4.
And, just as important,
If you're going to run a Glk program, you need a Glk library which
runs on your machine.
The official and up-to-date archive of Glk libraries is on
the IF Archive, under
Here is a list of some of them, but it's not a complete
list and it is not immune to falling out of date:
- CheapGlk library 1.0.5
(C source code for an extremely minimal Glk library; uses only
stdio.h, and allows only a single window. Nonetheless, this
is a fully Glk-compliant implementation.)
- GlkTerm library 1.0.4
(C source code for a terminal-window Glk
library, implemented using the curses.h screen control library.
Should compile on any Unix system or reasonable facsimile,
as long as it has the curses.h library. (No relation to the
- GlkTerm library 1.0.4
with wide char support
(Same as above, modified to use ncursesw or ncurses to display
and accept all Unicode characters which the terminal supports.
By Alexander Beels.)
- RemGlk library 0.2.2
(C source code for a remote-procedure-call Glk library.
This uses stdin/stdout, but it's not as cheap as CheapGlk;
it supports multiple windows. Generates output, and accepts
input, in structured JSON form.
- IosGlk library 0.2.0
(ObjC source code and Xcode project for an iOS Glk library.)
- MacGlk library 0.8.7
(CodeWarrior library package for a Macintosh Glk library.
And source for same.)
- GlkDOS 0.19.1
(a Glk library for DOS.
And source code.
By L. Ross Raszewski; see
his GlkDOS page
for more info.)
- DosGlk version 1998101701
(an older Glk library for DOS; 16-bit and 32-bit libraries included.
And source for same.
By Matt Kimball (firstname.lastname@example.org))
- WindowsGlk version 1.2.1
(a Glk library for Windows 95/98/NT/00.
By David Kinder.)
- XGlk library 0.4.11
(C source code for an X Windows Glk library. Should compile on
any Unix system which has X installed.)
- GlkLoader 0.3.0
(C and Perl source for a Unix library that can dynamically load
any other Glk library, without recompilation.
By Joe Mason.)
although not identical to, the Glk API.
These are source files that come with the Glk API, although they're
not actually part of it. If you're writing a Glk library, you'll want
to look at them. See the spec for their full ineffable significance.
- The Dispatch Layer: This allows virtual machine interpreters
(and other run-time systems) to use the Glk API dynamically. To
interoperate with the dispatch layer, a Glk library must include
- The Blorb Layer: This allows the library to load
images and sounds from a portable archive. To
interoperate with the Blorb layer, a Glk library must include
In addition to a couple of pedagogical sample source files,
we have games, interpreters, and other such goodies.
(C source code for a simple model IF program;
reads a line of text and reacts to it, maintains a status window,
(C source code for another Glk model; this one demonstrates multiple
windows, timed input, and Latin-1 characters.)
- Dungeon 3.2B for Glk
(C source translated from the most recent Fortran source.)
- Dungeon 3.2B with GDT for Glk
(same as above, but with the in-game debugger -- thanks Paul Goyette.)
- Floo (a simple Glk-native scripting language.
This gets a whole directory to itself, so look here for interpreters,
- TADS has been ported to Glk by Stephen Granade. It fits
very well -- though that shouldn't be too much of a surprise,
since the lessons I learned making MaxTADS went into Glk's design.
TADS directory on the IF Archive.
(The Glk port is included in the main source distribution.)
- Hugo has also been ported to Glk. The connection is rather
more awkward, because Hugo has a more complex display model that
doesn't map well to Glk. Many Hugo features are not supported.
Hugo directory on the IF Archive.
And here is
the Mac executable (v25), which I
is a Glk-based Z-machine interpreter, written by
Evin Robertson. See also
Nitfol directory on the IF Archive.
is another Glk-based Z-machine interpreter, written by
is a demo / test for Glk graphics windows, written by
L. Ross Raszewski.
And if you're not into compiling, you can download the Glk
programs as ready-to-run executables, for a couple of platforms
Some other documents of relevance:
And, just to show off what I'm doing here:
I've posted RemGlk, a very experimental library
that uses JSON structured data on stdin and stdout.
API spec 0.7.4! Adds a way to read data from a Blorb chunk.
API spec 0.7.3! Expands the audio functions.
API spec 0.7.2! Adds date and time (clock and calendar) functions.
API spec 0.7.1!
API spec 0.7.0! Now with Unicode.
- winmethod_Border and winmethod_NoBorder constants, to request a border
or no border between Glk windows.
- glk_set_terminators_line_event(), to allow line input to be submitted
when specific special keys (e.g., function keys) are hit.
- glk_set_echo_line_event(), to control whether line input is echoed when
the line is submitted or cancelled.
- glk_buffer_canon_decompose_uni() and glk_buffer_canon_normalize_uni(),
to normalize Unicode strings (Normalization Forms D and C).
Alexander Beels has contributed a port of GlkTerm which can accept
and display Unicode characters, using the ncursesw library.
Last updated October 15, 2016.
Glulx home page