home · contact · privacy
Load last world state from save file, not from re-stepping record file.
[plomrogue] / README
diff --git a/README b/README
index 1264d3cb5e3688dbf51f576eb9d82fab98d64491..9775dd8c8828de3329b6c23c62a7b2271905319b 100644 (file)
--- a/README
+++ b/README
@@ -5,24 +5,19 @@ plomlompom tries to build his own roguelike. It doesn't do much yet (although
 plomlompom has insanely ambitious long-term plans).
 
 You can move around a player on an island and meet different enemies. You have 5
-hitpoints to lose before death; they start with different amounts of hitpoints,
-depending on their species. Your score grows by killing enemies, to the amount
-of hitpoints each killed enemy started with. Dead enemies become dirt, skeletons
-or "magic meat"--such objects can be collected, and "magic meat" can be consumed
+hitpoints to lose before death. Enemies start with different amounts of
+hitpoints, depending on their species. Dead enemies become dirt, skeletons or
+"magic meat" -- such objects can be collected, and "magic meat" can be consumed
 to gain hitpoints. Note that different kinds of movements/actions take different
 numbers of turns to finish.
 
 Enemies' AI is very dumb so far: Each turn, they try to move towards their
-path-wise nearest enemy. If no enemy is found in their surroundings, they just
-wait.
+shortest-path-wise nearest enemy visible to them. If they see no enemy, they
+just wait.
 
-Note that diagonal movement is possible, but takes (40%) longer than orthogonal
-movement.
-
-Once you start a new world, every move of yours is recorded in a file called
-"record". Once you re-start the game, all of your previous moves are replayed
-automatically up to the point wherere you left the game. To start over in a new
-world, simply delete this file.
+Every move of yours re-writes a file "savefile" that describes the new state of
+the world. Once you re-start the game, the game state is recreated from the
+"savefile" file. To start over in a new world, simply delete this file.
 
 System requirements / installation / running the game
 -----------------------------------------------------
@@ -37,10 +32,10 @@ $ ./roguelike
 
 (It may also work on other Unix-like systems with ncurses, who knows.)
 
-Note that make generates two executables ./roguelike-server and
-./roguelike-client. ./roguelike is a pre-existing shell script that merely
-executes both of them, with the server as a background job. You can also
-ignore the script and start the two by hand.
+Make generates two executables ./roguelike-server and ./roguelike-client.
+./roguelike is a pre-existing shell script that merely executes both of them,
+with the server as a background job. You can also ignore the script and start
+the two by hand.
 
 Client's keybindings and window management
 ------------------------------------------
@@ -49,8 +44,8 @@ In the client's default window configuration, the window appearing on the left
 sports a list of keybindings available globally, and additionally via the window
 selected as active.
 
-Hit "w" (per default keybindings) to switch the "active" window to a view that
-allows changing its geometry. One more hit on "w" switches the window to a view
+Hit "W" (per default keybindings) to switch the "active" window to a view that
+allows changing its geometry. One more hit on "W" switches the window to a view
 that allows changing its window-specific keybindings. The global keybindings can
 be changed in the "Global keys" window, those of the window geometry
 configuration in the "Window geometry keys" window, and those of the
@@ -71,40 +66,87 @@ in-client window management.
 Replay game recording
 ---------------------
 
-Run "./roguelike -s" to watch a recording of the current game from the
-beginning. Hit any player action key to increment turns (they will not trigger
-the actions usually mapped to them, only repeat the actions done at that point
-in the game as defined in the "record" file). Keys to manage windows, scroll on
-the map and quit the program do their usual thing. Append a number to the -s
-option (like "-s100") to start the recording at the respective turn number.
+Once you start a new world, every move of yours is recorded in a file called
+"record". It gets overwritten when a new game world is started after deletion
+of the "savefile" file. Run "./roguelike -s" to watch the current game's
+recording from the beginning. Hit any player action key to increment turns (they
+will not trigger the actions usually mapped to them, only repeat the actions
+done at that point in the game as defined in the "record" file). Keys to manage
+windows, scroll on the map and quit the program do their usual thing. Append a
+number to the -s option (like "-s100") to start the recording at the respective
+turn number.
 
 Hacking / server internals and configuration
 --------------------------------------------
 
