Skip to content
Malin Freeborn edited this page Apr 12, 2021 · 2 revisions

Random Monsters

Latex's ability to generate a full NPC entry from a list of numbers has been a great time saver, but that's not the end of the tricks. A lot of the time a story will demand some elf, dragon, bandit, or whatever, but not a particular elf. These situations threaten to once again make adventure writing boring. You don't much care if the bandits have a Strength of +1 or +2. Nothing depends upon it, and you can't really tell the outcome of that decision anyway. At this point a revelation struck me - I could just tell Latex that when I write \bandit, I want it to produce a bandit character.

However, the problem with that random bandit was that in time, all bandits would look alike. They would all have +1 Combat, all have shortswords, and all carry 38cp. Obviously, this is quite distasteful.

The next idea was to make random characters. Elves would have a random Strength Bonus between -3 and +1. Bandits would have a 50/50 chance of having a short sword or long sword. However, a random number would threaten to push information over the edge of a page during one Latex compile, but not on the next, damaging the table of contents, and wrecking the glossary.

The final solution was to use pseudo-random characters. The 'random' numbers they use are pulled from environmental variables, such as page numbers, or whether or not the current chapter is an even number. This means that you can compile the document 100 times and get the same character on the page each time, but every time you add a \dragon, you will get a brand new dragon.

Have a look through the monsters.tex file from Adventures in Fenestra and you'll see a list of available monsters.

Clone this wiki locally