# What Is Procedural Generation

Procedural Generation can be interpreted quite broadly as just “making computers make cool creative things”. People make art, games, music, audio, stories and all sorts of weird things.

I’ve been doing it as a hobbyist for some time, and have become more and more involved: I make tutorials, projects, I sell a tool online for a niche algorithm, and recently taught a “masterclass” at Everything Procedural, the main conference for professionals in the space.

I thought I’d spill some digital ink about what it’s actually about. I get asked often enough, and this will help me clarify my verbal answers.

# Publishing An Open-Source Library for Unity

So you’ve got some open source C# code, and you want to publish it for other users in Unity? I’ve explored a few options, here are the pros and cons.

# 0.999… = 1, with Rigour

I’ve recently seen a lot of demonstrations of why the decimal 0.999… equals 1.

These are endlessly cycling the internet, simply because all the simple explanations aren’t really compelling. You see smart people responding “can’t you just…” or simply not convinced by bare assertion.

The truth is that is that dealing with these things is actually a lot more complex than a glib twitter answer. You should feel uneasy with these explanations. This same subject confused mathematicians of earlier centuries, leading to awkward theories like “infinitesimals”, which ultimately fell out of favour.

I’m going to take you through a proof that 0.999… = 1, with rigour. Rigour is a term used in maths for building from a solid foundation and proceeding from there in sufficiently small steps. Thus, the majority of the article is not the proof but the definitions. How can we talk about infinity in a way that makes sense? The trick, as we’ll see, is to only talk about finite things we already understand, and define infinity in terms of those.

This article is aimed at those with high school level maths. There’s a proof halfway down, but it’s skippable.

# Ortho-tiles

Last time, we looked at quarter-tiles. This was an auto-tiling technique for square grids. Each cell in the grid is associated with a terrain (i.e. either solid or empty). Then the squares were split in four, and each quarter was assigned an appropriate quarter-tile.

Otho-tiles extends this procedure to work with irregular grids, even non-square grids. We just have to alter the procedure a little, and be ready to deform the quarter tiles fit in place.

## Ortho?

Ortho is a Conway Operator. It can be thought of as the extension of dividing a square into 4. It divides each n-gon into n “kites” or “ortho-cells”. Each kite is a four sided shape containing the cell center, one corner, and the midpoint of the two edges adjacent to that corner.

The appeal of the ortho operation is it can take any polygonal grid, no matter how irregular, and convert it into a grid of 4 sided shapes. And it’s much easier to work with something that has a consistent number of sides.

# Quarter-Tile Autotiling

Since Oskar posted about it, I see an increasing amount of praise for his Dual Grid proposal for autotiling terrains. It works by drawing tiles at a half-cell offset to the base grid, creating a dual grid, and using marching squares autotiling to select which tile to draw based on the terrains the corners of the dual grid, which is the centers of base grid.

This is a great scheme. It’s simple, only needs a few tiles and can be extended quite easily. It’s used in many games.

But, it does have some drawbacks. The dual grid is difficult to get your head around. You have to worry about ambiguous tiles. And despite being a substantial improvement over the blob pattern, it still requires drawing quite a number of different tiles.

I’m here to explain an alternative, quarter-tile autotiling. Quarter-tiling has also been called sub-tiles, meta-tiles (when doubling instead of halving). I’ve previous described as micro blob, which is the same thing with precomposition. It’s best known for being the tiling built into the RPG Maker engine.

Quarter-tiling is pretty easy to implement, and requires substantially less effort to create tiles for, as it uses fewer, smaller tiles. That does mean it’s not possible to produce as much tile variation as marching squares. But there’s plenty of techniques for adding that back.

Later, we’ll look at ortho-tiles – an extension of quarter-tiles to irregular, non-square, grids.

# Everything you need to know about Quaternions for Game Development

They represent 3d rotations.

That’s it, that’s the article.

# Learning to Finish Things

For many years I was a hobbyist programmer. I’d try out small projects, experiment, then move on to the next thing. This was a great way to learn a lot, but I’ve got almost nothing tangible to show from that era. Despite the best of intentions, every project reached a point where it started to drag, and I’d get bored and move on.

It was only a problem for the projects I worked on myself. Working for others, I never really found the same problems. It was a problem of motivation and focus.

More recently, it is different. Now when I start hobby projects, there’s a good chance I’ll cross that finish line, and have something I’m ready to share with the world. What changed? Well in part it is increased experience and maturity, things I cannot teach. But also, I have found some strategies and thought processes helpful, and other, very tempting ones, not so much.

In short, I’ve learned to finish, which is a real skill you can learn over time. I thought I’d share with you what has worked for me. Maybe it’ll work for you too. I make software, but I think this advice is generally true for any other spare time activities. There’s three sections – scope, motivation and distractions.

# Rotation Graphs

Graphs are a data structure we’ve already talked a lot. Today we’re looking at extension of them which is both obvious and common, but I think is rarely actually discussed. Normal graphs are just a collection of nodes and edges, and contain no spatial information. We’re going to introduce rotation graphs (aka rotation maps) that contain just enough information to allow a concept of turning left or right – i.e. rotation.

# Editable WFC

When I spoke about autotiling, I briefly touched on how it’s possible to use Wave Function Collapse (or other constraint based generators) as a form of autotiling, i.e. user-directed editing of tilemaps.

I’ve usually referred to this technique as “editable WFC“. It’s a combination of autotiling and WFC, and contains the best of both:

• Being an autotiler, it allows users to easily and interactively make changes to an existing level.
• Being constraint based, it automatically ensures that those changes are consistent with the predefined rules of the constraints, potentially making further changes to the level to make it fit

This is different from most other autotilers, which either require manual configuration of patterns used to enforce good behaviour, hidden layers, or come with more stringent requirements on what tiles are available.

# Resolving Ambiguities in Marching Squares

One issue with 2d Marching Cubes (i.e. Marching Squres) that I glossed over in my original tutorial is the issue of ambiguity. Later I talk about how dual contouring avoids this problem. But it turns out there’s actually a well known, but little documented way of resolving those ambiguities called the Asymptotic Decider, which I’ll explain below.