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.

available as a CGI script

link to your maps directly

Perl sources of the script

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

SVG

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

input file is plain text

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

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.

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...

​#Software ​#Graphics ​#Pictures ​#Maps ​#Hex ​#RPG

Comments

(Please contact me if you want to remove your comment.)

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.

Realms generator

Here's the code for the Realms stuff

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

GreyWulf

---

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

– Alex Schroeder 2007-06-03 08:37 UTC

Alex Schroeder

---

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

GreyWulf

---

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.

the SVG spec

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...

hex paper

– Alex Schroeder 2007-06-03 09:19 UTC

Alex Schroeder