Fettler - the path to random map generation

While the blog has been a bit quiet, I've been working on some new features for Fettler.

The first part was a Python script that will go through the masks directory, load each image, and figure out what parts of each edge are floor and which are wall.  It's actually a little smarter, it looks at the whole image and figures out which openings are connected to the rest of the openings on each tile.  While that last bit of info isn't being used yet, it might come in handy down the road.

The connected-ness is determined by converting the images into a grid of nodes (basically a low-res black & white bitmap) and then doing a flood-fill from each of the edge openings to figure what you can reach from that edge.  The "fingerprint" just a list of each of the edge squares and what it connects is saved as a json file for use by the second part.

The second part attempts to generate random map of tiles, using the fingerprints to make sure the edges of adjacent tiles match up.  First stab at this uses a backtracking algorithm, so it tries all of the tiles in a given spot, and if it can't place any it goes back tot he previous tile placed, switches it for the next one that fits there, then tries move forward again.

The issue is that with nearly a thousand possible tiles in each spot, the backtracking algorithm is really limited to backtracking at most two or three tiles.  Any more than that and the number of iterations is too big -- three steps of backtracking is a billion tile combinations.  So the question then becomes what order to place the tiles.  If we do any sort of scan-line placement (rows across left to right, working top to bottom, for example), then it might become necessary to unwind a whole row, which is too much if the row is more than 2 or 3 tiles.

With a horizontal or diagonal scanline placement, then, the random generation can sometimes get stuck.  There are a few pairs of edge combinations that don't exist in the tileset, which leads to too much unwinding being needed.  I've currently got a timeout set so if it goes a few seconds without completing it just bails out and starts over.  Not elegant, but it works.

This can be mitigated a bit with a snake or spiral placement patter, so at every tile is always next the previous tile that was placed.  I'm going to add this next.

Here's one random map:

Here's a bigger 12x20 tile map (each tile being 6x6 squares):

And here is a 30x30:

Since overall connected-ness isn't factored in, there are a fair number of isolated segments, though if you consider putting "secret doors" in a few walls, it works pretty well.  Its output is a list of tiles, so you can always go tweak the tiles to add/remove/edit individual tiles before making the map.

The other limitation is that some not-quite-aligned-to-corners edges will end up matched to ones that are aligned.
A lot of the time this can be fixed manually by putting in a tile that does align.  Removing this type of tile for the available set would work, too.

My other plan is to make it so that instead of generating the map from textured tiles, the map can be assembled into one large mask, then the mask given the texture and edges as the tiles are.  This will leave the generated shape, but clean up the missing edge lines.

I'm also going to explore something that attempts a bit more random placement but allows for removing of other already-placed tiles when it can't fit stuff next to them.  It wouldn't be guaranteed to find a solution, but it might actually end up more likely to complete the map when the pure backtracking algorithm ends up getting stuck.


Fettler v1.0

A free dungeon tile set generator

Magic is impressive, but now Minsc leads. Free tiles for everyone!


Fettler is a series of Bash scripts. It can apply a grid to a floor and wall texture using a tile "mask" to easily create useful tiles for Roll20, other VTT systems, or where-ever you can make use of modular tile geomorphs. It has the ability to generate a large number of pre-defined masks for you, as well as some grids.

Once you have masks, textures, and a grid, you just need to run the script to generate a full set of tiles.

My hope is that these scripts make building and re-skinning a tile library much easier tasks.  If you make cool tile sets (and the textures allow it), share them with others!  If you make new masks, share them too!  If you add to the mask script, share it and let me know so I can include more masks in future updates!


-Windows with Cygwin (tested), or anything with Bash (other platforms untested)


Download (with some textures, 11.8 MB) or get from GitHub (does not include any textures).
Unzip and untar.
Check that you have ImageMagick set up correctly. From Bash, the command:
 magick convert logo: logo.png
should produce the logo.png file. If it does not, Fettler scripts will not work.
Personally, I found it easier to get the Windows Binary Release build (currently ImageMagick-7.0.4-10-Q16-x64-dll.exe) of ImageMagick working correctly with Cygwin.


