Liikennematto alpha 3, the wave function collapse preview, out now!


Liikennematto is a tiny town building game for children and grown-ups alike. The gameplay is simple: you only build the roads! Lots, buildings and their residents pop up after. You can play Liikennematto in the browser, and it works great on mobile too.

This time I’ve got you something that has been in the works for a long time!

Wave Function Collapse Preview

I've completely revamped the procedural generation system. Liikennematto procgen is now based on wave function collapse (WFC).

WFC allows game developers and artists to define multiple options for content that fits within certain constraints. In Liikennematto, the content in question is a tile (or a "large tile" that consists of multiple tiles). The constraint is how edges of a tile match with neighboring tiles. Given empty space, one of the options is picked and matched against neighboring tiles, and if the tile fits, it's selected to fill the space. This makes it easier to add variations for content.

The WFC implementation is quite advanced in that it supports large tiles, unique tiles, and backtracking. The simple tile edge matching logic is used to add Liikennematto-specific constraints. For example, large tiles that are lots require a matching lot entry tile next to the driveway.

Some of you might be familiar with Townscaper, which works a little like this, but for 3D objects. Townscaper and Liikennematto use the "driven" variant of WFC, where the player's choices influence the procedural generation (instead of pre-generated maps, for example). With Liikennematto's driven WFC, the area next to roads is filled with lots, trees, and foliage.

Adding WFC to a game several years into its development wasn’t easy. I first created a devtool that generates whole maps with Liikennematto tiles (see the video below) to get a feel of the algorithm. When I could make large tiles and the constraints work, I proceeded to integrate WFC into Liikennematto proper. That part wasn’t straightforward. For example, it’s easy to generate new content but when you remove roads and lots, many things have to be reverted and accounted for.

It’s hard to balance an algorithm that is random in its nature. I have weighted interesting content (lots) over generic content (nature tiles), but sometimes the less interesting content might get picked anyway. Luckily I am now very comfortable with WFC and can think of ways to alleviate that. The balancing is an ongoing process and expect better output in future releases.

Other changes

  • 3 new lots and a variety of different-sized nature tiles that might make an appearance on your new builds!
  • The build area is larger to accommodate new content
  • New animations for generated content
  • Lots and other multi-cell tiles are highlighted to warn against building roads over them
  • Traffic gridlocks are solved by despawning some of the stuck cars
  • Simulation is automatically resumed if you come back to the game tab in your browser
  • Performance improvements

Known issues

  • Lots might not appear often enough due to the randomness of WFC
  • It’s still quite easy to accidentally remove a lot and there’s no undo to fix it

For all reported issues, see:

https://github.com/klemola/liikennematto/issues

What’s next

This release is just a preview of WFC-based Liikennematto. In the next few releases I’ll improve the gameplay experience and provide more content so that WFC can truly shine.

Go ahead, try the preview and tell me how you like it!

Play Liikennematto!

Files

liikennematto-alpha-3-f1.zip Play in browser
2 days ago

Leave a comment

Log in with itch.io to leave a comment.