I sometimes pick up random projects just because I can, this was one of those times. I made it as a week long project a while back this year but never shared here, so thought to go for it haha.
I created a game inspired by Doom and the backrooms called The Backdooms under 2.4kb in minified html. (for reference, this entire post would be around 1.8kB haha)
I had to use a not popular way of using GZip with Zlib headers (had to write my own script for compressing it, also in the repo) to eventually convert it a size 40 QR code that works right in your browser using Decompressionstream API.
This is of course a very oversimplified description of it, using a lot of the same technologies that DOOM had but combining it with infinite seed based map generation in 2.4kb (QR codes can only store 3kb, which includes changing formats) was pretty hard.
Here are some links about it if you want to nerd out and read more:
TIL DecompressionStream, thanks. I managed to shave some more bytes by trimming the HTML bits, raised a PR in case you're interested.
kuberwastaken · 39m ago
YOU'RE A LEGEND! I just managed to ADD (somewhat of) TOUCHSCREEN SUPPORT, better movement, enemy spawning and damage mechanisms in the space that freed up because of this! Genuinely, thank you, made my month :)
r1chardnl · 3h ago
Your game trailer links to a short called "Fly me to the moon - 19 September 2024". I think this is a mistake?
This is also a valid self-contained HTML document. You have to add `;charset=utf-8`, if you need to go beyond ASCII, and for some browsers watch for URI-encoding of some syntactically significant characters (like `#` and `%`, `?`).
Base64 is indeed good to be "safe" and/or somewhat 'conceal' the payload, but it also makes it larger by 1/3 (every three bytes of input become four characters of the base64 output). So taking the risk some devices would not like raw "ASCII dataURI", the QR of the backrooms QR could shave off 738 bytes.
BTW, this is my "HTML sandbox" for testing stuff in a browsers that I summon daily through keyword bookmark to test simple stuff:
I think it's broken for safari but works on chromium based browsers on mobile too. The QR code basically holds the URI URL itself.
pudquick · 2h ago
I'm saying the primary gateway most iOS users are using for loading a QR code - the camera app - will not present a transition to load your URL in this situation
Whether the resulting HTML game is playable in Safari is a different discussion.
The QR code, as generated, is effectively "not clickable" for most iOS users, unless they are using something other than the most common way to read QR codes on their phone like a 3rd party QR code reading app or similar.
kuberwastaken · 2h ago
That I agree, yes haha
Jerry2 · 2h ago
I'm kinda relieved that it doesn't work on an iPhone. I often scan codes posted around to save the time typing URLs and running arbitrary code by just scanning a QR code freaks me out.
It runs inside a web browser though. This is no different from visiting an arbitrary link and running whatever arbitrary code in the Javascript sandbox of that link and one already knows a q.r. code an take one to an arbitrary link.
kuberwastaken · 3h ago
Hey thanks for checking it out! You'd need something like https://qrscanner.org/ because most phones suck at scanning larger QR codes.
Also, it won't work on your phone, can't put in that compatibility with size restraints, sadly.
ascorbic · 51m ago
fwiw, it works fine with the Pixel's built-in QR code scanner. It recognises it as text, not a URL, but it can copy to clipboard and then pasting in the browser works. Obviously I then die immediately because none of the controls work, but you can't have everything.
kuberwastaken · 31m ago
Hey just wanted to update, crazy timing but I Managed to add kind of some mobile touch support here because of a recent PR to FURTHER optimize it (crazy), so you can actually play it now if you figure out the controls lol
iainmerrick · 2h ago
You mean the game doesn't work on mobile at all?
What kind of device do you use to scan the QR code, then?
kuberwastaken · 36m ago
Hey just wanted to update, I Managed to add kind of some mobile touch support here, so if you get an alternate chromium based browser, you can put in the URI to play on mobile too!
kuberwastaken · 2h ago
Nope it doesn't, you can use any QR code scanner that takes image input!
I would've loved to include smartphone controls but that would take a LOT of extra bandwidth.
lelandbatey · 2h ago
You do not need to scan a QR code via a physical camera in your hand directly; any general purpose computer can run a QR code parsing program which accepts arbitrary images as input. It's so easy to do that there exist web pages which implement said QR code scanning in JS. Thus, the parent poster has recommended that you save the QR code .png file to your disk and then use such a piece of software, such as the website they linked, to extract the data encoded in that QR code.
That is how you can use nearly any general-purpose computer to scan a QR code.
kuberwastaken · 2h ago
Indeed! Thank you for explaining this in a way better way :)
kuberwastaken · 37m ago
Update: Managed to add kind of some mobile touch support (literally insane) because of a PR by @sangeeth96 on the repo
metalman · 13m ago
I am now waiting for news that someone has bio hacked a cockroach or a fruitfly to play doom, if not autonomously then for the full cold shivers, they are now robotisising insects, which could then be accesed through an interface to play doom
on a toothbrush booted from a qr code.
Sci-fi is lagging
EGreg · 1h ago
Reminds me of my submission to Allegro SizeHack 25 years ago, in 2000:
It doesn’t work, but I don’t really care to play I just want to see the screenshots of what you made.
ant6n · 1h ago
Doesnt work on iOS (ipad). A screenshot would be nice.
kuberwastaken · 35m ago
Hey just wanted to update, I Managed to add kind of some mobile touch support here, so if you get an alternate chromium based browser, you can put in the URI to play on mobile too!
I don't want to take away from the achievement because it really is awesome, and should be celebrated.
...but...
It seems like a fundamental design issue to make a QR code game that isn't designed for the platform where QR codes are most used.
kuberwastaken · 29m ago
Hey just wanted to update, I Managed to add kind of some mobile touch support here thanks to an awesome PR to further reduce the size, so if you get a chromium based browser, you can put in the URI to play on mobile too!
kuberwastaken · 1h ago
Totally understandable, I can make a snake game inside it fully compatible with mobile but mobile controls just take up a lot of space due to the sheer nature of them haha.
But the compression algorithm is up, feel free to make what you think is awesome and compatible, I'd love to see if you find out hacky solutions to make that work too :P
Lerc · 51m ago
I might just do something like that. Although I inevitably get caught up in designing some minor tech part.
Last time I attempted something like that I made stack machine texture maker, then embedded it inside a version of TTT that minifies+gzips to under 1500bytes. After a few years of pondering I think there are a few more enhancements to be had.
For reference, This URL has a bunch of textures in it.
Whats that doing? I get some error about some gallery???
kuberwastaken · 2h ago
That is seriously cool, didn't know those could do that haha
kuberwastaken · 3h ago
You'd need something like https://qrscanner.org/ because most phones suck at scanning larger QR codes.
Also, it won't work on your phone, can't put in that compatibility with size restraints, sadly
KeplerBoy · 3h ago
Sure if the parser is broken anything might happen.
Historically there have been exploits for Sony's PSP using modified .tiff images or an exploit for the Nintendo 3DS where a modified .m4a file could be used.
I created a game inspired by Doom and the backrooms called The Backdooms under 2.4kb in minified html. (for reference, this entire post would be around 1.8kB haha) I had to use a not popular way of using GZip with Zlib headers (had to write my own script for compressing it, also in the repo) to eventually convert it a size 40 QR code that works right in your browser using Decompressionstream API.
This is of course a very oversimplified description of it, using a lot of the same technologies that DOOM had but combining it with infinite seed based map generation in 2.4kb (QR codes can only store 3kb, which includes changing formats) was pretty hard.
Here are some links about it if you want to nerd out and read more:
Repository Link (MIT License): https://github.com/Kuberwastaken/backdooms
A Hosted (slightly improved) version of The Backdooms: https://kuberwastaken.github.io/backdooms/
Game Trailer: https://www.youtube.com/shorts/QWPr10cAuGc
My Linkedin post about it: https://www.linkedin.com/feed/update/urn:li:activity:7295667...
(PS: You'd need something like https://qrscanner.org/ or something that can scan bigger QR codes and put the text data onto your browser to play it)
My Blogs documenting the process and development in detail:
https://kuberwastaken.github.io/blog/Projects/How-I-Managed-... https://kuberwastaken.github.io/blog/Projects/How-I-Managed-...
Edit: Add a gif instead, you won't have to rely on YouTube with that.
For example, this self-contained webpage: <html><body>Hi!</body></html>
encoded is: data:text/html;base64,PGh0bWw+PGJvZHk+SGkhPC9ib2R5PjwvaHRtbD4=
If you paste that into a browser, it will render "Hi!". Very short and easy.
But if you encode is as a QR code, it won't work in this situation.
Base64 is indeed good to be "safe" and/or somewhat 'conceal' the payload, but it also makes it larger by 1/3 (every three bytes of input become four characters of the base64 output). So taking the risk some devices would not like raw "ASCII dataURI", the QR of the backrooms QR could shave off 738 bytes.
BTW, this is my "HTML sandbox" for testing stuff in a browsers that I summon daily through keyword bookmark to test simple stuff:
Whether the resulting HTML game is playable in Safari is a different discussion.
The QR code, as generated, is effectively "not clickable" for most iOS users, unless they are using something other than the most common way to read QR codes on their phone like a 3rd party QR code reading app or similar.
No comments yet
Also, it won't work on your phone, can't put in that compatibility with size restraints, sadly.
What kind of device do you use to scan the QR code, then?
That is how you can use nearly any general-purpose computer to scan a QR code.
https://www.oocities.org/trentgamblin/sizehack/entries.html#...
I made a PacMan-like game in under 10KB... it was called HackMan :)
But I am most proud of the storyline that came with it!
But if you want to skip the friction of scanning the QR code, you can directly play a hosted version at: https://kuberwastaken.github.io/backdooms/
...but...
It seems like a fundamental design issue to make a QR code game that isn't designed for the platform where QR codes are most used.
But the compression algorithm is up, feel free to make what you think is awesome and compatible, I'd love to see if you find out hacky solutions to make that work too :P
Last time I attempted something like that I made stack machine texture maker, then embedded it inside a version of TTT that minifies+gzips to under 1500bytes. After a few years of pondering I think there are a few more enhancements to be had.
For reference, This URL has a bunch of textures in it.
https://fingswotidun.com/ttt/#W1s2NCw2NCwxMzExOV0sWzY0LDY0LD...
Year 3678, Show HN: I compiled DOOM for an alien CPU architecture.
Vernor Vinge kind of touches this topic a bit in his Zones of Thought series.
https://www.smbc-comics.com/comic/2011-02-17
On a different context, loading a game in QR code also made me to think, can anyone inject a malware script using QR codes?
Also, it won't work on your phone, can't put in that compatibility with size restraints, sadly
Historically there have been exploits for Sony's PSP using modified .tiff images or an exploit for the Nintendo 3DS where a modified .m4a file could be used.