From a Bash prompt, you should cd into the directory Fettler is installed in. Here's how to use them:


This is optional, but included for convenience if you need something to set your PATH to include ImageMagick if it's not there already. Edit to point to your ImageMagick path, and source with:
 . ./setenv.sh


Creates a set of overlay grids. When used, the overlay will appear on the floor, but not the wall. You can just run it:
and it will generate a bunch of grid files and put them in the "grids" sub-directory.


Creates a set of tile masks, white for walls, black for floor. Edit the script if you want to change whether it outputs rotated versions - many seamless tiles won't still tile when rotated, so having rotated masks will generate extra, already rotated versions of tiles that need it. Run with:
and it will generate a bunch of masks files and put them in the "masks" sub-directory.


Applies a grid to a set of masks, using a wall and floor texture. You will want to edit this to set the textures you want, as well as a few other options. Once you've set what you want, run:
and it will create a tile file for every mask file and put them in  the "output" sub-directory.


Converts a directory of pngs to jpgs. This is optional, but if you want more compressed version of the tiles, this will mass convert them. Run:
and it will convert all the pngs in "output" and put all of them them into the "output_jpg" sub-directory.

Known issues

-Sometime ImageMagick (at least the Win64 build I have) hangs trying to process jpgs when loading textures. Converting the jpgs to pngs solves the issue.

Possible future plans

-Move some of the options to env. variables and/or command-line options, so scripts don't need to be edited directly.
-Add a "liquid" layer, another layer mask that applies a texture between the floor and wall layers, for making sewers, lava channels, etc.
-Add option for using single larger map-sized mask for making a single map file.
-Expand built-in support to options other than 6x6
-Windows batch file support, and/or some other more cross-platform support, like Python.
-Some sort of "decoration" support for doors, etc.
-... other suggestions?


Check Twitter and this blog for updates!

Some sources for seamless tileable textures:
and doctorfree's mkseamless.sh:


Tilemaker Preview

If you use virtual table-tops, like Roll20, you've probably used map tiles.  Sometimes you can find whole maps that work for your needs, but when you want to build a map yourself, having tiles will help you quickly assemble a custom map.  For structures like dungeons, tiles can save a ton of time over building the whole structure.

I've built a script that automates a lot of the work of building a tile set.  In short, you give it two texture images (one for the walls, one for the floor), and it generates a set of tiles using those images. The tiles are generated from a set of template images.  You can use whatever template images you want, but this includes a script that will generate a few hundred useful ones for you.

The script lets you (optionally) apply a grid just to the floor and not over the walls - this makes for less visual clutter and makes it easier to tell the floor from the wall.  In Roll20 you can drop the opacity of the map's grid so you'll just see the tiles' grid.

The included templates are for 6x6 unit tiles.  Since not all textures are tileable when rotated/flipped, it can optionally generate those versions.  Templates and tiles can be generated at any size.

There are still a few more features I want to implement before releasing it, but here's a sample set of about 960 tiles created at 70 pixels per square.

Tileset sample: tilemaker_test_set.zip (55.7MB)

Enjoy!  Let me know if you have any comments on the shapes.


Taking risks

"Sometimes you gotta drive your character like they're a stolen car" - Adam Koebel

One constraint on players' play is the fear of a sub-optimal move. While often the defining characteristic of the power-gamer archetype, this trait can just as easily show up with players who have a more role-playing focused play-style. I can only speak for my group, but coming from years of more tactically-heavy D&D 3.5 games, as well as computer and board games where the main goal (winning the game) relies on making optimal choices, it is often hard for some (myself included) to let go of that mindset.

5e tried to fix this a bit with the inspiration mechanic - sure, you are making a sub-optimal choice, but if it's in-character and/or meshes with your flaws/bonds you get a mechanical reward in the form of inspiration.  That carrot goes away if you already have inspiration, or your flaw/bonds don't really fit the situation, or the GM isn't on the ball all the time about rewarding it (something I am certainly guilty of). Without consistency, it's not a good incentive, and by making it a mechanical reward, you are just pushing the optimization decision to be trying to calculate if the value of the reward outweighs the cost of the tactical choice.

