Can you fit a whole game into a QR code?
MattKC2 HN recommenders · recommended in 2 months, 2020–2025
demo · intermediate · evergreen · 2020–2025 on HN
MattKC fits a playable Snake game into a QR code by writing tiny x86 machine code and patching the ZBar scanner so it can run the decoded data.
HN admires it as a creative hack and cites it as the inspiration for later tiny-game and QR-code projects.
Up next
10 mo on HNAlphaGo - The Movie | Full award-winning documentary
Google DeepMind
10 HN recommender · 2020–2025
4 mo on HNiPhone 1 - Steve Jobs MacWorld keynote in 2007 - Full Presentation, 80 mins
Protectstar Inc.
4 HN recommender · 2020–2025
10 mo on HNelevated by Rgba & TBC | 4k intro (FullHD 1080p demoscene demo)
Demoscene High-Quality Videos (Annikras)
7 HN recommender · 2013–2025
10 mo on HNThe Ultimate Game Boy Talk (33c3)
media.ccc.de
10 HN recommender · 2017–2026
9 mo on HNA Mind Is Born (256 bytes)
lftkryo
8 HN recommender · 2017–2025
10 mo on HNCppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”
CppCon
13 HN recommender · 2016–2024
7 mo on HNCompiling C to printable x86, to make an executable research paper
suckerpinch
8 HN recommender · 2018–2023
8 mo on HNTrackers: The Sound of 16-Bit
Ahoy
7 HN recommender · 2021–2026
7 mo on HNI painted a Landscape with Mathematics
Inigo Quilez
7 HN recommender · 2022–2025
7 mo on HNElevated by RGBA and TBC
BUTTONTANG
7 HN recommender · 2009–2025
6 mo on HNApollo Guidance Computer Part 1: Restoring the computer that put man on the Moon
CuriousMarc
8 HN recommender · 2019–2024
6 mo on HNHow we fit an NES game into 40 Kilobytes
Morphcat Games
6 HN recommender · 2019–2026
7 comments from Hacker News
I admire this type of content where the creator take some concepts we [all] use and understand then combine them in a specific, but a new way, add some tweaks to get some never-seen results. Here is another experience that, as a Windows developer, blows my mind for a while. ▶ this video
Using all the browser functionality feels like cheating. There is a good YouTube video, where a person made a snake game that fits inside a QR Code (albeit a larger version that we're used to, which can hold up to 2953 bytes). You can check it out here: ▶ this video Quite an interesting watch.
Really cool project! TIL about 'data:' URLs—while I was familiar with the 'data:' URI scheme and had used it before, I didn’t realize it could be used as a full URL. Funny enough, I had been thinking about building something similar that fits entirely within a QR code, but I held off because I mistakenly thought it would require an HTTP(s) link. I was heavily inspired by this work: Can you fit a whole game into a QR code?( ▶ this video )
QR codes have various encoding modes: numeric, alphanumeric, 8 bit and kanji. The most common is alphanumeric encoding and the densest is 8 bit encoding which just stores binary data. 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
In a similar vein, there's Can you fit a whole game into a QR code? by MattKC, which is limited to about 3 kilobytes (2,953 bytes) ▶ this video
Paper. It's proven technology: written records last hundreds of years. You can easily encode arbitrary data as 8 bit mode QR codes and print them out. This gives you machine readability and error correction. Data density is not that good but it's very effective, especially for small amounts of data. I wrote some binary decoding patches for ZBar for this exact use case. You can, for example, store video games in a QR code: ▶ this video
Video games in QR codes? That's interesting. Do you have the link to the video? Is it this one? ▶ this video link If so, then the patch he submitted builds upon my work! He fixed a line feed conversion bug that was present in Windows. I use Linux so I did not experience this issue. I remember seeing that patch get merged but I didn't know about the whole video game context. This is amazing. I wrote the patch because I was trying to print a 4096 bit RSA secret key as a QR code. Awesome to see it getting used for something even more awesome. Here are the links to my contributions and related pages: link link link link link link link ZBar used to automatically convert binary data to text when decoding 8 bit QR codes, mangling the data in the process. My patch adds the option to disable that, enabling the data to be extracted without corruption. I also added the one shot feature to the ZBar tools to make it easier to use in automated scripts that expect exactly one output: link Looks like we have a real world application for tiny ELFs now! link