Revamping the Heraldry Generator

Over the past two months, I've been working on rewriting the heraldry generator completely from scratch. I discarded all of the original code, including all of the SVG charge definitions, and started over.

I applied two years' worth of learning how to write better Go code and how to write better generators. I also converted the entire world project to use the new Go 1.13 error wrapping pattern, but I won't go into that here. Let's look at the changes in the generator's function and output.

Fewer Restrictions

The new heraldry generator doesn't have the restrictions of the original one. In the original, furs – that is, patterns like erminois that could take the place of colors or metals in fields – would only be used for the first part of a field, and never the second. No one ever noticed this, as far as I'm aware, but it was a problem nonetheless. Also, the original generator could only handle one iteration. It would never be capable of marshaling, which is when one coat of arms is included in another as a component. The new one is, though it doesn't currently generate marshaled arms. Also, there were a few technical headaches with the old one – like passing image data – that are no longer present in the new one.

New Charges

The new generator also makes it significantly easier to add new charges. At its peak, the original generator had 73 charges. The new one currently has 68, but the source I'm using for new charges – Heraldic Clip Art – has over 3,000 potential ones I can import.

Per bend azure and Or, two tigers passant argent

The above is an example of one of the new charges.

New Shield Shapes

Also, the new generator has four possible shield shapes instead of the original one, and it's possible to tell the generator which one you want. Here are the new shapes:

Per fess purpure and Or, an ape Or

Engrailed

Per bend azure and vert, three unicorns rampant argent

Banner

Per bend sinister purpure and sable, an ape argent

Wedge

PNG Output and Permanent Image URLs

Finally, the new generator no longer returns SVG as a string, expecting some other system to cache that for awhile. Now, it generates a PNG image of the heraldry, and saves it to Digital Ocean Spaces, where it will remain forever as a real file. If you bookmark that image URL, it will always be present. You can also save the image, and many more things like PNGs than they do SVGs.

Previously, it was possible for the caching system Redis to forget your heraldry, at which point it was unrecoverable and the URL to it would no longer work.

Release and Future Work

The new generator is currently on the Iron Arachne dev site. It will be live on the normal site at the end of September.

In the immediate future, I'll be adding more charges to the generator. I hope to have somewhere around 300 in the system before the end of 2019. I also want to make use of the new tagging system that's in place to allow people to generate heraldry by searching for keywords. For example, if you wanted heraldry appropriate for a coastal city, you could in the future search for “navy” or “ocean” and get only charges that fit that. In addition, I want to change the generator web site so that it has more options, like shield shape, charge tags, preferred tinctures, and so on. That last part will take longer to implement and may end up releasing in 2020.