-The movements/actions available to the player and the enemies are defined and
-can be changed in ./confserver/map_object_actions. Each entry consists of a
-first line of a numerical ID used internally to uniquely identify and manage the
-action, a second line of the number of turns the action takes, and a third line
-of a string that maps the action to the game logic to do when it is called.
-Finally, a delimiter line of "%%" ends the entry.
-
-The different map object types, i.e. species (including the player's human one)
-and item types, can be edited in ./confserver/defs. Here the first value is a
-numerical ID that represents the object type, the second one describes what type
-this object decomposes to when it gets destroyed/killed, the third value is the
-ASCII character used to represent the object visually on the map, the fourth
-value is the number of hitpoints the object starts with (items are dead and
-start with zero hitpoints, anything else moves), the fifth is the string that
-names the object in the game log. Finally, the same delimiter as for the map
-object action definitions file follows. Note that the only valid item use so
-far, consuming "magic meat" to gain hitpoints, is so far hard-coded (this should
-change in the future).
+The ./confserver/world file defines the thing types, actions available to them,
+the map geometry and the thing type (species) of the player. Each definition
+consists of a single- or multi-line block wherein each line sets one attribute.
+
+Here's a typical action definition block:
+
+ACTION 1
+NAME move
+EFFORT 5
+
+A line of "ACTION" followed by a number starts an action definition block and
+sets the action's id (must be > 0) for internal use to 1. The number after
+"EFFORT" determines how many turns this action takes for the actor performing
+it. The string after "NAME" names the action. Furthermore, if it is one of
+"move", "pick_up", "drop" or "use", it matches internal functions described by
+these strings to this action. All other names (including "wait") currently are
+matched to a do-nothing wait function.
+
+Here's a typical thing type definition block: 
+
+THINGTYPE 2
+NAME ZOMBIE
+SYMBOL z
+LIFEPOINTS 3
+CORPSE_ID 5
+CONSUMABLE 0
+START_NUMBER 9
+
+A line of "THINGTYPE" followed by a number starts it, and the number sets the
+thing type's internal id. The number after "CONSUMABLE" defines the thing as
+consumable (and to so many hitpoints gain). The character after "SYMBOL" is the
+one shown on the map to represent to thing type. "LIFEPOINTS" is the start
+hitpoints value for this thing type and defines it as animate if it is non-zero.
+The string after "NAME" sets the thing type's name. "CORPSE_ID" sets the id of
+the thing type that things of this type degrade to if their hitpoints drop to
+zero if they start out as inanimate (what is not implemented yet: or if they are
+inanimate, but are otherwise crushed). Note that the "CORPSE_ID" must match the
+id of a thing type defined in the file (before or after, it may even be the
+same). "START_NUMBER" sets the number of things that are to appear of the
+given type on the map on game start.
+
+The map is defined by a single-line block. Its number value sets the map
+square's edge length. It must be >= 1 and <= 256:
+
+MAP_LENGTH 64
+
+The player type / species is also defined by a single line block. Its number
+value sets the player's creature's thing type by its id:
+
+PLAYER_TYPE 0
+
+All these definition block members must be present within their respective
+blocks, but only "ACTION" and "THINGTYPE" must be positioned at their respective
+blocks' first line; the others may appear in whatever order and even multiple
+times. If a thing or action definition block is finished, however, it cannot
+be re-defined by starting a new block with the same thing type or action id.
+
+Tokens in this config file are separated by whitespace. Single quotes can be
+put around string values that are to include whitespace by themslves. Note that
+all numbers must be decimal representations of unsigned 8 bit integers, i.e.
+>= 0 and < 256 and sans preceding "+".
 
 All source files are thoroughly documented to explain more details of
 plomrogue's internals. The ./roguelike-server executable can be run with a -v
 option for helpful debugging info (mostly: what messages the client sends to the
 server). Server and client communicate via files in the ./server/ directory
-(generated when the server is first run). The ./server/in fifo receives commands
-for the server as null-terminated strings. The ./server/out file contains a
-serialized representation of the game world's data as it is to be available to
+(generated when the server is first run). The ./server/in file is read by the
+server for newline-delimited commands. The ./server/out file contains server
+messages to be read by clients. The ./server/worldstate file contains a
+serialized representation of the game world's data as it is to be visible to
 the player / the player's client.