1This directory contains `ipbt', a high-tech player for `ttyrec'
2files.
3
4`ttyrec' is a program similar to script(1): it records all the
5terminal output during a Unix terminal session. Unlike script, it
6writes timestamps into the output file as well as raw output data,
7so that the session can be played back at the original speed. It is
8commonly used for recording games of NetHack. The ttyrec recorder
9program can be found at
10
11  http://namazu.org/~satoru/ttyrec/index.html.en
12
13Conventional ttyrec players are little more than a loop
14interspersing sleep(2) with write(2); it's easy to pause and
15fast-forward, and a particularly advanced player might be able to
16rewind by noticing screen clears and using them as marker points
17(since replay can be restarted reasonably safely from a screen
18clear), but precision single-step backward and forward motion is
19entirely beyond such an application.
20
21ipbt works by embedding a terminal emulator: it is essentially a
22derivative work of the PuTTY code base. The input file is read in
23full and run through the internal terminal emulator, and the
24resulting screen states are saved in an internal movie array in such
25a way that any screen state (`frame') can be retrieved efficiently.
26Once this is done, the player application simply displays a sequence
27of frames using libncurses; the user can perform the usual pause and
28speed adjustment operations, but can also jump to an arbitrary frame
29number and move backwards as well as forwards.
30
31The downside is that ipbt takes time to read the entire input file
32before starting. I've been testing it on an 8Mb ttyrec of a NetHack
33ascension; on a 1GHz Pentium III it takes about a minute to read the
34file. After that setup phase, however, playback is efficient.
35
36Current status of ipbt:
37 * Basically works.
38 * Amenities such as online help and proper documentation are not
39   available yet.
40 * Dependent on libncurses; uses the use_default_colors() extension
41   function, which means it probably won't compile on other curses
42   implementations without a bit of autoconf work.
43 * Makefile is rudimentary at best. Porting work required. See the
44   TODO file for a full list of desirable features.
45
46Proper documentation has yet to be written (as mentioned above), but
47here's a quick list of the available keystrokes during playback:
48
49 * `q' (or `Q') quits ipbt.
50 * Space moves on by a frame. Prefix it by a number to move on by
51   multiple frames at a time.
52 * `b' moves back by a frame. Prefix it by a number to move backwards by
53   multiple frames at a time.
54 * `o' toggles the on-screen display, which shows the current status
55   of ipbt.
56 * `L' toggles logarithmic time compression (designed to have little
57   effect on small delays but massively compress long ones).
58 * Typing a number followed by `x' causes play to proceed at that
59   many times normal speed (e.g. `3x' means play at triple speed).
60   Typing just `x' is equivalent to `1x': it restores normal speed.
61 * `X' is like `x', but slows down rather than speeding up: `2X'
62   means half speed and `3X' means one third speed. `X' on its own
63   restores normal speed, just like `x'.
64 * `g' jumps to the beginning of the animation. Prefixing a number
65   jumps to a particular frame.
66 * `G' jumps to the end of the animation. Prefixing a number jumps
67   to that many frames from the end.
68 * `p' (and also `s', for historical reasons) toggles pause mode.
69   Pause mode is initially enabled.
70 * '/' searches forward for a frame containing the given text.
71 * '?' and `\' both search backward for a frame containing the given
72   text.
73 * `n' repeats the previous search: searches for the same text in
74   the same direction (i.e. `go to next match').
75 * `N' repeats the previous search in reverse: searches for the same
76   text in the opposite direction (i.e. `go to _previous_ match').
77
78Oh, and `ipbt' stands for `It's Play-Back Time'.
79