Live data from Hacker News

Townscaper Running in the Browser

oskarstalberg.com

41–50 of 102 posts

Re: Townscaper Running in the Browser

#42
post #28

Earlier quoted context omitted.

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

Couldn't it be as simple as a list of (color, x, y, z) (base64 encoded) in the fragment? URL fragments can get really long. Not sure what you'd need a look up key for.

The lookup key would be if the backend stores all the generated towns, and you're just referencing them. But I think simple encoding as you say is more probable

Re: Townscaper Running in the Browser

#44

What is missing from this demo compared to the full game? I thought that even the full game was this minimalistic.

Full game doesn't crash, doesn't give you the browser scroll function on middle click (the shortcut to pick a color of an existing building), ability to export as STL, no full game links, ability to create oversized screenshots, some settings. The full game isn't deterministically equal to the browser one (roofs slope in different directions sometimes, decorations in different places). It should also run slightly better, although both are pretty lightweight.

Notably, the export strings are the same.

Basically: you're not missing anything from the core experience, but the browser version is slightly inferior. And buying the full version helps Oskar make more neat stuff in the future.

Edit: it's also a smaller build area.

Re: Townscaper Running in the Browser

#46
post #16

It takes about 90 seconds to load for me, but once it does, it's buttery smooth on my M1 Pro. Unity's web story is still so bad for many reasons, but the initial load times are a huge one (~15MB of wasm for an empty scene last I checked). They were working on Project Tiny[0] to address exactly this, but they've now paused work on it indefinitely :( Someone please build tools to fix this! [0] https://unity.com/solutio…

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 sandbox.

Re: Townscaper Running in the Browser

#47
post #42
post #28

Earlier quoted context omitted.

Couldn't it be as simple as a list of (color, x, y, z) (base64 encoded) in the fragment? URL fragments can get really long. Not sure what you'd need a look up key for.

The lookup key would be if the backend stores all the generated towns, and you're just referencing them. But I think simple encoding as you say is more probable

And how exactly would you represent these hypothetical stored towns?

Probably with a simple encoding.

Re: Townscaper Running in the Browser

#48
post #16

It takes about 90 seconds to load for me, but once it does, it's buttery smooth on my M1 Pro. Unity's web story is still so bad for many reasons, but the initial load times are a huge one (~15MB of wasm for an empty scene last I checked). They were working on Project Tiny[0] to address exactly this, but they've now paused work on it indefinitely :( Someone please build tools to fix this! [0] https://unity.com/solutio…

Meanwhile, Godot 4 should be _editable_ in the browser.

Yes, but afaik, the experience of building for the browser as a runtime target for games in Godot is still not much better than Unity, just less bloated. I for one would love it if Godot made web a first-class focus, but it doesn't seem like they are yet.

Re: Townscaper Running in the Browser

#49
post #17

Wow, the entire town is URL encoded!! Example: http://oskarstalberg.com/Townscaper/#IzpjOEQ0ejP2X9w-b--c-X-...

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

Re: Townscaper Running in the Browser

#50
post #16

It takes about 90 seconds to load for me, but once it does, it's buttery smooth on my M1 Pro. Unity's web story is still so bad for many reasons, but the initial load times are a huge one (~15MB of wasm for an empty scene last I checked). They were working on Project Tiny[0] to address exactly this, but they've now paused work on it indefinitely :( Someone please build tools to fix this! [0] https://unity.com/solutio…

PlayCanvas[0] is the probably the closest "web-first" solution compared to Unity. Used by lots of Snap Games & Instant Games. It's written in JS which means that it's way smaller ~350kB for an empty scene if I recall.

[0] https://playcanvas.com

Post reply on HN