As a GM, one (previously huge) peeve of mine is the player that starts making a move or action during their turn, and then wants to re-choose their actions because they started moving and then saw something around the corner, or realized they couldn't move as far as they wanted, or were going to make it within a ranged they needed.  I used to make them stick to their original action (unless the choice was clearly from some ambiguous or incorrect information on my part), but really I don't bother forcing the issue any more:  They are just going to get miffed about being made to have sub-optimal turn.  If that's how they derive their fun from the session, I'm not inclined to put the brakes on it unless it's infringing on someone else's fun.

Some players just get that they, like their characters, are going to have imperfect information and will make bad choices because of it.  Other players aren't going to be satisfied unless they achieve as much as mechanically possible each turn.  I'd say my current group is a pretty even three-way split, with some players at opposite ends of the spectrum, and some that have a hybrid approach that puts them in the middle. Switching away from grided combat seems to help to some degree, but the tactical crunch of D&D combat is a pretty big factor in the game's appeal for many players, so even that is a trade-off.

Eventually, the decision about how to play is going to have to come from the individual player - the biggest risk you can take with your character is not making the "best" choice, but picking something else because it is fun, or it is just what the character would do, or it's just going to make the story more awesome.  As a GM, the best incentive you can provide is making the results of those choices as fun as possible.  If the players start to see that their risky choices can lead to more fun by picking something other than mechanical optimization, then risky becomes the best choice.


If we be adventurers, let us adventure

How do you make sure your group is actually a group of adventurers?

I had been thinking about this topic for a while, and then yesterday I had a co-worker tell me the story of how the edgy/loner wizard in his Dungeon World game was essentially ruining the game for him (as another player), I listened to episode 4 of Table Top Babble (while not totally on the topic, bumped up against it a few times), and I watched Taking20's latest video.

I'll preface this all with the disclaimer that if you are running an evil campaign, or have a specific story hook (like the party is all from the same family, or are the survivors from the same village, or whatever) then most of this may not apply any you can go merrily on your way.  But if you are running a more usual party-of-adventurers style campaign, then this stuff can be pretty important.

If a campaign is going to go on for any length of time, having the characters debate "why should we go there?" or "why should we do that?" with every adventure path will get really tiresome and risk grinding the game to a halt.  The characters need to have a built-in reason to do stuff.  Most newer RPGs include some of this baked into character creation, but I don't think most go quite far enough.  D&D 5e has personality traits and bonds and ideals as part of the backgrounds, but I find that they are not always enough.

Characters need to have their own motivation to be part of the party and to seek adventure.  That's it.  But how do we make sure that happens?  And, since I am (and most players are) pretty lazy, how do we do this as easily as possible?

You could just tell the players that, and leave it there.  But let's see if we can come up with some tools to help them get to that goal in a way that is going to stick with their character through the game.

While you can require players to come up with pages upon pages of backstory, not all players find that enjoyable, and it does little to guarantee that the character will have a reason to explore the world and to find how the story of their character is the part of the story of the other characters.

Currently, this is what I'm thinking is a "minimum requirement" for a character questionnaire -- we want this to be as small as possible, but still force the players to think about their character in a way that will make the game better for everyone.  Also included are some questions that go less towards character motivation and more towards mine-able material for the GM.  If your campaign is less sandbox and more modules, you may not need to have extra story seeds, so feel free to ignore.

1. What key event(s) shaped/changed/influenced/defined you? 
2a. Why do you seek adventure?
2b. What people/places/things/ideas are important to you?
2c. How would someone (who knows well) describe you? 
3. What do you want to accomplish?

That's it, five questions.  Some of them are going to have the same (or related) answers, and that's fine.  As a GM, when looking over the answers (or when explaining to the players why answering them is important), here is what I would focus on:

What key event(s) shaped/changed/influenced/defined you?
This is the "cornerstone memory", to borrow from Westworld.  Some players are going to have some key backstory events in mind before they start to flesh out their character, but not all will.  You can easily come back and think of some key events if you would rather start with things like personality or more mechanical things like race and class.  For now we just want the player think about the event(s), and we'll work on making the events mesh with the personality traits and such as we go on.

