Text Mapper

Text Mapper is a web app to quickly generate a map based on a textual description of the map. The result is an SVG file and therefore scalable.

There’s a Mastodon bot posting maps: @textmapper!

The source is available.

2019-08-06 Hex Describe, Face Generator, Text Mapper, and more

If you’re wondering where the discussion regarding Hex Describe, Face Generator, and Text Mapper actually happens, the answer might surprise you: it happens on the Diaspora network!

There, I create new threads every now and then for people who want to talk to me about these applications. They allow people to generate a mini-setting including a map, a key, and NPCs, with but one click, powered by the greatest collection of random tables I know. 😅

I keep creating these threads whenever the previous thread reaches about 100 comments because it starts being unwieldy.

Here’s a list if you want to explore:


Add Comment

2019-07-08 Square Traveller

OK, square maps instead of hex maps, for Traveller, right?

This is the sort of map the Traveller Subsector Generator creates. It’s pretty good, I like it.

Original map

If you use the same data and rewrite it somewhat, you can use Text Mapper to generate the same map, but now with rounded communication and trade lines:

Hex map

And since Text Mapper recently got the ability of creating square maps instead of hex maps, all I had to do was fiddle a bit with the data, move the black frame around, move the labels into the correct positions, and we’re nearly there:

Square map

There are still so many things wrong: the symbols overlap the coordinates and the labels; the lines intersect the labels, so basically everything is terrible and unreadable at a second glance. But it will have to do for the moment. Perhaps if square Traveller maps make a breakthrough one day! 🤪

The map generated uses a separate map, Which in turn uses a separate library. If you want to regenerate, you need to put the following in the text area:

include https://campaignwiki.org/contrib/traveller-square-example.txt


Or take a look at the map and modify to taste.


Add Comment

2019-06-17 Text Mapper with Squares

I’ve been trying to see whether I could get Text Mapper to create a square grid instead of a hex grid. Preliminary results aren’t too bad!

This is the traditional example hex map:

Hex Map

And this is the result when you feed the same text into a square grid mapper:

Square Map

It already looks like magic!

The goal I have in mind is to generate square-based Alpine maps.

And maybe I could change my Megadungeon Generator wanna-be to use it as the output instead of Gridmapper. Once I have that, I can generate images using web services without relying on a browser rendering the Gridmapper Javascript code.

OK. Alpine maps. I mean, the algorithm often uses loops over the six neighbouring directions in order to create the textual description of the map, so that surely needs fixing.

Then again, once the textual description has been generated, the code no longer cares about hexes and squares, as seen above. It just looks – different.

Let’s give it a try.

Random Alpine hex map:

Alpine Hex Map

Same data, but using squares:

Alpine Square Map


It is in fact recognisable! Like some weird projection from a strange fantasy cartographer. Uncanny.

I’m not even sure I want to change anything at this point! A quick scan at this point just shows that cliffs don’t look too good (because the icon library still uses six different cliff icons).

Well, a bit more studying also reveals that some spatial relationships are disrupted, like the swamp for 0102–0201. Or the river that flows from 1204–1105 now makes a detour through the mountains of 1104.


Comments on 2019-06-17 Text Mapper with Squares

Those pesky fantasy rivers 😝

Ynas Midgard 2019-06-17 13:02 UTC

I love some of the U-turns these rivers are making. 🙄

– Alex Schroeder 2019-06-17 18:18 UTC

I’d love to see Text Mapper with squares evolve into a tool you could map a dungeon from a text source. This would be awesome. The hex based map is one of the best campaign building tools, I’ve ever come across, particularly when combined with Hex Describe to populate the Hexes. It would be great to expand on this by having a tool to generate dungeon maps based on a square grid.

– Stephen Peto 2019-06-17 18:21 UTC

Did you give Megadungeon a try? Reload it a few times until you get close to 100 steps and click on the last one. You’re sent to Gridmapper. Here’s an example I got after a bunch of reloads, three levels deep.

Gridmapper would make a pretty good tool for interactively making a dungeon, and Megadungeon could be improved as well. But unfortunately we cannot embed Gridmapper into Hex Describe. If we want to generate dungeon maps for Hex Describe, we’ll have to enable this via Text Mapper.

