A one page dungeon layout

Last-Updated: 2022-08-15

Sources

Explanation of the layout

As explained by Laurens Kils-Hütten (2022-08/msg00085), classic dungeon level maps are often found in the following layout:

-------------------------------
| ---------------  Table with  |
||               | random      |
||  Map of the   | encounters, |
||               | various     |
||    Dungeon    | general     |
||               | descriptions|
||     Level     | of the level|
||               | And finally |
| ---------------  a key with  |
| descriptions of each         |
| individual room of the       |
| dungeon. Basically it's a    |
| page, with one top-left      |
| aligned image and text       |
| floating around the image.   |
| That shouldn't be too hard.  |
| Nothing fancy really ...     |
--------------------------------

Definition of the macros

To achieve this, Laurens with the help of Ralph Corderoy (2022-08/msg00111) used two traps (.wh) to adapt the line length and the page offset for the text to go around the picture.

One trap is used to trigger .opdEM2 right after the end of the map to reset the page offset. The second trap triggers .opdEM1 one line before the end of the map to reset the line length. This trap needs to happen one line before the actual end of the map because, as stated by Ralph, CSTR 54 §6 contains the following:

The maximum line length for fill mode may be set with ll. [...] The effect of ll, in, or ti is delayed, if a partially collected line exists, until after that line is output.
.de opdMap        \" start with the map
.br
.mk a             \" Mark current position
.PSPIC -L \\$1 4i \" insert map image 
.mk b             \" Mark lower edge of map
.sp |\\nau        \" move back up to mark a
.\".na            \" uncomment for ragged right
.po +4i           \" increase page offset by image width 
.nr LL -4i        \" reduce line length accordingly
.                 \" left margin is now just right 
.                 \" of the map
.wh \\nbu-1v opdEM1  \" last line before 
.                    \" end of the map
.wh \\nbu opdEM2  \" end the map
..
.de opdEM1         \" end of special opd stuff
.ll +4i           \" reset line length
.nr LL +4i        \" margin and line length
..
.de opdEM2         \" end of special opd stuff
.po -4i           \" reset offset to the original 
.ad               \" resume adjusting
..

The final document

With these macros, we can now build our document, the map file (map.eps) is generated from the png file available here:

.fam N \" New Century Schoolbook
.OH 'Example Dungeon''OPD Macros'
.EH 'OPD Macros'Page %'Example Dungeon'
.TL 
A One-Page-Dungeon template in groff
.SH 
One Page Dungeon
.opdMap map.eps 4
.SH
Random Encounters
.PP
We can also include actual tables instead of lists:
.TS
allbox,expand,tab(@);
c c
c lw(1.2i).
1d6@Encounters
1@T{
1-6 Goblins, AC 6, HD 1-1, 9"
T}
2@T{
1-6 Orcs, AC 6, HD 1, 9"
T}
3@T{
1-6 Skeletons, AC 5, HD \(12, 6"
T}
4@T{
1-6 Zombies, AC 7, HD 1, 6"
T}
5@NPC Party
6@T{
1-3 Gnolls, AC 6, HD 2, 9"
T}
.TE
.SH
General description
.PP
Text in this sidebar now uses regular -ms macros. No special macros
needed anymore. I think I like to keep adjusting of the right margin
active, even for this narrow column of text. There's a trap
included. Not only in the dungeon, but also in the groff macros. It
catches when we reach the lower edge of the map and resets margins and
adjustment to the package default.
.SH 
Location Key
.IP 1) 3
This is an entry about location one.
.IP 2) 3
This is an entry about location two.
.IP 3) 3
This is an entry about location three.
.PP
So, this looks much nicer now. The code is even shorter than the first
version. There was some issue with resetting the line length below the
map. Now the macro uses two traps. A first one just one line above the
lower edge of the map to reset the line length, and the second one
just
.I at
the lower edge of the map to reset page offset and adjusting.
← Go back