Metacastle: a procedural castle

Last year I participated in a procedural castle contest on reddit’s r/proceduralgeneration community. I ended up with castles like this:


or this:


The tiles are all from Kenney’s Roguelike RPG Pack – this was the first time I used Kenney’s assets and I recommend them (I had to edit some a bit to do exactly what I wanted – especially to add crenelation going in all the directions I wanted).

I  added a bit more architecture details in the writeup on reddit.

These kind of small projects with a hard deadline are easier to work on than unbounded ones like infiniworld, and are also better places to experiment with algorithms and architecture.

The algorithm could be understood as consisting of three functions:

  •  one taking a random seed and generating an abstract layout description (“a big central keep, with a courtyard decorated with flowers, and a wall with seven towers around it”)
  • one taking a random seed and generating a “theme” description (e.g. brick walls with pointy windows) – here the goal is to have a somewhat consistent style
  • one taking those two abstract descriptions, and generating the set of tiles to actually render – this one is (hardly) not random, and the goal is just to “fill in the details” so the castle looks. This part also requires the most work.

In retrospect, the castles do all kinda look the same – if I had had more time to spend on the layout generation I could have made more varied castles for cheap. But then the project might have dragged on forever, so I’m not unhappy with the current result.

Live version here, github repo here.

Metacastle: a procedural castle

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s