So in short: yes! This idea excites me!

Perhaps one day we’ll need a way to import Text Mapper maps into Gridmapper such that we can edit it there, and then export it back from Gridmapper to Text Mapper. That would be very cool.

– Alex Schroeder 2019-06-17 18:30 UTC

At last, the Alpine algorithm can deal with a square grid and hopefully all the river anomalies have been resolved, now!

Rivers work, now

Next: extracting the SVG for the Gridmapper icons and making them available for Text Mapper...

– Alex Schroeder 2019-06-17 20:17 UTC

Add Comment

2019-04-23 Maps inspire me

I sometimes like to look at those larger maps with fewer mountains. I start speculating about this village being so close to the chaos temple; the small settlements at the foot of mountains with temples of law; I love how the humans try to avoid settling the swamps; how one would travel up river to find the source somewhere high up... In this respect, a map truly serves as an inspiration for the game.

Generate some yourself using the Alpine generator for Text Mapper.

Click to enlarge!

Image 1


Comments on 2019-04-23 Maps inspire me

If you’re wondering about the algorithm: here’s how to show its limits: if you start with just one peak, and a large enough map, you get an island centered arouond a volcano.

Image 2

– Alex Schroeder 2019-04-23 13:08 UTC

Love this, I 100% agree. My gameplay and worldbuilding emerge from the maps I generate, not really as much the other way around.

Shelby 2019-04-23 15:54 UTC

That reminds me, can I add your blog to the Old School RPG Planet?

– Alex Schroeder 2019-04-23 20:54 UTC

Add Comment

2019-04-19 Text Mapper Tweaking

I’ve been working on Text Mapper again. The result is shown below. It probably only affects maps with a reduced number of peaks. In those cases, the altitude can drop down until it meets the sea. At those lower altitudes, I was seeing some strange effects:

Altitude is measured in integers and it drops slowly. That is, on your way to the sea you might see altitudes dropping like this: 4 4 3 3 2 2 1 1 0. Thus, it sort flows in “steps,” and the way I had written it, once a river flows into the next hex and this hex has the same altitude, a swamp forms. Thus it had a swamp on every second hex. In effect the map showed “stripes” of swamps.

The map also had no concept of “dry” land. As we move away from the mountains, however, there are fewer rivers. I was at a loss. How did the landscape look in ancient Germany, with fewer mountains and everything being flat compared to Switzerland? I hear the Romans thought it was heavily forested. But was it forest (dry ground) or swamp (wet ground)? I don’t know. So I went with forest. There can be swamps along the river, but without a river, there is no swamp. Right now, when I place a forest, it will grow up to two hexes into “dry” hexes without a river. In the image below, the forest on the left edge would be an example.

At the same time, I now had a better idea of what “dry” land is: that’s the land that isn’t mountains, or swamps (along a river) or forest. Just for variety, I decided it should have some hills (for a while I had 50% hills but that seemed like a bit much so I reduced it), and grass. I had seen some nice prairie pictures on social media and wanted some grasslands even thought I don’t think ancient Switzerland had grasslands. In the image below, the grass lands in the bottom left would be an example.

Anyway, as Hex Describe also uses these maps, I’ll have to think a bit more about grass land encounters! 🙂

Oh, and enjoy the temples of Law in the mountains and the temples of Chaos in the swamps! 😀

Image 1

If you are interested in the icons, take a look at the Gnomeyland example.

Oh, and for a weekly map, follow @textmapper. 🙂


Add Comment

2018-07-03 Rotating Text Mapper Maps

A user sent me a little NodeJS script to rotate a map in order to get “stacked columns”.

I wonder whether I should add a different hex stacking option to Text Mapper.


Add Comment

2018-06-14 Wrote a Bot

I wrote a Mastodon bot: @textmapper. It posts a Text Mapper map once a day.

It was surprisingly easy to do! I’m still confused by how easy it was. I was expecting some bugs. It... just worked!? I had great libraries to work with: Mastodon.py, CairoSVG, and all the other things I used.

I’m also using the Software Wiki to keep track of ideas.


Add Comment

2018-03-29 Generating Islands

Vague thoughts on randomly generating a map for a pirate campaign, or a colonialism, slavery, the spice trade, the silver train (and robbing it), and all that.