A character could have several key events, but I think they should have at least one.  It might be the time they first saw a magic spell, or when orcs raided their village, or they stood up to a bully, or they stole something to survive.  The player doesn't need to decide every last detail of each event, but they should have enough specifics that it makes sense as something that clearly shows how and why it has shaped their current personality and and goals.  It should be a turning-point for a character, something that they can point back to and say "that is the reason I am x", for whatever x most clearly defines them.

If the event(s) don't tie into the personality and goals, the GM and the player need to work together to come up with something that does tie them together.

Why do you seek adventure?
This is the one that makes sure the characters have motivation to go out and do stuff.  I don't see any reason to beat around the bush with this one, I think it's best to just ask it straight out.  We not going to ask if they seek adventure, but why.  If the character isn't going to have a reason to delve into dungeons or fight monsters or save the town, then you are setting the group up to have a dysfunctional party.  If you've got a non-traditional campaign in mind, you may not need this, but for the stereotypical band of adventurers, this is the most important question to answer.

This is not to say that parties should be a hive-mind of homogeneous do-gooders, in fact different values and approaches are what is going to lead to interesting role-play, but having a reason to adventure is a pretty essential part of making an adventurer.   Reluctant adventurers are fine, as long as the reason for them overcoming their reluctance isn't something that is going to be resolved too early on.

If a player can't answer this, they either need to work with the GM to find something that would motivate their character (and perhaps the GM can incorporate such motivation into some of the campaign's initial events), or go back to the drawing-board with their character concept.

This is where you root out the lone wolf, spotlight hog, moody edge-lord, evil necromancer/warlock/rogue, classic chaotic-neutral asshole, PvPer, and such.  If you and the players want that type of game, that's fine, but set that expectation up front and make sure everyone is on-board.

What people/places/things/ideas are important to you?
This questions has three goals.  The first is to reinforce the previous questions, as the things listed here should probably tie into the key events or the reason to seek adventure.

The second purpose is to give a tie-in to the party, be it its member or its goals.  This is where the bonds and relationships that cement the party together need to be defined.  Again, this isn't a suggestion that every character is a life-long best friend of every other character, as there's a lot more fun role-playing space with characters that aren't always seeing eye-to-eye or know everything about each other.  There should be enough of a web connecting characters that there's some overlap and that a single character isn't the linchpin of the group's cohesion.

The third goal is optional, and that's to give the GM seeds for NPCs and events and locations for the campaign that will have a built-in reason for the the character to care about them.  It can be part of the world-building, and give you a lot of material to work with, from individual encounters to story arcs that span the entire campaign.

And again, you want to make sure that there aren't too few things here that if some of them are resolved there's no motivation left.

How would someone (who knows well) describe you?
This is meant to get the player thinking about the character's personality.  Again, it should tie into the previous questions.  If the personality traits aren't evident from those answers, the player should go back and figure out what they need to add to make it so.  There should be a reason a character is studious, foolhardy, brash, abrasive, curious, sarcastic, or whatever -- and if it is their defining trait, what is the event or story behind it?

What do you want to accomplish?
This is the final check to make sure everything is roughly aligned.  Not all party members need to (or should) have the same goal(s), but as a GM this is going to give you a good idea of the theme or possible arcs of your campaign.  For the players, they can consider if their character's only goal is adventure, or if they have other goals that influence or may be at odds with that purpose.  Again, goals here should have a reason for being here, if they don't go back and come up with an event or important people/places/things/ideas that gives them a reason, or change the goal to align with an event or important people/places/things/ideas.

That's it.  Five questions, several of which you probably have at least partial answers just from doing the regular character generation.  As a GM, they'd give me the framework to make sure the characters are all member of an adventuring group.


Character Backgrounds

Character backgrounds usually serve up to three purposes:
  1. Source for mechanical effects
  2. Roleplaying source for player
  3. Mine-able material for the GM
 D&D 5e's backgrounds give characters skills and such, as well as ideals/flaws/bonds which can be used for generating inspiration.  Any further backstory is usually up to the player.  Some like writing out long and detailed tales, others will just do the minimum the GM requires.  Depending on the style of campaign the that is being run, the GM may use the background to seed NPCs, events, and whole arcs or stories that the party will encounter and interact with.

