I play with Townscaper, my daughter plays with Townscaper, and when it launches on Switch my dad is going to love playing with Townscaper too. But that ‘with’ is doing a lot of heavy lifting here, as Townscaper isn’t a game you play, it’s instead a ‘something’ you play with.
The concept is simple. Place pieces of buildings onto a calm ocean backdrop to create little island towns. Build them big, build them tall, or build them diddy and build them small. Pick colours, make little parks, and marvel at how effortless and tranquil both the process and the results are. It’s really rather special indeed.
And its success has been really rather special too, so much so that we think we’ll be seeing a lot more ‘somethings’ like Townscaper in the future.
Unlike the little towns you make, Townscaper hasn’t just popped out of nowhere perfectly-formed. Instead, looking back at creator Oskar Stålberg’s previous work, you can see a clear line through his projects leading up to this point.
BACKGROUND
Stålberg tells us that Townscaper is “the latest instalment in an ongoing exploration of tile-based procedural generation.” Before this project, he experimented with the method across a number of personal projects as well as a big indie title: Bad North – which he created as a part of studio Plausible Concept. “I tend to oscillate between making climates and small architectural dioramas,” he explains.
But earlier than that, Stålberg was obviously keen on architecture in miniature form.
“I like those kinds of tiny worlds. When I still worked at Ubisoft I saw a photo a colleague had taken of a half-rotten tree stump. And I thought, that would be fun with some houses on.”
Stålberg drew them on using a tablet and an app, which kickstarted a whole series of such images.
He worked on these while on long train rides across Sweden to see relatives. “When I went out in nature, I would take nice little pictures and have a collection. And when I would go on a train, I would scroll through the pictures and choose one to draw on.”
The next stepping-stone was browser-based creative tool Brick Block. It’s an obvious precursor to Townscaper, letting anyone create charming little brick buildings in their browser.
“I knew that Brick Block had been very popular, I don’t have numbers on it, as it’s free and I don’t have any proper tracking. But whenever I would encounter people in the games industry, a lot of people had played with it. So I knew that people liked those kinds of things.”
So the plan then was for Stålberg to make a “more ambitious, bigger, one of those things.” Still, he goes on to admit that: “I didn’t know if it was going to make much money. But I knew that I should learn a bunch of technical things, I had a couple of algorithms, and I wanted to try out some new technical approaches.”
COMING OUT OF THE NORTH
Previous project Bad North was just wrapping up at the time. And while the projects are very different, in fact you could say one was a reaction to the other, there are also some shared concepts, such as procedural tile-based generation.
“I started making these very colourful architectural environments that are quite similar to Townscaper. And I was at a point in my career where I figured: ‘OK, this seems like a cool little thing. And maybe I can turn it into a game. So I’ll quit my day job and go indie’.
“I tried to turn those architectural environments into a game, but I didn’t manage to turn them into something that was much fun. Or at least not that was both fun and simple to make.” We suggest maybe some kind of simple SimCity type title would be the obvious choice.
“I wanted to make a game that I could finish in a year. So that wasn’t really an option,” he replies. “And I also noticed this aesthetic thing, where if your game’s environments are very colourful and detailed, then it’s very hard to put a game on top of it, because then the relevant gameplay elements need to be even more colourful still,” he points out astutely.
“Without the constraint of putting a game on top of it… I can focus entirely on the beautiful environments, and as they don’t need to leave any visual space for anything else. They can be the focus, which was really fun.”
By comparison, Bad North’s environments were purposefully drained of colour, in order to make its battling armies stand out as clearly as possible. “Let’s just make the environment very grey… just think of the environment as a canvas on top of which the game can take place,” Stålberg recalls thinking.
“Bad North made a bunch of money, so I wasn’t in any hurry to make new money. And I was also going to have a kid. So I figured, OK, my next project is going to be a small solo project, so that I don’t have any dependencies, basically, so that I’m very flexible when the kid comes.” And so the idea of something that didn’t have all the layers a game requires was a perfect fit.
THE WEIRD GRID
Townscaper is often lauded for its immediacy, its apparent simplicity. “It’s one of those things where people who don’t know anything about creating video games are like: ‘Oh, this is super simple.’ Because the interaction is super simple. And it seems so obvious: you click and then it appears.”
Of course, that which appears effortless and simple on the surface is often nothing of the sort underneath. And Townscaper’s core technology comes from years of experimentation.
“There are basically a bunch of procedural algorithms that I’ve been thinking a lot about. And Townscaper is like the latest version of that. It’s tile-based procedural generation at its core.”
Even if you click in exactly the same way then, the resulting town will not be exactly the same?
“It will always be slightly different, which I like very much, but one of the key ideas that made me excited is the grid. It’s weird and irregular in a lot of ways. But it’s made out of quads. Which means that when I build content for it, I create square tiles and then I build square puzzle pieces, which then I can skew slightly to fit.
“That was really important because one of the really nice things about tile based processes is that you create these little puzzle pieces, and they’re all standardised, so you can fit them together with each other.
“But of course, the boring thing is that it tends to get too repetitive. So the bigger shapes you get from the organic nature of the grid breaks up the repetition of the tiling.”
It’s this randomly-shaped grid then that gives Townscaper its naturalistic feel. Although there’s a lot more to fitting all those pieces together than that.
PROCEDURAL GENERATION
As with Bad North, the (not so) secret sauce behind Townscaper’s worlds is what’s known as the wavefunction collapse algorithm. Though Stålberg notes that the implementation in Townscaper is quite different from the one in Bad North.
“The algorithm solves an interesting problem that I had been thinking about a lot when I came across it. I give it a bunch of puzzle pieces and then it figures out how to create a coherent environment without any gaps with those pieces, provided that it’s actually possible to do that out of those.”
It’s long been used to create random worlds, based on rules gleaned from an pre-existing example for instance. Effectively the algorithm starts with all possible states and then fills them out one at a time based upon the rules dictated to it.
“Once you get the algorithm, it’s not complicated at all,” says Stålberg. And if you want to know more click here.
“In Brick Block, all the rooftops, had to look the same, because they all needed to fit together with each other because I didn’t have a good way of making sure that everything fits. But in Townscaper, the rooftops can look quite different. I have a couple of types and I could have many more types. There are two different sizes of smooth sloping roofs. And then I have the terraced roofs. And then I have some other minor things, like if you just build a single tower, there’s a slightly pointier roof with like a spiral on top.”
And the algorithm allows the game to match pieces in other pleasing ways too. “There are a bunch more complex configurations where if you build in a certain way you’ll get these staircases, and if you build in another way you’ll get these gardens [and even garden paths]. I needed the wavefunction collapse algorithm to do that.
“And that also gives me some sort of higher order patterns that I didn’t have on Brick Block that also makes it slightly less repetitive when you build larger things.”
MASONRY PAINT
The shift from bricks to plastered coloured buildings is a huge step forward from Brick Block. Stålberg is blasé about the colour palette in the game. “It’s a rainbow palette plus two extra greys and white basically.” But agrees that having colours is key to allow users to express themselves. And it was no simple task to add them.
“The colours were a technical challenge. Because with tile based things, there’s a permutation explosion that happens. The more things it has to support, the more puzzle pieces you need to build to satisfy every possible case the user can build.
“Any puzzle piece can be created in any of the colours, that’s fairly straightforward, the additional permutations arrive when two different colours meet, as opposed to the same colour continuing.
“So I have these special puzzle pieces where if you have a border between two different colours, there’s a kind of gap between them to mark the border… when two different colours meet, the mesh needs to comment on that.”
For instance, two red blocks together has to look like a single house, but a red and a blue block together have a dividing feature, so they look like individual houses.
“One of my core aesthetic ideas is that interesting things happen where different things meet. For example, if you have a wall in a game, and you have a repeating brick texture, that’s not very interesting. Where you want to put the details is where the wall meets the floor. That’s a very classical thing in aesthetics and architecture.
MONT ST STÅLBERG
With smart technology married to a simple interface, it’s understandable how Townscaper has charmed so many. “It’s very much exceeded my expectations,” admits Stålberg. “It has done very, very well. I think it’s sold 380,000 copies now. I thought maybe it was gonna sell like 4,000 or something.”
From a year’s work by one developer that’s quite a return. So is Stålberg done with creating traditional games with goals and difficulty?
“I might want to make another game because there are some concepts I want to explore,” he replies. “When you make this kind of creative tool, there are some constraints. There’s a big difference between making procedural generation that the user can interact with, like in Townscaper, and procedural generation that they can’t interact with. And there are a lot of things I want to explore that you can only do in non-interactive.”
But Townscaper isn’t finished yet. “I’m working on porting right now, I’ve teamed up with Raw Fury, who I’ve worked with on Bad North. So we’re gonna be porting it to Switch and mobile. And there’s probably some more as well.” Stålberg’s picture postcard towns are set to reach a lot more people then, and we’re very intrigued to see what the console market makes of this very special ‘something.’