Think about the Haitian Revolution. Or Ching Shih. Pirates! The Philippines.

I think the first problem I usually have is island formation. Specially if we want atolls, or a chain of islands. Are we going to model a hot spot like Hawaii? Or something like the Caribbean, or the Pacific Rim? How many hexes per island are we going to aim for? If it is going to be just three or four per island, then questions of altitude are moot. But if we want to generate islands like Cuba and Tahiti, the result would be very different.


Add Comment

2018-03-12 Describing Hexes

On Google+, Zak asked for a tool that would generate both a map and a description of said map.

Well, I have Text Mapper which creates beautiful maps, but I have no random tables to describe those maps. But I can work on that. And perhaps you can help?

If you feel like contributing to this, feel free to leave your contributions in a comment on this blog, or tag me on Google+ or Mastodon, or contact me some other way.

Here’s my example map:

Image 1 for 2018-03-12 Describing Hexes

The map description looks like this:

0101 dark-green trees village
0102 light-green bushes
0103 light-green bushes
0104 light-green bushes
0105 light-green bushes
0106 light-green forest-hill
0107 light-grey mountain
0108 white mountains cliff1
0109 white mountain
0110 light-grey mountain
0201 dark-grey swamp
0202 light-green bushes
0203 light-green bushes
0204 green forest
0205 light-green fir-forest
0206 light-green firs thorp
0207 white mountain cliff1
0208 white mountain
0209 light-grey mountain
0210 grey swamp


If you want, you can copy and paste this description into Text Mapper and it should regenerate the map shown above.

The random tables look like this:

1,the air up here is cold
1,snow fields make progress difficult
1,there is a hidden meadow up here, hidden from view from below
1,steep cliffs make progress practically impossible without climbing gear
1,nothing grows up here except for a few patches of lichen on gray rocks


As you can see, the format is simple:

  • a semicolon introduces a new table
  • each line in a table consists of the relative probability, a comma, and some text
  • if the text has something in square brackets, that is in turn looked up in a table

I tried to use the format used by Abulafia.

And it works!

Take a look: Hex Describe.


Comments on 2018-03-12 Describing Hexes

The work is ongoing. Let me know if you want to contribute.

– Alex Schroeder 2018-03-14 12:50 UTC

I think I’m done with all I wanted to do. The monster entries were based on the monsters in my H&H Ref Guide.

– Alex Schroeder 2018-03-14 22:14 UTC

Add Comment

2017-07-07 Text Mapper Command Line

I recently posted some examples of how to Traveller Subsector Generatorfrom the command line. Here’s how to do the same thing for Text Mapper.

xmllint allows us to extract text from XML and HTML documents. On a Debian system, it’s part of libxml2-utils.

Generate a text file with a 20x20 alpine wilderness map:

perl text-mapper.pl get /alpine 2>/dev/null | xmllint --html --xpath '//textarea/text()' - > random-alpine-map.txt

You’ll note that at the very end it contains the seed value.

You can regenerate the same map using this seed:

perl text-mapper.pl get "/alpine?seed=1499413794" 2>/dev/null | xmllint --html --xpath '//textarea/text()' - > 1499413794.txt

You can also modify the width and breadth of the map:

perl text-mapper.pl get "/alpine?width=10&height=5" 2>/dev/null | xmllint --html --xpath '//textarea/text()' - > random-alpine-map.txt

Let’s define an alias to handle the encoding of the map for us:

alias encodeURIComponent='perl -pe '\''s/([^a-zA-Z0-9_.!~*()'\''\'\'''\''-])/sprintf("%%%02X",ord($1))/ge'\'

Make some changes to the text file generated above using a text editor and generate the updated map:

perl text-mapper.pl get --header 'Content-Type:application/x-www-form-urlencoded' --method POST --content map=$(cat 1499413794.txt|encodeURIComponent) /render 2>/dev/null > 1499413794.svg

You can use svgexport to generate a PNG image, if you want.

First, install it:

npm install svgexport -g

You need to tell it what quality to use when exporting. I use 100% for PNG files; I’d use less for JPG files.

svgexport 1499413794.svg 1499413794.png 100%

I guess I have all the tools to create a Twitter bot? ;)


Add Comment



Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.