Skip to content
0:00 / 0:00

#qrcode#x86assembly#snake

Can you fit a whole game into a QR code?

MattKC

523K subscribers • 6 videos on Hallway

YouTube
  • Recommended by 3 people: 2 on Hacker News and 1 on Lobsters.
  • Presented by MattKC
  • Linked in the descriptionmchehab/zbar
  • May be out of date. Uploaded 6 years ago, in an area where tools change fast.

Intermediate. Assumes working knowledge.

8.9M views6 years ago3 recommendations

Systems programmingGame developmentPerformance and optimizationGame programmingRetro games and consoles

MattKC explains how he wrote a tiny x86 assembly Snake game to fit within the storage limits of a single QR code.

In my headcanon, Hannah Montana was a brilliant x86 assembly programmer on the down low. Hey you never know, leading double lives was her specialty right? ▶Try it yourself: mattkc.com/etc/snakeqr/ For those asking, yes I submitted my patch to ZBar and it has now been merged into master: github.com/mchehab/zbar/commit/5bc323849569a629aa0d187074a96… ▶Features the following videos "Boot Sector Games" - The 8-Bit Guy youtu.be/1UzTf0Qo37A "Nintendo's big mistake that made Super Mario 64 super slow" - MattKC youtu.be/9_gdOKSTaxM "Intense Hacking!" - MemeManTV youtu.be/UkoqIlppfhc ▶Features the following 1K demos "Searching for the silver lining" by Seven youtube.com/watch?v=Wvk8riqpEvE "Escape through subspace 1K" by Seven/Fulcrum youtube.com/watch?v=d3GrsKWFKFY ▶SUBSCRIBE: youtube.com/channel/UChrYe70o7NmDioL02PRVWVg?sub_confirmatio… ▶FOLLOW on Twitter: twitter.com/itsmattkc ▶FOLLOW on Instagram: instagram.com/itsmattkc/ ▶MUSIC USED Lamb - setting sun DualTrax - orion crackmusic xyce - sea side blues (xyce.bandcamp.com/) Graff - rain eater Kalachnikov - Mental delivrance zoolrave Pink - sonic sucks! BRD RinjaniSoft Products Universal Ghidorah - GhidaPop CORE - mr spock's cryo-bed Maktone - class cracktro#15 BLiZZARD - Contraduct Design 4-Mat - eternity xyce - jetstream (xyce.bandcamp.com/) falcon/pulse+tdr - spineless

Why it's here

3 people recommend this

What people say. Highly recommended as a fascinating exploration of extreme code optimization, binary encoding, and QR code standards.

redbellon Hacker News • Recommends

On “Embedding an EXE inside a .REG file with automatic execution”

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. link to this video

fath0mon Hacker News • Recommends

On “Flappy Bird in 228 bytes”

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: link to this video Quite an interesting watch.

skuzzymigleton Lobsters • Recommends

Can you fit a whole game into a QR code?

u/divad1196in r/ProgrammingLanguages • Mentions

On “Question: are there languages specifically designed to produce really tiny self-contained binaries?”

…irst. Then, you confuses 2 things: - the software doing the compression isn't what must be small. - what you want is a performant compression algorithm. Especially, the compressed output isn't an executable. You first need an algorithm and code it then. If you DO want to write the smallest executable binary possible, you can look at this video: link to this video Basically: - C is smart enough to make smaller binary (you have compilation flag for it as tradeoff of speed) - you can rely on dynamic libraries - on windows, you can use a compression algorithm your binary (not any algorithm though). Windows knows that he needs to uncompress and run the binary. But it's a different goal than the one in…

matheusmoreiraon Hacker News • Mentions

On “US indictments of piracy group members throw top-tier piracy world into chaos”

Video games in QR codes? That's interesting. Do you have the link to the video? Is it this one? link to 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…

matheusmoreiraon Hacker News • Mentions

On “Ask HN: What's the most stable form of digital storage?”

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: link to this video

askiiarton Hacker News • Mentions

On “Building a self-contained game in C# under 2 kilobytes”

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) link to this video

redbellon Hacker News • Mentions

On “Show HN: I made a Doom-like game fit inside a QR code”

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?( link to this video )

matheusmoreiraon Hacker News • Mentions

On “Show HN: I made a Doom-like game fit inside a QR code”

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 th…

u/GrossInsightfulnessin r/C_Programming • Mentions

On “Should I learn C instead of C++ if 'exe' file sizes are important to me? Scared by the 3MB "Hello World.exe" file size made by C++ :(”

I wouldn't worry about binary size yet, as an extra 3 MB doesn't matter if you're on desktop and doing everything else right. That being said, you might want to try Visual Studio since it's more native to Windows and it has a lot of stuff set up for you. You could also try using the Windows Subsystem for Linux or a Virtual Machine if you want to use g++ in its more natural environment, but your executables won't work outside of Linux environments. Here's a video explaining the Linux ELF (i.e. executable and dll) format, which is similar to how Windows does .exe files. If you want stupidly small binaries, you can also check out MattKC fitting a video game into a QR code.

u/HeyoGuysin r/C_Programming • Mentions

Turning Minesweeper Executable Into QR Code Hi all, a while back i posted about optimizing a c program to fit it under a 3KB limit so it could fit in a qr code, and after some black magic I finally got it to work! I had been following the tutorial this guy made on youtube but for snake, and I had got to the point where I was just about to turn it into a qr code. But when I ran this line on cygwin: `qrencode minesweeper.exe -8 -o qrcode.png` I got a png that looked very simple compared to his, yet mine was bigger???? Heres the two for comparison: the snake game \(left\) and my minesweeper \(right\) Now, I'm no rocket scientist, but for a file that ended up being a kilobyte larger than hi…