Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
How Townscaper Works: A Story Four Games in the Making (gamedeveloper.com)
158 points by omega3 on June 19, 2022 | hide | past | favorite | 31 comments


Townscaper is an amazing little toy, my kids (and myself) love it. Perfect for distracting them on a car journey. We will pass them an iPad and three minutes later you hear the little “sploosh” sounds of them building something having picked it to play.

There are so many little hidden detail to find (look for “round” grid areas, build a tower in the middle then delete the bottom of it and see what happens)

I have been following Oskar on Twitter [0] for last few years, he is such a good communicator. It’s always a joy when one of his posts turned up with the details of the latest thing he is working on. Even if you aren’t interested in game design he is such a good follow.

You can play a demo of Townscaper in your browser here: https://oskarstalberg.com/Townscaper/

0: https://twitter.com/OskSta


I tried the demo, bought the toy and had an hour of meditative fun. Thanks!


I didn't know about wave collapse functions before stumbling about Townscaper. Still, I found them hard to understand until I found this video by Martin Donald: https://www.youtube.com/watch?v=2SuvO4Gi7uY

Now, I'm just looking for a use-case to implement them myself sometime.


> Now, I'm just looking for a use-case to implement them myself sometime.

I'm using them to try and generate stencils (for artwork purposes.)

Also currently failing to generate PacMan mazes with them but I suspect that's more easily solved with some simple if/then/else trees...


Went down a rabbit hole with that creator's videos. He has a lot of good ones, all done with Blender and Godot.


Townscaper is a wonderful toy! I have a five year old who absolutely loves it. But she is constantly asking me how she can add people to her town. I tell her its a world with no people, and she then says, why am I building a town then?


Yes, it's pointless as a game IMO. Personally, it reminds me of the "interactive screensavers" kind of apps for win95.

I love the aesthetics and don't regret the purchase, but it feels more like a tech demo than a game.


I think thats the reason Oska (the creator) refers to it as a "toy" rather than a "game".


I recommend this talk to learn more about the approach; this part specifically talks about the lack of the typical gaming elements: https://youtu.be/5xrRTOikBBg?t=1170


For anyone interested, I put together a golang version of the WFC algorithm used by townscaper: https://github.com/zfedoran/go-wfc

And a live WASM demo if you’re into that: https://zfedoran.github.io/go-wfc-algorithm/


It's rare to see such a well-written article, which manages to distill complex ideas into something approachable without becoming non-technical.

I've come to expect with articles like this that at a certain point, the author stops fully understanding, and switches to metaphors or analogies that ultimately fail to explain the central concept. While plenty of detail was skipped, the switch to the non-technical never came and I happily read it the whole way through.


I've shared a project featuring wave function collapse here the other day and people got frustrated with me, cause they thought the project was about quantum mechanics.

https://news.ycombinator.com/item?id=31384676


I always see wave function collape used on squares/cubes with constant size. Are other applications possible, for example with triangularization or Voronoi diagrams?


There's nothing stopping you from using it on all sorts of wild-shaped grids. E.g. the townscaper grid isn't a rectangular grid at all. It only happens to use squareish cells. IIRC it's a distorted subdivision of a hexagonal grid.

As soon as your model has nodes and edges you can use wave function collapse on it. Your grid doesn't even need to have every cell be the same shape. Square(ish) cells just happen to be easy to design graphics for.


Apparently procedural generation and constraint solvers are AI now? I thought they were just algorithms. (I love Townscaper, btw, but this article—whew.)


That might be reading too much into it. IIRC, hasn't gaming been referring to any kind of computer opponents as "AI" since at least the '80s? I'd almost call the games industry usage of AI as its own independent (albeit related) jargon at this point; games "AI" may use ML, NN, and other AI techniques but isn't required to.


I always found it weird when SNES-era console games would refer to the built-in opponent as the "computer". Like, it kind of makes sense, but it wasn't aligned to my understanding of what a computer was.

In any case, since around the release of Unreal Tournament in the late nineties, I've always just referred to them as bots— that feels for me like it strikes the right balance in terms of expressing that it's a non-human participant in the game, and one whose behaviours may be varying degrees of intelligent, as far as leveraging pre-scripted actions and potentially cheats.


"Bot" is an interesting adaptive use of Robot. Robot traditionally describing something mechanical with gears and made of steel. Something pretty different that the computer controlled characters in Unreal.


Also, it didn't hurt that UT bots were pretty impressive for the era (1999?) tech.

I.e. generally behaving pretty similar to players, minus the environment-exploitation


AI is a lot of things. It's essentially just the category of algorithms, control theory, and machine learning.

If you are just referring to AI as in ML, even then ML is at its core a series of processes for tuning control systems. Those ML models are just complex versions of traditional systems from control theory with the tuning handled by the training process.

So yes in a sense, procedural generation, constraint solvers, wave collapse, etc can all be seen as AI since they are just different ways of solving the problem of "how do I believably make/do X in a useful or believable way".


AI is literally just algorithms.

Yes, these days it's most commonly used to describe something that we can't quite understand the inner-workings of (huge neutral networks; big data), but A* pathfinding and decision trees are also AI.


It’s called AI until it works, then it’s called an algorithm.


It’s _all_ just algorithms.


But if you call it AI you get more investment


back when maze solving algorithms were unknown, BFS was AI. AI is magic, algorithms are what AI turns into when problems are actually figured out.


In the context of gaming I used to call it: “the computer”

Later I called it: “AI”

Such as “Is the AI still brain dead in Civilization VI?”

In a gaming context I think of it as entirely different from a more computer science definition of AI.


Game development has long used the term for anything that pretends to have intelligent behavior. It's not quite the same as other parts of tech use it.


My Netflix recommendation engine appears to be about as intelligent as those wolfenstein guards from back in the day


When I took an artificial intelligence class in college a long time ago, it covered things like path finding and breadth first search.


In video games, smoke and mirrors is an acceptable solution to any problem :)


Constraints solvers was literally half of my AI university course lol




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: