Show HN: I made a Doom-like game fit inside a QR code (github.com)
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-...
144 comments
[ 4.5 ms ] story [ 194 ms ] threadOn a different context, loading a game in QR code also made me to think, can anyone inject a malware script using QR codes?
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.
Also, it won't work on your phone, can't put in that compatibility with size restraints, sadly
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.
I'm sure the number of people who've ever scanned a QR code on a desktop computer is more than zero, but not much more.
The reason for doing this project isn't practicality, it's because I can
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.
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.
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:
Duck browser doesn't allow it to be saved as a bookmark, but Safari is fine with it.
Anyway, I have put some remarks and docs for that thing into https://gist.github.com/myfonj/c8ce74bf549e19600026ce9022388... , if you are interested.
By the way, this "Backrooms" can also work from non-base64 URI and as such is significantly smaller (https://github.com/Kuberwastaken/backdooms/pull/3#issuecomme...)
Thanks for sharing :)
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/
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
https://www.righto.com/search/label/reverse-engineering
...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...
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!
Edit: Add a gif instead, you won't have to rely on YouTube with that.
Also pushed a commit to hopefully fix the blank screen issue for phones!
Yet... that game will now make me think twice before scanning any QR ^^
And yup! It's pretty insane how much you can do with QR codes, wrote about it here if you're interested in reading more :P https://kuberwastaken.github.io/blog/Technology/QR-Codes-and...
Very impressive compression trick, as a proof of concept, it is worthy of praise, congrats.
I imagine this approach could be used for much more practical uses.
PoCs like this are neat and definitely shows some skillz by the author, but now I'm hoping security types take a look at this to see how vulnerable this could be from asshats.
(PS I updated the hosted version again and it's much better for mobile controls, try it out if you get the time!)
https://en.wikipedia.org/wiki/.kkrieger
I have them credited in the repo as well :P