HN2new | past | comments | ask | show | jobs | submitlogin

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


I believe Oskar is bit packing the data into the string, somewhere in his twitter feed he explains it.

Edit: Found it: https://twitter.com/OskSta/status/1198958801363308544

He designed it so you can fit a saved town in a tweet.

"It's my own very context specific implementation. I know how many bits I need for each bit of data, so I just store it all in a big bit array. I then convert that bit array to my own custom base 64 format, based on 64 web safe characters."

Worth reading the whole thread, as will all of Oskars twitter feed its super interesting.


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.


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.


No need. It's barely any data.




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

Search: