Debian Codegraph @

terps/agility/readme.glk

raw
1 AGiliTy, notes for the Glk version
2 ----------------------------------
3
4 (General information can be found in readme.agility)
5
6
7 Introduction
8 ------------
9
10 This is a port of the AGiliTy interpreter to Glk. The complete interface
11 lives in the single file
12
13 os_glk.c
14
15 The main test and development system for the port is Linux, with Xglk as the
16 Glk library.
17
18 Glk AGiliTy is configured to be as close as possible to the pure ANSI build.
19 This is because Glk is a cross-platform I/O library, so using pure ANSI gives
20 it the best chance of working on multiple Glk libraries.
21
22
23 Acknowledgments
24 ---------------
25
26 Thanks to Robert Masenten, [email protected], for answering several queries
27 about porting AGiliTy to Glk, and for writing AGiliTy in the first place; Ben
28 Hines, [email protected], for the Mac-specific portions of the Glk
29 porting code; and Andrew Plotkin, <[email protected]>, for Glk, and for
30 putting me straight on a couple of the finer points of Glk operation.
31
32
33 Running Games
34 -------------
35
36 The interpreter understands both standard AGT game files and "AGX format"
37 (AGiliTy file format) game files. Standard AGT games are distributed as a
38 collection of files, with different extensions (".d$$", ".da1", ".da2" and so
39 on). AGiliTy games use the extension ".agx".
40
41 Give the name of the game to run at the system prompt. For example, if the
42 game is held in files "cosmos.d$$", "cosmos.da1", and so on, use
43
44 glkagil cosmos
45
46 If several builds of Glk AGiliTy are available, linked with a selection of Glk
47 libraries, they will be named appropriately, for example xagil, termagil, and
48 cheapagil.
49
50 The interpreter prefers that filename extensions be lower-case, that is,
51 ".da1", ".da2", ".agx", and so on, rather than ".DA1", ".DA2", and ".AGX". If
52 you are unpacking AGT files from ZIP archives, you may need to use unzip's '-L'
53 option to make sure that filename are extracted correctly.
54
55 Having said that, there's a minor GLK-specific patch in the core AGiliTy
56 interpreter (filename.c, for what it's worth) that retries a file with an
57 uppercase extension if the expected lowercase name is not found. That should
58 help with archives unpacked without the '-L' option. Running a game then
59 becomes
60
61 glkagil COSMOS
62
63 Glk AGiliTy takes a small liberty with the C runtime on exit. It might cause
64 some problems, such as a core dump or abort, when the program exits on an
65 error condition. If you find that this happens on your system, you can either
66 rebuild to avoid this, as described below, or set a value for the environment
67 variable GLKAGIL_CLEAN_EXIT.
68
69 As well as standard AGiliTy command line options, there are a number of Glk
70 Agility specific command line options that you can specify, to vary the way
71 that the game looks:
72
73 -gf Force Glk to use only a fixed width font
74 -gp Allow Glk to use only a proportional font
75 -ga Try to use a suitable Glk font automatically
76 -gd Delay for the full period in Glk
77 -gh Delay for approximately half the period in Glk
78 -gn Turn off all game delays in Glk
79 -gr Turn off Glk text replacement
80 -gx Turn off Glk abbreviation expansions
81 -gs Display a short status window in Glk
82 -gl Display an extended status window in Glk
83 -gc Turn off Glk command escapes in games
84 -gD Turn on Glk port module debug tracing
85 -g# Test for clean exit (Glk module debugging only)
86
87 See below for further information about what these options mean.
88
89
90 Compiling
91 ---------
92
93 To compile Glk AGiliTy for Linux, first unpack the source files. You might
94 need to use the -a argument to unzip in order to convert text files for your
95 system.
96
97 Edit Makefile.glk so that it has the right path to the Glk library you wish to
98 build with. If you want to build the IFP plugin, also edit the parts of
99 Makefile.glk that have paths to IFP components.
100
101 To build a standalone version of Glk AGiliTy, use
102
103 make -f Makefile.glk glkagil
104
105 To build the IFP plugin, use
106
107 make -f Makefile.glk agility-1.1.1.so
108
109 To clean up and delete everything in the case of a build error, use
110
111 make -f Makefile.glk clean
112
113 Glk AGiliTy contains a few non-ANSI/ISO artifacts that might cause problems on
114 non-Linux systems:
115
116 Fdopen(), dup(), and file descriptors, used to open save and restore
117 files, are not portable. You can turn off these features by defining
118 GLK_ANSI_ONLY in Makefile.glk.
119
120 At times the module may indirectly call exit() from within an
121 atexit() handler. This is "undefined" in ANSI. The Linux and SVR4
122 C runtime libraries behave well, but if you find it causes problems
123 (for example, an occasional core dump or abort on exit) you can turn
124 it off by defining GLK_CLEAN_EXIT in Makefile.glk.
125
126 See the comments in the source for Glk AGiliTy for more information on these,
127 and the information on "-g#" later on in this readme file for details on how
128 to check for problems with exit() and atexit().
129
130 For building on the Mac platform, Ben Hines has supplied a set of Code-Warrior
131 and application specific settings in a resource file, for use with the Mac Glk
132 library. You should find this file in the source distribution under the name
133
134 os_glk_MacResFile.hqx
135
136 The source of Glk AGiliTy has changed somewhat since Ben created this resource
137 file, so it may, or may not, currently be fully functional.
138
139
140 Configuration
141 -------------
142
143 Glk AGiliTy opens no global configuration file, and takes no special
144 configuration options.
145
146 If you need to set options that can't be set with AGiliTy command-line flags,
147 you'll need to create a special file called <game>.cfg alongside the other AGT
148 game files, or edit any existing <game>.cfg. Glk AGiliTy will find this file.
149
150
151 Status Lines
152 ------------
153
154 Glk AGiliTy displays a status window at the top of its display, providing the
155 Glk library it is using supports separate windows. The status window can show
156 either one or two lines, for normal or extended status.
157
158 The first line of status is the standard information printed by the core
159 interpreter or the game, normally the location, and the game score and/or time.
160 The second line shows a list of exits available, and if in a game delay, a
161 waiting indicator.
162
163 You can use the "-gs" option to select a short status display, and "-gl" to
164 select an extended status display.
165
166 Where the Glk library does not support separate windows, Glk AGiliTy will
167 print the status line in "[...]" brackets at the beginning of any game output,
168 but only when it has changed since the last game turn. It will also only
169 print the short status display; to get a list of exits, use the AGiliTy
170 "listexits" command.
171
172
173 Expanding Abbreviations
174 -----------------------
175
176 Many IF games systems allow a player to use single character abbreviations for
177 selected common commands, for example, 'x' for 'examine', 'l' for look, and so
178 on.
179
180 AGiliTy expands many of these in the same way, but it's not completely
181 consistent with other well-known systems. To try to help with this, Glk
182 AGiliTy will automatically expand a selection of single character commands,
183 before passing the expanded string to the game as input. It expands a command
184 only if the first word of the command is a single letter, and one of the
185 following:
186
187 'c' -> "close" 'g' -> "again" 'i' -> "inventory"
188 'k' -> "attack" 'l' -> "look" 'p' -> "open"
189 'q' -> "quit" 'r' -> "drop" 't' -> "take"
190 'x' -> "examine" 'y' -> "yes" 'z' -> "wait"
191
192 If you want to suppress abbreviation expansion, you can prefix your input with
193 a single quote character (like putting literal strings into a spreadsheet).
194 If you do this, the Glk interface will strip the quote, then pass the rest of
195 the string to the main interpreter without any more changes. So for example,
196
197 'x something
198
199 will pass the string "x something" back to the game, whereas
200
201 x something
202
203 will pass "examine something" back to the game.
204
205 You can turn off abbreviation expansions with the command line option '-gx'.
206
207
208 Game Text Output
209 ----------------
210
211 AGT games generally presume they are running on fixed width font, 80x25 IBM PC
212 displays. They expect to have this screen width on many occasions, and use
213 spaces, IBM box-drawing and other code page 437 characters, and other DOS
214 'tricks' to achieve certain effects with output text, creating line breaks as
215 needed.
216
217 In comparison, Glk's basic text model is that the output library should take
218 care of text formatting. It behaves best when using a proportional font, and
219 sticks rigidly to ISO-8859 Latin 1 character encoding which, while it has
220 international characters in it, does not have box drawing characters.
221
222 This leads to somewhat of a mismatch of requirements and capabilities for the
223 Glk version of AGiliTy. While Glk will work with fixed width fonts, it does
224 not necessarily offer any form of attributes or color for such fonts, making
225 the output appear one-dimensional and lifeless. On the other hand, the
226 assumption in games and the interpreter is that the font is fixed width, and
227 the screen is 80 columns wide.
228
229 To attempt to smooth over this, Glk AGiliTy will try to guess whether a chunk
230 of game output text needs to be displayed in a fixed width font, or if it will
231 look okay when rendered in a proportional one. This is akin to a form of
232 "screen scrape": Glk AGiliTy buffers all of the text that the game outputs,
233 then runs over it with a set of functions that try to re-paragraph the text,
234 identify any tables or other areas that are likely to be sensitive to font
235 width, and finally print it out through Glk in what is hopefully an improved
236 format.
237
238 Doing this involves some guesswork on the part of Glk AGiliTy, but in testing,
239 it seems to work well enough.
240
241 You can use the "-ga" option to let Glk AGiliTy automatically select what
242 appears to be a suitable font for output, "-gf" to force it to always use a
243 fixed width font, or "-gp" to force it to always use a proportional font (if
244 the Glk library has one). You can also control it while in a game using the
245 "glk fonts" command.
246
247 Note that some games _do_ hint at the type of font they can be used with,
248 though most don't. A game may tell the interpreter
249
250 1) that a fixed width font is required, or
251 2) that a proportional font is acceptable, or
252 3) nothing
253
254 In the third case, the interpreter does not know whether a proportional font
255 can be used, or not. The majority of AGT games seem to fall into the third
256 case, and the interpreter rarely knows the font requirements of a game.
257
258 Any game which does tell the interpreter what font it can use will cause Glk
259 AGiliTy to use that font style on startup, and ignore any value set with the
260 "-g" command line option. You may still however alter the font control with
261 "glk fonts" while in a game.
262
263 In Glk libraries that have only fixed width fonts (for example, Glkterm, for
264 ncurses), you will see much less difference in the display with the different
265 values for font control, but it may still be useful if the text mode display
266 differs widely from AGT's anticipated 80x25 dimension.
267
268 Since many games rely on there being 80 columns of display width, Glk AGiliTy
269 also offers a command to query the current display width. The command to use
270 is
271
272 glk width
273
274 entered at the game's ">" prompt. This prints the approximate width of the
275 display window (actually, it prints the width of the status window, but
276 assuming the fonts in use in each window are approximately the same, the result
277 will usually be close enough). Some Glk libraries are not able to return a
278 window width.
279
280 In general, where a game has a strong requirement for fixed width font text,
281 80 columns or more of display width will probably be fine.
282
283
284 Message Replacements
285 --------------------
286
287 Because Glk AGiliTy buffers all game output, and scans the buffer for ways to
288 try to improve text formatting, it can also replace some of the standard
289 AGiliTy interpreter messages with ones that stand out a little better in a Glk
290 display.
291
292 For example, games usually start up with a message something like:
293
294 This game is being executed by
295 AGiliTy: The (Mostly) Universal AGT Interpreter version 1.1.1
296 Copyright (C) 1996-99,2001 by Robert Masenten
297 Glk version
298
299 Glk AGiliTy will replace this with more or less the same text, but using
300 heading and emphasized text. It handles only a few messages in this way,
301 typically LISTEXIT, VERBOSE, and BRIEF responses, game title pages, and the
302 AGiliTy information page header.
303
304 To turn this feature off, use the '-gr' command line option.
305
306
307 Game Delays
308 -----------
309
310 In AGT games that use delays, these delays can become tiresome. By default,
311 Glk AGiliTy will delay for approximately half the time that the game specifies.
312
313 You can vary this behavior with command line options: use "-gd" to make all
314 delays full length; "-gh" to make all delays short, approximately half length;
315 and "-gn" to turn off delays altogether. You can also change the delay mode
316 with "glk delays" while in a game.
317
318 When the game is delaying, Glk AGiliTy displays a "Waiting..." indicator on
319 the right hand side of the second line of any status window.
320
321 You can cancel a game delay by pressing the space bar while the "Waiting..."
322 indicator is active. This will stop the delay immediately, and also suppress
323 any further delays the game requests until it issues the next input line
324 prompt or requests other keyboard input.
325
326 A few games might not play correctly with delays turned off, so you should
327 take a little care with this option. For example, a game could clear the
328 screen, print a message, delay for a short time, clear the screen again, and
329 continue. With delays turned off, Glk AGiliTy will not get the chance to
330 display the message.
331
332 Glk AGiliTy will not implement game delays if the Glk library does not support
333 timers.
334
335
336 Interpreting Commands Locally
337 -----------------------------
338
339 Glk AGiliTy will handle special commands if they are prefixed with the string
340 'glk'. It understands the following special commands:
341
342 help Prints help on Glk special commands
343 summary Prints all current Glk settings
344 version Prints the Glk library and Glk port version
345 numbers
346 license Prints the Glk port license
347
348 script on Starts recording the game text output sent
349 to the main game window
350 script off Turns off game text recording
351 inputlog on Starts recording input lines typed by the
352 player
353 inputlog off Stops recording input lines
354 readlog on Reads an input log file as if it had been
355 typed by a player; reading stops automatic-
356 ally at the end of the file
357 abbreviations on Turn abbreviation expansion on
358 abbreviations off Turn abbreviation expansion off
359 glk fonts auto, or
360 glk fonts automatic Let Glk AGiliTy determine the appropriate
361 font for a paragraph automatically
362 glk fonts fixed Print all output in a fixed width font
363 glk fonts variable, or
364 glk fonts proportional Print all output in a proportional font
365 width Print the approximate display width; AGT
366 games may expect at least 80 characters
367 statusline extended Show a two line, extended status display
368 statusline short Show a single line, short status display
369 replacements on Replace selected interpreter paragraphs with
370 improved formatted alternatives
371 replacements off Don't replace selected interpreter paragraphs
372 delays full [or on] Make all delays full length
373 delays short [or half] Make all delays approximately half length
374 delays none [or off] Turns off delays altogether
375 commands off Turn of Glk special commands; once off, there
376 is no way to turn them back on
377
378 You can abbreviate these commands, as long as the abbreviation you use is
379 unambiguous.
380
381 If for some reason you need to pass the string "glk" to the interpreter, you
382 can, as with abbreviations above, prefix it with a single quote character.
383
384 You can turn off local command handling with the command line option '-gc'.
385
386 If both abbreviation expansion and local command handling are turned off, there
387 is no need to use single quotes to suppress special interpreter features.
388
389
390 Transcripts and Input Logs
391 --------------------------
392
393 AGiliTy games can themselves set up transcripts and input logs. However, the
394 meta-verbs to set them up can occasionally conflict with commands in the game.
395 It may therefore be more convenient to use Glk commands to create these logs.
396
397 Any Glk AGiliTy transcript or input log is in addition to those that may be
398 set up by the main AGiliTy interpreter, so although not wildly useful, it's
399 possible to create two transcripts and input logs at the same time.
400
401
402 Glk AGiliTy Debug Options
403 -------------------------
404
405 The command line option "-gD" turns on debugging in the AGiliTy Glk I/O module.
406 The output is really only useful when debugging Glk AGiliTy.
407
408 The command line option "-g#" tests for clean program exit. Glk AGiliTy takes
409 a couple of liberties with the ANSI rules for exit handler functions. For
410 most systems, these don't cause any problems, but for some they might.
411
412 To test to see if your system is affected, run Glk AGiliTy with "-g#". The
413 program will exit straight away, and if it exits cleanly (no core dumps or
414 other ugly program termination), everything is fine. Otherwise, you should
415 either recompile with GLK_CLEAN_EXIT defined, or set environment variable
416 GLKAGIL_CLEAN_EXIT to "true".
417
418
419 --
420
421 Simon Baldwin, [email protected]