3 ms·
Unfortunately not possible, as the JSON is quite long. I've even gone the extra mile to calculate the average entropy of my game-state (its just numbers) to see
by CBarkleyU 4y ago
Unfortunately not possible, as the JSON is quite long. I've even gone the extra mile to calculate the average entropy of my game-state (its just numbers) to see how much I could save by compressing it, but to no avail. It would way too long, even compressed.
Thanks for the suggestion though!
- xwdv 4y agoDepending on the game you could precalculate every possible game state and assign each one an ID then load the game off of that.
- packetslave 4y agohow long is "way too long"? URLs (including query parameters) can be up to 4k. Does it have to be JSON? Can you use a binary format like protobuf, BSON, etc.? you're likely to get much better compression.
- CBarkleyU 4y ago> how long is "way too long"? How long would a link that you receive on iMessage/WhatsApp have to be before you would reply with a "?" I'm quite open to testing out different ways to keep all of this frontend only (I would much prefer it tbh). The JSONs contain around 2000 integer data points, which could theoretically be compressed by removing redundant information, but seeing how there is little rhyme or reason to the datapoints, there will be sequences with little redundancies which will blow up the end result. I think?
- srcreigh 4y agoWith base64 you have around 6 bits per character. M$ edge max url length is shortest now at about 2038 characters. If you can drop support for edge, the next highest is Android browser at 8k. 8k characters gives you around 6000 bytes to encode into the URL. Unless your 2000 ints are utterly random and use the full spectrum of 4-8 byte integers, im sure you can find a way to compress them into 6000 bytes.
- x86x87 4y agoi think it's possible. this is an example: https://github.com/topaz/paste https://github.com/topaz/paste in the big brain bucket, you could generate the url and use and url shortener
- CBarkleyU 4y agoMany thanks for the input, but as I've said above, I roughly calculated the entropy of an average state and without some kind of magic there just is not enough wiggle room. I've tried your example and it gave me a URL with ~24,000 characters (down from around 30,000)