Arcane Game Lore

Notes for tonight's game: TPK!!!

Creating Starmaps

I’ve mentioned the community designed Spacer RPG in a previous post.  In that G+ community, the call went out for building star maps for the game.  As an astronomer, I wanted to take a stab at creating a “realistic” map, by which I mean something built on actual stellar statistics and such.  I had most of the data I needed already as I had started working on a related project several years ago.  Some of the exact numbers may be off due to new discoveries but not by much.

I had a lot of fun making up some sample maps.  I created four to start with.  You can see the maps and the full descriptions on the related G+ posts, but the maps were

  1. 2D with a stellar density similar to that near the sun – light year scale
  2. 2D with a higher stellar density – light year scale
  3. 2D with a stellar density similar to that near the sun – parsec scale
  4. 3D with a stellar density similar to that near the sun – light year scale

Here’s that 4th one:

3D star map. Space volume is 44x24x25 light years. Each star is labeled with its height above or below the plane of the map. (click on image to go to original post to see full resolution version)

At this point I was just simulating the proper stellar multiplicity – the correct number of single and multiple systems.  There is no information here about the type of star or anything of that nature.  As was suggested in the community, it would look even better if there were symbols for the stars that represented their spectral types.

I had the data to generate that so I whipped up a list of random numbers and assigned broad spectral types to each of the stars (O,B, A, etc, not going down to the G2, G3, G4, etc. level)  My generation tables included all stellar types in the appropriate proportions.  Which of course means that most of the stars here are going to cool M dwarfs as that this the most abundant stellar type but that there would be a smattering of larger stars as well.

Of course to represent the different star types on the map, I’d need different symbols.  The one I’d been using I just kind of created out of whole cloth and it is a little intense.  The question was what should I do to differentiate the spectral types, what colors should I use, and what should the symbols look like?  After looking at a couple of options, I decided I’d try to go with something that was close to the actual color of the star.  So I started with this page that lists all the RGB colors of every spectral type of star.  In addition to providing the data, he provides the references for his data sources as well as how the colors were derived.

I took the color from that page to be the central color of the star and then added a darker edge and an even darker halo around the star to make the symbol for each of the spectral types.  In addition, I made the M star, brown dwarf, and white dwarf symbols half the size of the other stars. (Neutron stars and black holes would have been 75% if any had shown up and giants would have been 50% larger).  I then connected up the star systems that contained F, G, or K stars (the ones most likely to actually have habitable planets).  The resulting map looked like this:

Same map but with spectral types and distances added. (click on image to go to original G+ post with more details.)

The numbers on the lines connecting the stars represent the distances between them (in light years).  The third dimension definitely adds some interesting features.

Image of Sun with sunspots. (click on image for source and a page on limb darkening)

I wasn’t completely happy with the star symbols on this map as I felt they were a bit too fuzzy and wanted to try to make them more distinct.  The look I was going for was something like the image of the sun to the right where you have limb darkening as you move to the edge of the star.  Plus I wanted a corona or glow around the star’s image as well.

So I went back to the drawing board and looked at my stellar symbols yet again.  I realized that simply by swapping the darker color I was using for the coronal glow with the lighter color I was using for the rim of the star, and playing with the gradient effect I was using, I could get a much more defined image.  So I made up a chart showing all the old and new stellar images and posted it to the community for comments.

Each of the old and new symbols plus some binary systems with the new symbols. (clicking on image takes you to the original post)

These symbols were much less blurry but I may still need to tweak the central color as there is sort of a concentric circle effect on the bluer stars.  These are actually twice as big as they would appear on an actual images so maybe it’s not quite so bad.  It’s something to keep in mind as I go forward.

As someone commented in the post on this image, there was still some fuzziness in the binary images and not as good a distinction between the stars as could be desired.  I looked at a couple of ways to make them more distinct and first thought of layering a dark ring under the star (as the edges are semi transparent) but that didn’t work at all.  In the end I found that putting an opaque black disk under the star worked really well as you can see in the image below.  It had no effect on the image when the star was by itself (or the back star in a multiple) but when place on top of another star in a multiple system you got a nice separation plus the limb darkening effect I was looking for.

A pair G star, a single G star, and a G and M binary pair using the new star symbols

Okay, so things are looking good.  But at this point I’ve been doing all of this by hand (with the exception of rolling the random numbers, that would have been a lot of dice) and I got to thinking.  I’m a programmer.  I’m an astronomer.  I should be able to write something that would generate all of these star systems and draw out the map completely automatically.

The trouble was I know very little about writing graphics files.  I made my first maps in Gimp and had just used a combination of brush strokes of various diameters to create the originals symbols.  The new symbols were created in Inkscape and were SVG files (that I then imported into Gimp to make map 5).  I knew that SVG files were really just code but I didn’t know much beyond that.  So I started looking into how they were created and how to make images and it turned out that it wasn’t as hard as I had feared it might be.  Especially since I could make an image in Inkscape, save it, and open it up in a text editor to play with and see how it all fit together.

At that point I started playing around with the SVG file for the G star to see if I could manipulate it properly by hand.  I made a few mistakes but finally figured it out and boiled it down to the essentials I would need in a program to make the images.  In fact, that last image above with the binaries was actually an SVG image file that I created by hand.  Google wouldn’t let me upload the SVG so I converted it to a PNG in Gimp but the file was created completely by hand.

The next step was to write a program to create the star field.  My current prototyping language of choice is Python so that’s were I started.  I banged out a few functions to create the SVG code needed for a single star image based on its spectral type, wrote some functions to write out the final SVG file and then threw in some random position generation and hardcoded spectral types, plus a bit of logic for positioning the stars when in binary systems and I ended up with this image:

Computer generated  star field

Everything is on a simple Cartesian grid, there’s no background, no grid lines, and no connecting lines or labels but I got over the first hurdle of figuring out how to draw single and multiple star systems.  And since it’s written out as an SVG file. I can open it up in an editing program like Inkscape or Illustrator and tweak it by hand as needed.

So that’s were it stands right now.  I’ll be continuing to develop this over the coming weeks to add the full generation process including determining the position of the star systems, the number of stars in each system and the spectral types of the stars.  I’m planning on having the option for Cartesian and hex grids. I’ll also need to work on the positioning of the individual symbols in multiple star systems.  After that I’ll look a ways to determine which connections to draw between stars as well as drawing the connections and labeling them as well as labeling the height above and below the map plane.

Do you have any thoughts or comments on the process?  An suggestions for ways to improve the symbols?  Would you be interested in having a program like this for you to use?  What features would you like it to have if you did?  Let me know in the comments below.

Categorised as: Game Aids | Game Design | Resources | World Building


  1. [...] a couple of weeks ago I posted my initial foray in to writing a program to generate random star maps.  In that post I had figured out how to [...]

  2. [...] start adding bells and whistles to the star map generation process I described in my earlier posts (part 1, part 2).  Specifically, drawing connections between star systems and labeling them with the [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>