2007-06-02 Hex Mapping

I’ve always wanted to produce good-looking old-school black-on-white hex maps for my roleplaying games. But I didn’t want to use Windows.

Update: Now available as a CGI script! You can also link to your maps directly. Check out the Perl sources of the script.

I broke down and wrote a prototype. Behold my awesome SVG powah! :D

The input file is plain text! Behold my awesome ASCII art powah, too!! :D

The output is SVG, which I then convert via EPS to PDF. Check out the PDF result.

I found that the best solution was to convert from SVG to EPS using InkScape, and from EPS to PDF using ps2pdf or the OSX Viewer. In my particular case, I just used the following Makefile:

%.eps: %.svg
	echo Ignore Gdk-CRITICAL and WARNING messages
	/Applications/Inkscape.app/Contents/Resources/bin/inkscape \
	--without-gui --export-area-drawing --export-eps $@ $^

%.pdf: %.eps
	ps2pdf $^ $@

Producing the SVG was the tricky part. I used a little Perl script called old-school-hex.pl.

What next? Add more “tiles”, obviously!

Here’s how to do it. First, produce a SVG file using a single dot as the map. This gives you the empty hex.

echo . | perl old-school-hex.pl > empty.svg

Then fill it with some strokes, simplify them, delete a few extra points on the paths, and save. Open the file in you favorite editor and extract the stuff you added, move it into the script data at the beginning, in the defs element, following the grass example. Add an appropriate character mapping to the %char table and you’re done!

That’s what I’ll do right now.

I’m not yet sure how to add roads and rivers.

I’m already starting to wonder... would it make more sense to have all the hex types in the current directory, and use their filename as the reference, and include them as necessary? :) Maybe if this turns out to be the greatest thing since sliced bread. Perhaps I should turn this into a CGI script...



Very neat!

Reminds me of the Realms generator I created for Fields of Blood. Here's the code for the Realms stuff and this is the hexmap builder.

That was much fun to hack, and my scrappy code might give you a few ideas too :)

GreyWulf 2007-06-03 08:31 UTC

Yikes! “My next challenge is roads, coastlines and rivers.” Sounds familiar…

AlexSchroeder 2007-06-03 08:37 UTC

Unfortunately I moved onto other things after failing to drum up enough support for Fields of Blood in my group. Boo!

Now I really need a good hex mapper, so methinks I’ll go back to this and carry on with it. I liked the look of the maps :)

GreyWulf 2007-06-03 09:05 UTC

Heh. My code has the benefit of producing SVG, which you can scale and print and it still looks good. You could replace the tiles I’ve been using by translating the $im->line stuff with the appropriate elements. I just looked at output Inkscape generated and the SVG spec and was all set.

I’ll have to think of a solution for rivers, roads and frontiers. Or perhaps I should just give up and keep hand-drawing my maps. Yesterday I ended up printing an empty hex map and hand drawing everything else in it. I thought it looked great. I’ll have to scan it in once my players have been through it.

I might as well just stick to hex paper. Hm...

AlexSchroeder 2007-06-03 09:19 UTC

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.