Lich:A beginner's guide to the Lich mapdb
The Lich map database (mapdb) is an important part of Lich used for automated travel and other tasks related to room properties. It is distinct from the go2 script, but in general both of these two require the other for normal use. This article aims to provide a general introduction to the mapdb at a level appropriate for basic usage as well as getting started wtih modifications.
Introduction
Despite their differences, updates to the mapdb are often erroneously called updates to the script go2. The mapdb provides the basic information on which go2 operates. For many players, the distinction between the two is not important; if someone updates the mapdb to include new paths and/or new rooms, go2 will know how to use them without further instruction. It is, however, important to understand the distinction for anyone wishing to work on or with the mapdb.
One is a database (mapdb) and the other is a script (go2). To exemplify their differences, consider that Prime, Platinum, and Shattered all have different mapdbs, but they can commonly share the same version of the go2 script. The databases cannot be shared across instances because the actual rooms and layouts are not 100% identical between them; they can, however, share the logic used by go2 to perform operations on the mapdb and issue instructions to the game server for movement and other tasks.
The mapdb is a file with a record for each unique room it knows about. At present, the file is about 20 MB in size containing information about nearly 30,000 rooms. These files are kept under lich/data/GSIV/map-##########.dat (for the Prime instance), where the long number is an identifying hash which is updated automatically in an incremental fashion. Although the hashes do not proceed linearly in mapdb number (e.g. 1, 2, 3, 4), a smaller hash is always an older version of the mapdb than a newer hash.
This article will focus on the mapdb from the perspective of not only its use with go2, but other scripts such as narost and ones that sort rooms by nearest location and tags (e.g., zzherb).
What is a room?
The best (and really only) way to interact with the mapdb is via the game through lich. In general, if one is in a mapped room, one can have a look at its mapdb record via the command ;e echo Room.current.inspect
. For example:
@wayto={"226"=>"south", "294"=>"southwest", "224"=>"east"} @paths=["Obvious paths: east, south, southwest"] @image_coords=[197, 175, 233, 211] @terrain=nil @description=["The road turns gradually at this point as it forms the northwest corner of the city. The main path curves along the north and west walls, and another leads south between the buildings. The massive oak and modwir logs of the city palisade tower overhead."] @image="wl-wehnimers-1264234799.png" @climate=nil @title=["[Wehnimer's, North Ring Rd.]"] @check_location=nil @timeto={"226"=>0.2, "294"=>0.2, "224"=>0.2} @id=225 @location="the town of Wehnimer's Landing" @tags=["some sovyn clove", "some acantha leaf", "some calamia fruit", "pepperthorn root", "ironfern root", "small rose", "heath aster", "some bur-clover root", "some wingstem root", "small wild rose", "white baneberry", "small daisy"] @links=[]
This example is fairly straight-forward, showing some basic details without too much complication. One should recognize it the far west room on the North Ring Road inside the town of Wehnimer's Landing. The tags indicate a number of herbs can be foraged in this location, for example acantha leaf.
Room properties
Here is more technical description of each field in a room record in the mapdb.
wayto
Type: Hash
@wayto={"226"=>"south", "294"=>"southwest", "224"=>"east"}
The method and id pair for each room a character can reach from the present room. See also timeto.
paths
Type: Array
@paths=["Obvious paths: east, south, southwest"]
The portion of the gamefeed after the room description showing the 'Obvious paths' or the 'Obvious exits'. Used by the mapdb for identifying a room. (NB: Not for extracting movement methods between rooms.) See also description, title and wayto.
image_coords
Type: Pixel integer array
@image_coords=[197, 175, 233, 211]
Relative location of the room in the image file, e.g., in narost (if any).
x1, y1, x2, y2
x1, y1: Top left corner x2, y2: Top right corner
This is typically obtained by using ;narost fix
and clicking the mouse. It is one of the easiest ways new people can help contribute to the mapdb.
terrain
Type: String
The sliced output from a ranger's sense verb which could provide useful information. See also: climate.
description
Type: Array
@description=["The road turns gradually at this point as it forms the northwest corner of the city. The main path curves along the north and west walls, and another leads south between the buildings. The massive oak and modwir logs of the city palisade tower overhead."]
The portion of the gamefeed after the title but before the paths. Used by the mapdb for identifying a room. Reading this bit is called sniffing the flowers. Does not include the bit about 'You also see...' (to use a permanent room object, see unique_loot). See also: paths, title.
image
Type: String
@image="wl-wehnimers-1264234799.png"
Filename for the image file associated with the room in narost (if any).
climate
Type: String
The sliced output from a ranger's sense verb which could provide useful information. See also: terrain
title
Type: Array
@title=["[Wehnimer's, North Ring Rd.]"]
The first portion of the gamefeed associated with the room before the description, shown in square brackets ([ and ]). Used by the mapdb for identifying a room. See also description and paths.
check_location
???
timeto
Type: Haash
@timeto={"226"=>0.2, "294"=>0.2, "224"=>0.2}
"id"=>time
The movement time (in seconds) and id pair for each room a character can reach from the present room. See also wayto.
id
Type: Integer
The room number is a unique identifying integer, and perhaps the most common technical detail of the mapdb which is used regularly by all lich users. They are linear in the order they are added to the mapdb, although there is no implicit relation between a room number and what may be called the geographic location in the game.
location
Type: String
The sliced output from the game's location verb, indicating the room's approximate geographic region. Can be useful to distinguish unique rooms.
tags
Type: Array
@tags=["some sovyn clove", "some acantha leaf", "some calamia fruit", "pepperthorn root", "ironfern root", "small rose", "heath aster", "some bur-clover root", "some wingstem root", "small wild rose", "white baneberry", "small daisy"]
An auxiliary portion of the mapdb for handling miscellaneous data. The most familiar examples are things like ;go2 town
and ;go2 bank
which finds the nearest room with this tag (i.e., someone manually tagged each bank with 'bank'), sometimes indicating a mechanical feature of a room (e.g., 'node', 'supernode') or what items can be foraged there. There are also more advanced features such as use of peer.
links
???
unique_loot
Type: String array
An optional and manually added portion of the gamefeed after the description but before the paths. It represents any static object(s) in the room which could be used for identification purposes (such as a statue or a barrel). As this used to be covered under tags, not all rooms will have this field.
Resources
- lrn2map thread: The most authoritative information on the mapdb from Tillmen.
- [1]: A decent write-up on how to properly update Lich's MapDB