Live data from Hacker News

Townscaper Running in the Browser

oskarstalberg.com

91–100 of 102 posts

Re: Townscaper Running in the Browser

#91
post #65
post #56

Earlier quoted context omitted.

Hmm, how? All I see is stilts (in the browser version, at least, which I imagine should be the same as the Steam version).

https://oskarstalberg.com/Townscaper/#MzJODmOgd6TMNh6DKtk6nH...

Huh. Adding one sea level block to the outside of that doughnut leads to all the propellers disappearing but no stilts. Resulting structure does not look very likely. :)

Re: Townscaper Running in the Browser

#92
post #90
post #83

This uses the "wave function collapse" algorithm. Oskar Stalberg also made a great demo of how it works[0], but it might not make sense just from that. Martin Donald made a really nice youtube video on how it works[1]. The name "wave function collapse" can be off putting but it's pretty straightforward, and an algorithm that can come in handy for many uses both in game development and just general software developmen…

What's the difference between "wave function collapse" and constraint propagation? As described in the youtube link, it looks like it's the same.

I didn't know that constraint propagation existed. Having a quick look it does look the same.

In the in the original WFC(wave function collapse)[0] versions it always used an example of a completed output and generated all valid tile combinations from that. For a game this means that the developer can use hand made maps as examples for it to create new plausible maps. In the common vernacular WFC doesn't use this step and just directly either generates what combinations work or the devs manually decide what tiles can be next to others. Perhaps only the combination of both steps should be considered WFC.

Just to guess I think this is probably a case of it being developed independently in different fields. It's good to have another name for it as I always hated it being called "wave function collapse" when that is a physics thing.

[0]https://github.com/mxgmn/WaveFunctionCollapse

Re: Townscaper Running in the Browser

#93
Works great on my Android phone in Chrome. Oddly there's a message on startup saying WebGL won't work on mobile.

EDIT ah, it's unity's fault apparently. According to caniuse WebGL is golden for all mobile browsers. They should get with the times ;)

One thing that the demo could improve on in the mobile department is that scrolling is too sensitive. Most attempts at tapping to modify the structure result in a totally random change of the camera.

Re: Townscaper Running in the Browser

#94
post #92
post #90

Earlier quoted context omitted.

What's the difference between "wave function collapse" and constraint propagation? As described in the youtube link, it looks like it's the same.

I didn't know that constraint propagation existed. Having a quick look it does look the same. In the in the original WFC(wave function collapse)[0] versions it always used an example of a completed output and generated all valid tile combinations from that. For a game this means that the developer can use hand made maps as examples for it to create new plausible maps. In the common vernacular WFC doesn't use this ste…

The readme there refers to WFC as "constraint propagation with a saved stationary distribution" which makes sense; the goal is to have distributions of tiles similar to the sample image.

Re: Townscaper Running in the Browser

#95
post #46

Earlier quoted context omitted.

Its interesting in that perhaps if Unity gets it right it could fill the functional use case void that has been present ever since the demise of Adobe Flash - rich interactive user experiences within the browser. And done natively with no need for the plugin mess and security holes of Flash. The key would be navigating the feature creep that led to the bulk and security holes of Flash.

Totally agree. Unity is definitely in the best position to become the new Flash, but so far, they seem completely uninterested in investing in that future. I can't totally blame them, because the vast majority of their revenue comes from mobile and their services business. Unity already has the bulk, but the security holes shouldn't be as big of an issue given that it's "just a website" and runs in the browser sandbo…

> I can't totally blame them, because the vast majority of their revenue comes from mobile and their services business

Seems like they could make a whole new market though. It's more likely that browser support is being held back from Safari/Chrome to keep money flowing to app stores

Re: Townscaper Running in the Browser

#96
post #55

This is incredible. How the heck does the algorithm work so well? It manages to produce beautiful looking things no matter what I do

The consistently beautiful looks comes from Oskar having handcrafted more than a hundred different puzzle piece models that together cover all the possible geometries. The models are not modified by the WFC algorithm, the algorithm just picks the right piece for every position. (However, the pieces, which are created square, are linearly deformed (skewed and scaled) to fit in the mostly non-square grid cells).

Re: Townscaper Running in the Browser

#98

Earlier quoted context omitted.

How do you imagine this is done? Hashing the town state and storing lookup key as URL params?

You have a fixed 3D grid, which appears to only need to store either a color or 'null' in every spot. You can encode this entire grid in any number of ways such that it creates a valid URL. Base64 most likely. https://en.wikipedia.org/wiki/Base64

The URL is full of dashes and underscores, clearly not standard Base64.

Re: Townscaper Running in the Browser

#100
post #65
post #56

Earlier quoted context omitted.

Hmm, how? All I see is stilts (in the browser version, at least, which I imagine should be the same as the Steam version).

https://oskarstalberg.com/Townscaper/#MzJODmOgd6TMNh6DKtk6nH...

you can even stack them! https://oskarstalberg.com/Townscaper/#MzJODmugKVfngggBBBC_TM...
Post reply on HN