Procedural generation of triangular glyphs

- 2 mins

Colors for triangular glyphs

Some days ago I randomly ended into the subreddit on Procedural generation, which I didn’t suspect existed. In specific, I ended up into the monthly challange of March 2017.

As you can see there, the challenge was on generating a set of runes, glyphs, or symbols. I found the challenge very interesting and starting from one of the pictures they reference (this one) I decided to create my own generator as an excuse to learn a bit of Haxe and OpenFL.

I focused on the gliphs with triangular forms, the ones called “actions” in the reference picture. I first sifted the gliphs from the figure in order to have a more clear picture of the type of triangular gliphs I wanted to create. So, I removed “connect” and “reflect” since they broke the pyramidal structure of the other ones. I also sifted “learn”, “understand”, and “protect”, because they added two new elements (the circle and the dot) that I dislike.

I started by placing a triangle in a matrix of 5x5 dots. Then I assigned a probability of 0.9 to a close-base triangle and a probability of 0.1 to an open-base triangle.

Outline of triangle glyphs

With the border already working, I dissected the original glyph and obtained ten small pieces with which to generate the filling of the triangle to create a glyph. I assigned the same probability, to each piece, to be part of the final glyph.

Content of triangle glyphs

After many tests, I decided to impose some rules to avoid the creation of overcharged glyphs:

  1. A glyph will have a maximum of a border and three pieces with a probability of 0.6 to have a single piece, 0.3 for two pieces, and 0.1 for three pieces.
  2. Each part can only be included once (I know, this one is obvious).
  3. When added any diagonal lines none of the following pieces can be added (and vice versa): (small) happy face, (small) sad face, leg (line in the middle), (large) sad face, nor any diagonal.
  4. When added (small) sad face we cannot add a large sad face (and vice versa).
  5. Beltline (horizontal midline within the triangle) cannot be combined with the lance line (horizontal midline across the triangle).
  6. Ceiling (horizontal line on the top of the glyph) and lance cannot be combined.

With these rules in place, I liked the type of glyphs obtained from the random generation.

The last part was to decide the colors to use as background and for the glyphs. I went for a old-paper color as background and some old-ink colors for the glyphs:

Colors for triangular glyphs

The final piece can be seen in my dashboard at itch (just look for “Triangle Glyphs”). The small web application allows you to generate a wall with 30 randomly generated glyphs, an alphabet with 25 unique glyphs, and to see the pieces used to create all of them.

The code is available at GitHub.

Carles Hernandez-Ferrer

Carles Hernandez-Ferrer

Bioinformatics, data analysis and software development

rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora