Debian Codegraph @

terps/magnetic/Glk/glk_readme.txt

raw
1 Magnetic Scrolls Interpreter, Glk Notes
2 ---------------------------------------
3
4
5 Introduction
6 ------------
7
8 This is a port of the Magnetic Scrolls interpreter to Glk. The complete
9 interface lives in the single file
10
11 glk.c
12
13 The main test and development system for the port is Linux, with Xglk as the
14 Glk library.
15
16
17 Acknowledgments
18 ---------------
19
20 Thanks to David Kinder for hints and tips on how to go about the port, and of
21 course to Niclas Karlsson and his collaborators for the underlying Magnetic
22 Scrolls interpreter, which looks like it probably wasn't a lot of fun to work
23 on at times.
24
25 Thanks also to Ben Hines <[email protected]> for the Mac code. I've
26 copied in from AGiliTy with, I think, the appropriate modifications, but it's
27 untested at present.
28
29
30 Running Games
31 -------------
32
33 The interpreter understands game files that use the "Magnetic Scrolls" data
34 format. A file in this format usually has the extension ".MAG" or ".mag", and
35 has "MaSc" in its first four data bytes.
36
37 Give the name of the game file to run at the system prompt. For example
38
39 glkmagnetic GUILD.MAG
40
41 If the game has an associated graphics file, normally a file that has the
42 extension ".GFX" or ".gfx", make sure that it is in the same directory as the
43 main data file, and has the same base name. For example, the matching graphics
44 file for "GUILD.MAG" is "GUILD.GFX". The Glk interpreter will find this file
45 automatically, if it exists, and use it to create game pictures.
46
47 The game may also have an associated hints file, with the extension ".HNT" or
48 ".hnt". Like the graphics file, make sure it is in the same directory as other
49 game files, and with the same base name, and the Glk interpreter will find the
50 file automatically. Hints files apply only to the later Magnetic Windows
51 games, so not all the games you find will have them. Also, hints for several
52 games may be combined into a single file, so you might need to copy, or link,
53 a file such as "COLL.HNT" to "CCORRUPT.HNT" to match with a "CCORRUPT.MAG"
54 file.
55
56 If there is no graphics file, the interpreter will run in text only mode. It
57 will also do this if it cannot open the graphics file, or if the file does not
58 seem to contain game graphics.
59
60 If there is no hints file, the interpreter will not be able to display game
61 hints, but will otherwise run normally.
62
63 As a short cut, you can omit the game extension, so for example
64
65 xmagnetic GUILD
66
67 will run GUILD.MAG, and also use pictures from GUILD.GFX, and hints from
68 GUILD.HNT, if either or both are available.
69
70 Because of the way the Glk interpreter looks for files, you should make sure
71 that the games are held in files with ".MAG" or ".mag" extensions, and any
72 associated graphics and hints are held in files with ".GFX" or ".gfx" and
73 ".HNT" or ".hnt" extensions respectively. Games held in files with other
74 extensions may not work.
75
76 There are a few command line options that you can add to vary the way that
77 the game looks:
78
79 -np Don't display game pictures initially
80 -ng Don't automatically gamma correct game picture colours
81 -nx Don't animate game pictures
82 -ne Don't add an extra prompt on line input
83 -na Don't expand single-letter abbreviations
84 -nc Don't attempt to interpret selected commands locally
85
86 See below for further information about what these options mean.
87
88
89 Compiling
90 ---------
91
92 To compile Glk Magnetic for Linux, first unpack the source files. You might
93 need to use the -a argument to unzip in order to convert text files for your
94 system.
95
96 Edit Makefile.glk so that it has the right path to the Glk library you wish to
97 build with. If you want to build the IFP plugin, also edit the parts of
98 Makefile.glk that have paths to IFP components.
99
100 To build standalone binary version of Glk Magnetic Scrolls, change directory
101 to the Glk subdirectory, and use
102
103 make -f Makefile.glk glkmagnetic
104
105 To build the IFP plugin, use
106
107 make -f Makefile.glk magnetic-2.3.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
114 Extra Prompting
115 ---------------
116
117 Magnetic Scrolls games always prompt with ">" when they are expecting input.
118 However, Magnetic Windows ones are sometimes strangely silent, for example
119 after receiving an empty line, they don't issue a second prompt.
120
121 To try to make it a little clearer to see what's going on, Glk Magnetic will
122 add its own ">" prompt when the game is expecting line input, but only when it
123 determines that the game has not already issued its own prompt.
124
125 You can turn this off with the '-ne' option.
126
127
128 Displaying Pictures
129 -------------------
130
131 Magnetic Scrolls games generally come with attractive graphics, and while not
132 essential to the game, they do enhance the experience of playing.
133
134 Unfortunately, Glk does not provide a method to directly display an image
135 bitmap, so Glk Magnetic needs to adopt some tricks to get a picture to display.
136 The end result is that, on Linux Xglk at least, it can take several seconds to
137 render a complete picture.
138
139 To reduce the problems caused by a game pausing for several seconds for a
140 picture, Glk Magnetic does its picture rendering using a background "thread".
141 This draws in the complete picture over a series of smaller image updates,
142 while at the same time still allowing game play. To speed up picture
143 rendering, Glk Magnetic also goes to considerable effort to try to minimize
144 the amount of Glk graphics operations it uses.
145
146 If you move to a location with a new picture before the current one has been
147 fully rendered, Glk Magnetic will simply start working on the newer picture.
148
149 Most Magnetic Windows and Magnetic Scrolls games accept the "graphics" command,
150 which toggles pictures on and off. Magnetic Scrolls games usually start with
151 graphics enabled, but for some reason Magnetic Windows games tend to start
152 with graphics disabled. To get pictures, type "graphics" as more or less the
153 first game command.
154
155 You can use the "-np" option to turn off pictures. Glk Magnetic also will not
156 show pictures if the Glk library does not support both graphics and timers, if
157 there is no suitable ".GFX" or ".gfx" graphics file, or if the interpreter
158 cannot open the graphics file successfully. See below for further notes about
159 displaying pictures.
160
161
162 Animated Pictures
163 -----------------
164
165 Some of the pictures in later Magnetic Windows games are animated, and Glk
166 Magnetic will animate those pictures.
167
168 Animations stretch the bitmap display capabilities of Glk even further than
169 static pictures do. Glk Magnetic uses several optimizations to try to reduce
170 the graphics load on the system, and in particular animates only the portions
171 of a picture that change between frames. As a result, pictures with modest
172 animations work well; pictures with large animated areas may however not
173 display as effectively. Fortunately, most of the animated pictures in
174 Magnetic Windows games don't require large graphics repaints between frames.
175
176 The speed and smoothness of animations will probably also depend on the CPU
177 speed of your system, and on the graphics card, in particular any graphics
178 acceleration, available.
179
180 As with static pictures, Glk Magnetic interleaves animation frames with game
181 play using a background "thread", if necessary breaking individual animation
182 frames into pieces so that that game play is not interrupted for too long.
183
184 You can use the "-nx" option to turn off picture animation. Glk Magnetic will
185 then display just the static portions of a game's pictures.
186
187
188 Gamma Colour Corrections
189 ------------------------
190
191 Some of the Magnetic Scrolls pictures look fine without gamma corrections. On
192 the other hand, others, in particular those in "Corruption", and several from
193 "Wonderland", can look very dark if not corrected.
194
195 To try to adjust for this, Glk Magnetic will apply an automatic gamma
196 correction to each picture. It selects a suitable gamma based on analyzing the
197 colours that the picture uses, and choosing one that gives reasonable colour
198 contrast.
199
200 There are two levels of automatic gamma correction: 'normal' and 'high'. In
201 normal mode, the gamma correction is half of that needed to completely even
202 out the contrast between picture colours, offering a reasonable balance between
203 the amount of picture brightening and garish or faded colours. In high mode,
204 the gamma correction is that needed to fully even out the contrast between
205 picture colours. Use "glk gamma" when in a game to switch between these modes,
206 or to turn gamma correction off altogether.
207
208 You can use the "-ng" option to turn off gamma colour corrections. In this
209 case, all pictures are displayed using their original colour palette.
210
211
212 Game Hints
213 ----------
214
215 Where a game comes with hints (Wonderland, and the "collection" games), Glk
216 Magnetic will try to display them if possible.
217
218 For Glk libraries that support separate windows, Glk Magnetic shows hints in a
219 pair of windows which overlay the main game text window. The upper hint
220 window gives a menu of hint topics. The lower one shows the game hints one at
221 a time.
222
223 For Glk libraries that don't support separate windows, Glk Magnetic shows hints
224 in the main game window, using the best formatting it can arrange.
225
226 Glk Magnetic will not show hints if there is no suitable ".HNT" or ".hnt" hints
227 file, or if the interpreter cannot open the hints file successfully.
228
229
230 Status Line
231 -----------
232
233 Magnetic Scrolls games print a status line, and Glk Magnetic will display this
234 in a separate window above the main window, for Glk libraries that support
235 separate windows.
236
237 For other Glk libraries, Glk Magnetic will print the status line in "[...]"
238 brackets above the standard game output following each turn, but only when the
239 status line has changed since the last turn.
240
241 Note that Magnetic Windows games generally do not print a status line. For
242 these games, Glk Magnetic will instead try to identify the game's title, and
243 display it, if identifiable, on the status line.
244
245
246 Expanding Abbreviations
247 -----------------------
248
249 Many IF games systems allow a player to use single character abbreviations for
250 selected common commands, for example, 'x' for 'examine', 'l' for look, and so
251 on. Not all Magnetic Scrolls games offer this feature, however.
252
253 To try to help the player, Glk Magnetic will automatically expand a selection
254 of single character commands, before passing the expanded string to the game
255 as input. It expands a command only if the first word of the command is a
256 single letter, and one of the following:
257
258 'c' -> "close" 'g' -> "again" 'i' -> "inventory"
259 'k' -> "attack" 'l' -> "look" 'p' -> "open"
260 'q' -> "quit" 'r' -> "drop" 't' -> "take"
261 'x' -> "examine" 'y' -> "yes" 'z' -> "wait"
262
263 If you want to suppress abbreviation expansion, you can prefix your input with
264 a single quote character (like putting literal strings into a spreadsheet).
265 If you do this, the Glk interface will strip the quote, then pass the rest of
266 the string to the main interpreter without any more changes. So for example,
267
268 'x something
269
270 will pass the string "x something" back to the game, whereas
271
272 x something
273
274 will pass "examine something" back to the game.
275
276 You can turn off abbreviation expansions with the command line option '-na'.
277
278
279 Interpreting Commands Locally
280 -----------------------------
281
282 Glk Magnetic will handle special commands if they are prefixed with the string
283 'glk'. It understands the following special commands:
284
285 help Prints help on Glk special commands
286 summary Prints all current Glk settings
287 version Prints the Glk library and Glk port version numbers
288 license Prints the Glk port license
289
290 undo Undoes the prior game move
291 script on Starts recording the game text output sent to the
292 main game window
293 script off Turns off game text recording
294 inputlog on Starts recording input lines typed by the player
295 inputlog off Stops recording input lines
296 readlog on Reads an input log file as if it had been typed by
297 a player; reading stops automatically at the end of
298 the file
299 abbreviations on Turn abbreviation expansion on
300 abbreviations off Turn abbreviation expansion off
301 graphics on Turn on Glk graphics
302 graphics off Turn off Glk graphics (see below)
303 gamma normal Set automatic gamma colour correction mode to normal
304 gamma high Set automatic gamma colour correction mode to high
305 gamma off Turn automatic gamma colour correction off
306 animations off Turn picture animation off
307 animations on Turn picture animation on
308 prompts on Turn extra "> " prompting on
309 prompts off Turn extra "> " prompting off
310 commands off Turn of Glk special commands; once off, there is no
311 way to turn them back on
312
313 You can abbreviate these commands, as long as the abbreviation you use is
314 unambiguous. To improve compatibility with other IF games systems, Glk
315 Magnetic also recognizes the single word command "undo" as being equivalent
316 to "glk undo".
317
318 If for some reason you need to pass the string "glk" to the interpreter, you
319 can, as with abbreviations above, prefix it with a single quote character.
320
321 You can turn off local command handling with the command line option '-nc'.
322
323 If both abbreviation expansion and local command handling are turned off, there
324 is no need to use single quotes to suppress special interpreter features.
325
326
327 A Few Last Words on Graphics
328 ----------------------------
329
330 When turning graphics on and off with Glk commands, you should pay special
331 attention to whether graphics are turned on or off in the game. In order for
332 graphics to be displayed, they must be turned on both in the game AND in Glk.
333 Turning off graphics in Glk is a little more permanent than turning them off
334 in a game. In some games, turning graphics off seems to mean do not display
335 new pictures, but leave the current picture on the display; turning off
336 graphics in Glk closes the graphics display window completely.
337
338 What can also be confusing is the tendency of Magnetic Windows games to display
339 a picture automatically only on your first visit to a game location, unless in
340 'verbose' mode. On subsequent visits, a "look" command is needed to redisplay
341 the picture. This appears not to happen with Magnetic Scrolls games.
342
343 Why an additional Glk way to turn off pictures? Well, the Magnetic Windows and
344 Magnetic Scrolls games don't always behave the same way with the "graphics"
345 command, so a control inside Glk Magnetic itself gives a more consistent way
346 to turn graphics on and off. The command
347
348 glk graphics
349
350 with no on/off argument, prints out a brief information about the current state
351 of a game's graphics. In practice, it's probably best to stick to just one
352 method of turning graphics on and off -- either the game's own way, or the
353 'glk graphics' command.
354
355
356 --
357
358 Simon Baldwin, [email protected]