On 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.
data:text/html,<!doctype html><title>Hi!</title><p>Hello.
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:
data:text/html;charset=utf-8;verbatim,<!doctype html><html style="color-scheme:dark light"><title>HTML sandbox 2.0.6</title><meta name=viewport content=width=device-width,initial-scale=1><body style=margin:0;display:flex;height:100vh onload="OT=(DC=document).title,H=(L=location).hash.slice(1)||'',RX=/(^data:.+?(;verbatim)?,)?([^]*)/,A.value=H.match(RX)[2]?H:decodeURIComponent(H)||A.value;T=W=0;E=RegExp('^'+(D='data:text/html;charset=utf-8,'));F=()=>{if(W!=(V=A.value))W=V,M=V.match(RX),I.src=M[2]?V:(M[1]||D)+encodeURIComponent(M[3]),DC.title=NT=((TM=V.match(/<title\b[^]*?\x3E([^]*?)<\/title\b/m))&&(NT=TM[1])&&(NT=NT.trim())&&(DC.title=NT+' @ '+OT))||OT};F()"><textarea autocapitalize=off style=resize:horizontal;width:50vw autofocus id=A onkeyup=clearTimeout(T);T=setTimeout(F,400) onblur=try{history.pushState({},NT,'\u0023'+(S=I.src.replace(E,'')))}catch(e){L.hash=S}><!doctype html><html lang="en" style="color-scheme: dark light;">%0A<meta name="viewport" content="width=device-width, initial-scale=1">%0A<title>%0A%0A</title>%0A<style>%0A%0A</style>%0A<body>%0A%s%0A<script>%0A%0A</script>%0A</textarea><iframe style=border:0;flex-grow:1;width:0 id=I>
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.
...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!)
I have them credited in the repo as well :P
Or, related: https://www.reddit.com/r/OpenAI/comments/138kbhs/someone_sho...
[1] Running Doom on the Raspberry Pi Pico 2: A Def Con 32 Badge Hack:
https://shop.sb-components.co.uk/blogs/posts/running-doom-on...
The QR code standards seem to be a little ambiguous on the meaning and purpose of the 8 bit encoding. I got the impression they added it to support alternative character encodings. Still, it's a mode that "represents an 8-bit byte value directly".
> The default interpretation for QR Code is ECI 000020 representing the JIS8 and Shift JIS character sets.
> 8.3.4 8-bit Byte Mode
> The 8-bit byte mode handles the 8-bit Latin/Kana character set in accordance with JIS X 0201 (character values 00HEX to FFHEX).
> In this mode data is encoded at a density of 8 bits/character.
> 8.4.4 8-bit Byte Mode
> In this mode, one 8 bit codeword directly represents the JIS8 character value of the input data character as shown in Table 6, i.e. a density of 8 bits/character.
> In ECIs other than the default ECI, it represents an 8-bit byte value directly.
In any case, it is possible to use QR codes to store arbitrary binary data. The qrencode tool can do this natively. Decoder support is more tricky, they tend to assume all QR codes contain text. I had to send patches to zbar to help it decode QR codes with binary data in them because it was passing the data through iconv and mangling the output. I also had to add options to the zbar tools to make them decode exactly one QR code
I just wanted to print out 4096 bit RSA secret keys as QR codes. People started QR encoding video games pretty soon after. It's awesome.
a) the keyboard doesn't work until after I click to fire, and this state resets itself every time I press f5 to restart the game (presumably a browser focus issue)
b) both up/down and w/s work for back and forward, but a and d don't work for left and right, you need to use the left/right arrows.
The combination of the two had me scratching my head for a little while!
"the keyboard doesn't work until after I click to fire, and this state resets itself every time I press f5 to restart the game" yes- this is actually something for starting the game music and some other processes
You might want to explain those controls in the readme :)
I'll try to familiarize myself with it more and add it eventually!
We were wondering if we could encode the STL for a 3d print entirely into a QR code and then put that on the actual printed object - so that any piece you made could be replicated by just scanning the object and printing again.
When looking into it I thought it just was too much data, even looked into multi-colored QR codes. But I didn’t realize you could just make a bigger QR code…
kuberwastaken•1d ago
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-...
x3n0ph3n3•1d ago
croisillon•23h ago
kuberwastaken•23h ago
r1chardnl•1d ago
kuberwastaken•23h ago
dylan604•20h ago
sangeeth96•21h ago
kuberwastaken•21h ago
sangeeth96•20h ago
collingreen•18h ago
kuberwastaken•18h ago
alex_suzuki•18h ago
kuberwastaken•11h ago