D&D Programming Random Generators

One Dice Six

Table I from Dungeon Master’s Guide Appendix A

It’s common for role-playing rules to include tables for generating complex results, similar to the image to the right from the first edition Dungeon Master’s Guide for generating dungeon maps. The user is meant to roll a twenty-sided dice and find a matching row from the first column. A roll of 4 matches the range of 3-5, indicates a door in the random dungeon and directs the user to Table II.

Automating the results with code provides two advantages over manually rolling. In the moment, at the table, it can be quite dramatic to click once and see a result. The other advantage is being able to rapidly re-roll and pick suitable results, such as when working on a new adventure and riffing on random results.

Random Generators

Automatic Album Cover Game

In the past few weeks there was a game/meme going around on Facebook that instructed you to put together an imaginary (record) album cover by randomly selecting text from wikipiedia and images from flickr. Of course, it occurred to me to write a program to do it. But it took Lee Springer nudging me to actually spend the time. Here are some examples from the random album cover generator.

Instead of pulling text from wikipedia, I generate the album name and the artist name using the routines I have already. Luckily flickr has an API and they even tell you which images are OK to use in derivative work. I pull recent “interesting” pictures, scan for the ones with rights that allow me to use them and I layer the text over the top.

At any given time there are mayb 10 – 20 images available, but it changes over time. It’s really just another way to view the random text out of the generator. Sometimes having it in the context of an album cover is surprising enough to make me chuckle.

When I first wrote these generators about 10 years ago, they used to make me laugh a lot. After a while, my brain seemed to automatize the rules behind them and they stopped making me laugh. They are vaguely pleasant to me, but they rarely make me laugh out loud.

Original images for the album covers above are here: