NHDT->ANH, nethack->anethack, nhdat->anhdat
[aNetHack.git] / doc / recover.6
blob5be20e55a6e130373554cfda42e1e4ff55fc14cb
1 .TH RECOVER 6 "9 January 1993"
2 .\" aNetHack 0.0.1  recover.6   $ANH-Date: 1450129883 2015/12/14 21:51:23 $  $ANH-Branch: aNetHack-3.6.0 $:$ANH-Revision: 1.8 $
3 .UC 4
4 .SH NAME
5 recover \- recover a aNetHack game interrupted by disaster
6 .SH SYNOPSIS
7 .B recover
9 .B \-d
10 .I directory
12 .I "base1 base2" ...
13 .SH DESCRIPTION
14 .PP
15 Occasionally, a aNetHack game will be interrupted by disaster
16 when the game or the system crashes.
17 Prior to aNetHack v3.1, these games were lost because various information
18 like the player's inventory was kept only in memory.
19 Now, all pertinent information can be written out to disk,
20 so such games can be recovered at the point of the last level change.
21 .PP
22 The
23 .I base
24 options tell
25 .I recover
26 which files to process.
27 Each base option specifies recovery of a separate game.
28 .PP
29 The
30 .B \-d
31 option, which must be the first argument if it appears,
32 supplies a directory which is the aNetHack playground.
33 It overrides the value from ANETHACKDIR, HACKDIR, or the directory
34 specified by the game administrator during compilation
35 (usually /usr/games/lib/anethackdir).
36 .PP
37 ^?ALLDOCS
38 For recovery to be possible,
39 .I anethack
40 must have been compiled with the INSURANCE option, and the run-time option
41 .I checkpoint
42 must also have been on.
44 ^?INSURANCE
45 For recovery to be possible,
46 .I anethack
47 must have been compiled with the INSURANCE option (this configuration was),
48 and the run-time option
49 .I checkpoint
50 must also have been on.
52 This configuration of
53 .I anethack
54 was created without support for recovery.
57 aNetHack normally writes out files for levels as the player leaves them,
58 so they will be ready for return visits.
59 When checkpointing, aNetHack also writes out the level entered and
60 the current game state on every level change.
61 This naturally slows level changes down somewhat.
62 .PP
63 The level file names are of the form base.nn, where nn is an internal
64 bookkeeping number for the level.
65 The file base.0 is used for game identity, locking, and, when checkpointing,
66 for the game state.
67 Various OSes use different strategies for constructing the base name.
68 Microcomputers use the character name, possibly truncated and modified
69 to be a legal filename on that system.
70 Multi-user systems use the (modified) character name prefixed
71 by a user number to avoid conflicts,
72 or "xlock" if the number of concurrent players is being limited.
73 It may be necessary to look in the playground to find the correct
74 base name of the interrupted game.
75 .I recover
76 will transform these level files into a save file of the same name as
77 .I anethack
78 would have used.
79 .PP
80 Since
81 .I recover
82 must be able to read and delete files from the playground
83 and create files in the save directory,
84 it has interesting interactions with game security.
85 Giving ordinary players access to
86 .I recover
87 through setuid or setgid is tantamount to leaving the playground
88 world-writable,
89 with respect to both cheating and messing up other players.
90 For a single-user system, this of course does not change anything,
91 so some of the microcomputer ports install
92 .I recover
93 by default.
94 .PP
95 For a multi-user system,
96 the game administrator may want to arrange for all .0 files in the
97 playground to be fed to recover when the host machine boots,
98 and handle game crashes individually.
99 If the user population is sufficiently trustworthy,
100 .I recover
101 can be installed with the same permissions the
102 .I anethack
103 executable has.
104 In either case,
105 .I recover
106 is easily compiled from the distribution utility directory.
107 .SH NOTES
109 Like
110 .I anethack
111 itself,
112 .I recover
113 will overwrite existing savefiles of the same name.
114 Savefiles created by
115 .I recover
116 are uncompressed;
117 they may be compressed afterwards if desired,
118 but even a compression-using
119 .I anethack
120 will find them in the uncompressed form.
121 .SH "SEE ALSO"
122 anethack(6)
123 .SH BUGS
125 .I recover
126 makes no attempt to find out if a base name specifies a game in progress.
127 If multiple machines share a playground, this would be impossible to
128 determine.
130 .I recover
131 should be taught to use the anethack playground locking mechanism to
132 avoid conflicts.