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

Introducing InfiniWorld

In which I talk of old projects, and introduce a new one – InfiniWorld, an infinitely scrollable procedural world.

Once upon a time I was very interested in the idea of procedural worlds – writing a program that generates mountains, coasts, cities, ecosystems, kingdoms, histories, plot hooks, etc.

So I played around quite a bit with Python, and built things I liked.

But I never actually released any of this, mostly because a lot of my graphics came from commercial products like RPG Maker, which I didn’t really have the rights to redistribute, but also because though Python has many qualities, “simple to distribute” isn’t one of them. Running one of these prototypes requires installing a bunch of libraries and trusting my code, or have me painstakingly generate an executable that would only work on a single platform. So they ended up collecting virtual dust on my disk drive while I got busy with life.

So I set those aside, got busy with life, and worked on other fun stuff – and in the process, I got much more comfortable with JavaScript. So eventually I used it to make new procedural worlds.

My goal wasn’t to make a game, but just to play with fun algorithms and make an interesting and endless world, focusing on meaningful descriptions and relationships rather than graphics.

And now you can test an early, very rough version: InfiniWorld.

Screen Shot 2016-01-10 at 23.05.42

It’s far from being nearly as interesting as I want it to be, but it should give an idea of what I’m aiming for. Some features:

  • You can click on cities to get a description. Those include some content from the excellent Abulafia website; My plan is to replace those with more meaningful descriptions.
  • You can drag the map around nearly infinitely (you will run into problems over 1016 tiles in one direction), the content at a given place stays the same (until I publish a new version)
  • The biomes distribution is inspired by the Whittaker Diagram.
  • You can find the sources on GitHub (this time I didn’t rely on a bunch of art I didn’t own).

There’s the old saying that “if you’re not embarrassed by your first version, then you didn’t release early enough”. I’m glad to say I pass that test!

That’s it for now! I’ll talk about crunchy details, as well as other projects, in later posts.

Introducing InfiniWorld