This directory contains `ipbt', a high-tech player for `ttyrec'
`ttyrec' is a program similar to script(1): it records all the
terminal output during a Unix terminal session. Unlike script, it
writes timestamps into the output file as well as raw output data,
so that the session can be played back at the original speed. It is
commonly used for recording games of NetHack. The ttyrec recorder
program can be found at
Conventional ttyrec players are little more than a loop
interspersing sleep(2) with write(2); it's easy to pause and
fast-forward, and a particularly advanced player might be able to
rewind by noticing screen clears and using them as marker points
(since replay can be restarted reasonably safely from a screen
clear), but precision single-step backward and forward motion is
entirely beyond such an application.
ipbt works by embedding a terminal emulator: it is essentially a
derivative work of the PuTTY code base. The input file is read in
full and run through the internal terminal emulator, and the
resulting screen states are saved in an internal movie array in such
a way that any screen state (`frame') can be retrieved efficiently.
Once this is done, the player application simply displays a sequence
of frames using libncurses; the user can perform the usual pause and
speed adjustment operations, but can also jump to an arbitrary frame
number and move backwards as well as forwards.
The downside is that ipbt takes time to read the entire input file
before starting. I've been testing it on an 8Mb ttyrec of a NetHack
ascension; on a 1GHz Pentium III it takes about a minute to read the
file. After that setup phase, however, playback is efficient.
Current status of ipbt:
* Basically works.
* Amenities such as online help and proper documentation are not
* Dependent on libncurses; uses the use_default_colors() extension
function, which means it probably won't compile on other curses
implementations without a bit of autoconf work.
* Makefile is rudimentary at best. Porting work required. See the
TODO file for a full list of desirable features.
Proper documentation has yet to be written (as mentioned above), but
here's a quick list of the available keystrokes during playback:
* `q' (or `Q') quits ipbt.
* Space moves on by a frame. Prefix it by a number to move on by
multiple frames at a time.
* `b' moves back by a frame. Prefix it by a number to move backwards by
multiple frames at a time.
* `o' toggles the on-screen display, which shows the current status
* `L' toggles logarithmic time compression (designed to have little
effect on small delays but massively compress long ones).
* Typing a number followed by `x' causes play to proceed at that
many times normal speed (e.g. `3x' means play at triple speed).
Typing just `x' is equivalent to `1x': it restores normal speed.
* `X' is like `x', but slows down rather than speeding up: `2X'
means half speed and `3X' means one third speed. `X' on its own
restores normal speed, just like `x'.
* `g' jumps to the beginning of the animation. Prefixing a number
jumps to a particular frame.
* `G' jumps to the end of the animation. Prefixing a number jumps
to that many frames from the end.
* `p' (and also `s', for historical reasons) toggles pause mode.
Pause mode is initially enabled.
* '/' searches forward for a frame containing the given text.
* '?' and `\' both search backward for a frame containing the given
* `n' repeats the previous search: searches for the same text in
the same direction (i.e. `go to next match').
* `N' repeats the previous search in reverse: searches for the same
text in the opposite direction (i.e. `go to _previous_ match').
Oh, and `ipbt' stands for `It's Play-Back Time'.