The 2nd point is the one I want to focus on.  Players will often use their backstory as a foundation that defines or shapes their character's outlook or personality.  If the player finds their character in unfamiliar emotional territory, they can go back to the backstory as reference if it includes some sort of roughly analogous  event or situation.  This help give the player a consistency for how they portray their character.

Sometimes the character has a secret that may or may not be revealed during the course of play. Those usually tie into the 3rd point, where the secret and its reveal can become part of the story, though sometimes no GM intervention is needed.

However, I rarely see it used as a source for exposition where it isn't some secret, but rather just some event from the character's past.  Not to say it doesn't happen, but (at least in the games I've played), character background exposition for its own sake is kind of rare.

Now, look at films like Jaws with Quint's story about the USS Indianapolis, or Saving Private Ryan and Ryan's story about his brothers before they shipped out (or Miller's reveal that he is a teacher, though the way that is set up gets a little into secret/surprise territory), or Gangs of New York and The Butcher's story about cutting out his own eye.  These all give the audience a flood of details about the character in question.  And why is that?

If you conduct a lot of job interviews (and I have), you learn not to ask questions like "How well do you do..." as the answer gives you no useful information other than what the person wants to tell you.  A much better question is "Tell me about a time you recently did something that showed..." followed by whatever quality or skill your are interested in hearing more about.  Things people have done in their past speak volumes about how they will act in the future.  The movie examples do just that, by telling a story of how they acted in the past, you learn what to expect from them in the future.

How does this help RPGs?  Especially when introducing a new character to a group, until the opportunity arises for you to show you are a cold-blooded killer or a nervous bookworm or whatever traits your character has, there's not much you can do to effectively convey your character.  But if you take a cue from the movies, you can easily tell a story about yourself that tells others what type of character you are.

As a player, I think it's just too good a thing not to do. As a GM, I want to incentivize it.  More thoughts on that later.


Crabjack-21 - An update to the polyhedral dice gambling game

Crabjack-21 is a dice-based gambling game that uses a single set of d20/d12/d10/d8/d6/d4 dice, so it can make a nice fit for an RPG setting using something the players have on hand.  It's based of off Crabjack, but adds the d20 and has the payouts balanced to account for the extra die and higher total.

Crabjack-21 is played by a single player against the house, although any onlookers might make side-bets with each other about the outcome of any next roll.  The player makes their initial bet (within the house limits).  From now on the player is going to pick a die and roll it, adding it to their running total.  Each die can only be rolled once.  Depending on the total they are at, they will either win a payout (ending the game), bust out (ending the game), or have to keep rolling.

Getting an exact total (of all dice rolled so far) of 7 or 11 or 21 wins a payout.  The player busts out if they go over 21, having a total of 22 or higher.  If the player manages to roll all six dice without busting out, they win regardless of their total.  Some versions of the game (you can pick which version you like, or have multiple versions in your world representing local variants of the game) have special rule if you roll a 1 on the first roll:  It can immediately end the game (with or without a payout).

Here are a couple versions of the game, these all have a base payout of the bet plus half, and then a bigger payout for the 6-dice win:

(1st roll): Keep rolling
7 or 11 or 21 (1st to 5th roll): 1.5x
21 or under (6th roll): 2x

(1st roll): End game, lose bet
7 or 11 or 21 (1st to 5th roll): 1.5x
21 or under (6th roll): 6x

(1st roll): End game, but get half bet back
7 or 11 or 21 (1st to 5th roll): 1.5x
21 or under (6th roll): 5x

Outside of a casino-like environment, gamblers can take turns being the house.  They should agree on each taking the same bet and number of turns being player and house.  If played this way, you can can tweak the payouts to whatever you want, e.g. 2x on 7/11/21 and 10x on a 6-dice win.  Those higher payout numbers would make being the house all the time a losing proposition (with perfect play), but it doesn't matter if both sides take turns playing the same way.