Can you fit a whole game on a stamp?

  Рет қаралды 74,168

Nathan Baggs

Nathan Baggs

8 ай бұрын

Can you fit a game onto a new digital stamp?
💭 All views are my own 💭
For the curious (and brave):
f0VMRgEBAS9kZXYvZmIwAAIAAwABAAAAhYAECDYAAAAAAAAAEAkFADYAIAABAAAAXgFkAGQAAQAAAAAAAAAAgAQIAIAECPMBAADzAQAABwAAAAAQAAAPt3UCifNp2wAFAABmA10AweMCD7dNBIs9FIAECAHf86tGD7dVBmYDVQI51nXWw7kAAHECsgODziJPsMDNgKMUgAQIuweABAiJ0UmSQEDNgInDuQBGAACLFRSABAi4NgAAAM2AjXJUv4AAAACJPrg2AAAAQc2AMcC5gAAAAIs9FIAECPOqQIsdFIAECIgDMdtDiw0UgAQImTH2vyCABAgx7bg0AQAAzYBIdR8x27k2gAQImUKJ0EBAzYAPtwUwgAQIg+hkZqMwgAQIuBAJBQCjJIAECIs9FIAECDHAuQCgDwDzq2ahMIAECEBmozCABAhmPbwCD4STAAAAZqHjgQQISGaj44EECGaj64EECIXAdRBmuOgDZqPjgQQIZqPrgQQIueOBBAgPtwmD+WR/GbsugAQID7dbAoH79AEAAH9OgfvIAAAAfEa9LoAECKEAgAQI6Kr+//+944EECKGFgAQI6Jv+//+964EECOiR/v//agNbiw0UgAQIugCAPgAx9jH/uLUAAADNgOnp/v//vAIAADIAyAC8AlgCMgDIAA==
Article for small ELF executables - www.muppetlabs.com/~breadbox/...

Пікірлер: 184
@robigan
@robigan 7 ай бұрын
I came to this video thinking that you'd stop at C, just like all the other lower level programmers do, was shocked by the level of optimization you pulled off. This video is worthy of being shared
@nathanbaggs
@nathanbaggs 7 ай бұрын
Thanks! I really wanted to get < 500 bytes and assembly was the only way to do that
@grugiv
@grugiv 7 ай бұрын
@@nathanbaggsWell, you certainly hit that goal!
@trentwelch1116
@trentwelch1116 7 ай бұрын
Matkc did with a QR code it pretty cool just like this one
@williamdrum9899
@williamdrum9899 7 ай бұрын
The virgin C vs the Chad Assembly
@Nerdthagoras
@Nerdthagoras 7 ай бұрын
So it is indeed possible for a person to compile better than a compiler haha.@@nathanbaggs
@jitlua
@jitlua 7 ай бұрын
"British MattKC doesn't exist, he can't hurt you." British MattKC:
@The_Grammar_Police
@The_Grammar_Police Ай бұрын
The funny thing is that his video is at the top of my recommended
@michaelnewman6948
@michaelnewman6948 8 ай бұрын
This is a very similar video concept to MattKC when he made a game to fit in a QR code (kzbin.info/www/bejne/e6naooGomtSWpsk) but your individual approaches, limitations, and styles add additional intrigue into both videos.
@somebody3271
@somebody3271 7 ай бұрын
That's the video I was thinking about when I saw this video
@2009MazdaRX8
@2009MazdaRX8 7 ай бұрын
@@somebody3271 same lmao
@RealNotGoldArc
@RealNotGoldArc 7 ай бұрын
​@@somebody3271YO SAME
@HeidenLam
@HeidenLam 7 ай бұрын
chances are he took at least some inspiration from Matt's video, which is nice as he revised the concept refreshingly and enjoyably
@RadikAlice
@RadikAlice 7 ай бұрын
And then there's Dave's Garage, who saw it and thought "Neat, could be more optimized tho" And he did it, well worth a watch as well
@jumanji4037
@jumanji4037 8 ай бұрын
This was a joy to watch, just seeing the size of the executable shrink more and more as you got to assembly was interesting. You're game could essentially fit in a boot sector now. I had no clue that a frame buffer file existed in Linux until now, I might mess around with it thanks to your video.
@nathanbaggs
@nathanbaggs 8 ай бұрын
Thanks! I used an Ubuntu VM and had to run it terminal only (as any GUI/compositor overwrites the file) and had to make sure my user was added to the “video” group
@jumanji4037
@jumanji4037 8 ай бұрын
@@nathanbaggs Thanks for the info!
@sanderbos4243
@sanderbos4243 8 ай бұрын
That cdq is amazing, I love how far you went optimizing it!
@nathanbaggs
@nathanbaggs 8 ай бұрын
I really wanted to get below 500 bytes
@sanderbos4243
@sanderbos4243 8 ай бұрын
@@nathanbaggs Chad mindset
@mikkelens
@mikkelens 8 ай бұрын
everywhere I go I see your face
@sanderbos4243
@sanderbos4243 8 ай бұрын
@@mikkelens One day I'll be coronated as the new Justin Y. of comment sections, Mikkel
@StephenHall-zz2ym
@StephenHall-zz2ym 7 ай бұрын
Would using a TUI be smaller?
@peterlilliegeo
@peterlilliegeo 7 ай бұрын
Man this is gold!! I'm a high-level lang programmer, so seeing you work so smoothly in C and assembly was enlightening! The way you explained it all helped me follow along as well. Thanks for the entertainment and information!
@nathanbaggs
@nathanbaggs 7 ай бұрын
Thanks!
@catrass7515
@catrass7515 8 ай бұрын
MattKC QR code game, hard mode
@GlitchyOfficial
@GlitchyOfficial 7 ай бұрын
mattkc making "can you make a game in a qr code"
@nbee99
@nbee99 7 ай бұрын
literally MattKC Inspiration, but I know how hard it is to make a video so, good! 👍👍
@joaomartins2541
@joaomartins2541 7 ай бұрын
MattKC is inspiration to us all.
@pizzaboxer
@pizzaboxer 7 ай бұрын
british mattkc 💀💀💀
@alicewyan
@alicewyan 5 ай бұрын
This is old school levels of wizardry, impressive!
@wonkywonky6307
@wonkywonky6307 7 ай бұрын
499 bytes?? GODDAMN! Congrats, this is much better than what I expected. Fantastic!
@TeslaPixel
@TeslaPixel 8 ай бұрын
Great video as per. The size minimisation methods at the end were brilliant with some methods I'd not even thought of. There was a really interesting, similar video about pong on a QR code I'd recommend having a watch of also.
@nathanbaggs
@nathanbaggs 8 ай бұрын
It was good fun trying to squeeze the last few bytes out (:
@itsCh4rl1e
@itsCh4rl1e 8 ай бұрын
Dunno if you've seen anything by Ben Eater but he recently(ish) went into some ancient asm code where bit-saving tricks weren't just a fun gimmick but a necessity of programming back in those times that you wouldn't imagine doing today given the immense size of software now. really interesting to see the ideas get re-investigated today.
@nineinchwhales
@nineinchwhales 8 ай бұрын
Your videos are always a treat to watch! Always feel like I'm learning one thing or another and the production quality is amazing :D
@nathanbaggs
@nathanbaggs 8 ай бұрын
Glad you like them!
@sentienttoast1319
@sentienttoast1319 7 ай бұрын
I had predicted from the start that assembly would be required, but i would've been really impressed if the guy did it without assembly, still really nice job
@atalocke
@atalocke 7 ай бұрын
I love these kind of videos. You have a great presentation!
@nathanbaggs
@nathanbaggs 7 ай бұрын
Thanks!
@wyndmill
@wyndmill 8 ай бұрын
Now that's what I call compression! The manual compression at the end was hilarious to watch
@wisteela
@wisteela 6 ай бұрын
This confirms what I was thinking, that it's a data matrix, and now I know the type.
@budgetarms
@budgetarms 7 ай бұрын
TLDR: Yes, you can
@AlphaetusPrime
@AlphaetusPrime 6 ай бұрын
Hey, at least you fit it into a single hard drive sector! That's pretty good!
@robosklegs
@robosklegs 7 ай бұрын
Your scientists were so preoccupied with whether they could, they didn’t stop to think if they should
@user-pw5do6tu7i
@user-pw5do6tu7i 7 ай бұрын
NES devs fear him.
@Sypaka
@Sypaka 2 ай бұрын
"Oh, I collect stamps" - "Cool, what games do you have." - "huh?"
@sky.is.winning
@sky.is.winning 7 ай бұрын
Nice job NATHAN!
@Voltra_
@Voltra_ 7 ай бұрын
After the QR Code game, there's the stamp game
@codedeus
@codedeus 8 ай бұрын
Damn, that's some epic shrinking!
@mrnobody9268
@mrnobody9268 8 ай бұрын
really creative ways, great job
@batatanna
@batatanna 8 ай бұрын
I'm crying over the triple nested goto
@HexMedia2474
@HexMedia2474 7 ай бұрын
you are a madman!❤️
@EvilTim1911
@EvilTim1911 7 ай бұрын
Man, the knowledge on display here is amazing. I work in fairly high level languages so a lot of this was very unfamiliar to me. Great stuff
@2peoples785
@2peoples785 7 ай бұрын
EVI-LL!!!
@jomo_sh
@jomo_sh 7 ай бұрын
I'm curious, have you ever thought about doing low level programming? why do people often work with high level languages?
@EvilTim1911
@EvilTim1911 7 ай бұрын
@@jomo_sh Because they're easier to jump into, I guess. I've just started learning Rust and would like to build some personal projects with it, but I'll still mostly use high level languages professionally because that's what my job calls for (JS, Python and a little bit of C#). When I first started learning I went with Python as it was recommended for the simplicity of its syntax. Having to worry about manual memory management on top of all the other stuff you have to learn as a beginner would probably turn many people off right at the start.
@placeholder4988
@placeholder4988 7 ай бұрын
@@jomo_sh low level is more machine oriented while high level more at the programmer. Afaik on a basic level you trade off performance (memory management) for easier debugging and easier programming
@mattmurphy7030
@mattmurphy7030 7 ай бұрын
@@EvilTim1911you should understand C if you want to call yourself a developer. A basic understanding of how the machine works at that level is mandatory.
@semplar2007
@semplar2007 7 ай бұрын
woow that is a great optimization efforts 👏 well done
@vast634
@vast634 6 ай бұрын
I know the fun of cramming games into a very small filesize. I wrote several Java games (a platformer, a 3D game, voxelgame etc) into a 4 kilobyte file. Lots of tricks and procedural generation for graphics used. 70 bytes is extremely small. But 4 kilobytes lets you actually create a decent looking game.
@Darkknight512
@Darkknight512 7 ай бұрын
Ahhh, the postage stamp class demoscene.
@trentlangford9050
@trentlangford9050 7 ай бұрын
I love this! Glad to see that assembly and low level is alive and well. If you don’t mind me asking, what tools did you use to write the assembly?
@nathanbaggs
@nathanbaggs 7 ай бұрын
I wrote it in VSCode and assembled it with nasm
@unicodefox
@unicodefox 7 ай бұрын
MattKC did a similar thing a few years ago, putting Win32 Snake in a QR code.
@GearsDatapacks
@GearsDatapacks 8 ай бұрын
This is a very good video. I'm impressed you managed to get it down to less than 0.5KB
@mv-kan
@mv-kan 8 ай бұрын
Keep up the good work
@Alanhallow
@Alanhallow 7 ай бұрын
This is amazing
@Iota0zero2
@Iota0zero2 7 ай бұрын
Inspiration from MattKC? But good work 👍🏼
@damouze
@damouze 3 ай бұрын
This brings me back to my university days when one of the admins asked if I could write a small program for him that would wipe the MBR of a harddrive in lab PC. I managed to squeeze it in a whopping 94 bytes, including a double confirmation by the operator. Since technically I had an entire floppy boot sector's worth of space, I filled the rest with credits and kudos to my fellow students. The admin was quite happy with it, and used it for many years.
@Cuperino
@Cuperino 7 ай бұрын
I hadn’t heard of these techniques since I learned about how Atari games were made. It’s cool to see these can be done on Linux!
@hexagonist23
@hexagonist23 7 ай бұрын
writing directly to /dev/fb0 is so cursed yet so simple to do
@nathanbaggs
@nathanbaggs 7 ай бұрын
I was kind of surprised how simple it was (conceptually). I had to run Linux in terminal only as compositors and window managers seem to override the fb0 changes
@TeamUnpro
@TeamUnpro 6 ай бұрын
OMG you're writing to /dev/fb0
@flameofthephoenix8395
@flameofthephoenix8395 7 ай бұрын
The best way to compress games is to create a special compression system that can only handle storing a single combination of bits that just so happens to correspond to your entire game you're needing to compress, how fortunate.
@sdjhgfkshfswdfhskljh3360
@sdjhgfkshfswdfhskljh3360 7 ай бұрын
Looks like you describe MetaGolfScript.
@flameofthephoenix8395
@flameofthephoenix8395 7 ай бұрын
​@@sdjhgfkshfswdfhskljh3360 Yes, I hadn't heard of them before now. So here, I'll fix it. The compression algorithm stores it in two bits and has four possible programs to be compressed, one of them just so happens to be yours and the other three are random arbitrary combinations of assembly code that don't actually do anything except probably break things.
@FeTetra
@FeTetra 7 ай бұрын
the fact that you got so optimized that you used other data in the file to not use extra data for colors is insane
@kyxey
@kyxey 6 ай бұрын
Bruh started hight level and ended up tree shaking the CPU instructions. 💀
@tsalVlog
@tsalVlog 8 ай бұрын
I haven't done assembly-level optimization in ... 30 years? coincidentally it was the last time I ever took a job that included x86 assembly work.
@nathanbaggs
@nathanbaggs 7 ай бұрын
Always a useful skill to have, even if it’s just to debug native code
@tsalVlog
@tsalVlog 7 ай бұрын
@@nathanbaggs oh definitely. I work in Swift now, and it has helped immensely with identifying problems others have struggled with.
@bitwise4996
@bitwise4996 3 ай бұрын
upx compression is literal magic. I wonder if it works on even smaller bins.
@achille0072
@achille0072 8 ай бұрын
This was so good, I really gotta learn assembly. Also, is there anyway I could read the source code?
@arpy8
@arpy8 7 ай бұрын
amazing work
@nathanbaggs
@nathanbaggs 7 ай бұрын
Thanks a lot!
@Madnessnunky
@Madnessnunky 2 ай бұрын
This reminds me of the kinds of tricks employed by NES devs. (And other retro PC/Console devs.) I wish developers had a fraction of this level of optimization today. Instead it's 80GB with a 20GB day 1 patch for an installed 120GB. Like, there wasn't ANY space you could save??? GameHut did a ton of cool videos about compression for things like the FMV in Sonic 3D Blast and other neat tricks in the Genesis days. People were so creative when given limits.
@teamruddy611
@teamruddy611 7 ай бұрын
1:59 OH NO! THE PROGRAM IS GOING TO SUBSCRIBE!!! WHAT SHOULD WE DO!!!
@andrew8293
@andrew8293 7 ай бұрын
Game Developers now: The base game download will be 60GB and 100GB when unconpressed. Game developers then:
@everypizza
@everypizza 7 ай бұрын
Genshin is around 200 GB (I'm not sure, but it won't fit on my 128 GB SSD anymore)
@Patisaloser
@Patisaloser 6 ай бұрын
​@@everypizzait's 300mb
@MAP233224
@MAP233224 7 ай бұрын
Great vid, I kinda would've love to see just one more step: self decompressed/extracting executable, just to see if it could've been tinified a bit more, 500 bytes is already quite impressive! Is the fb0 file the simplest way to write to the screen on Linux? I'd like to write a very simple software renderer with the Debian distro
@nathanbaggs
@nathanbaggs 7 ай бұрын
I looked into decompressing but I couldn't get the extractor+compression any smaller than 500 bytes. It's probably the simplest, but not necessary the most efficient, you also need to run terminal only as any windowing/compositing managers tend to overrule the fb0 file
@hridumdhital
@hridumdhital 7 ай бұрын
"Write this essay using the least amount of words possible"
@Pillow_
@Pillow_ 7 ай бұрын
1:40 as a windows user, *wow*, that's a cool feature
@koftabalady
@koftabalady 8 ай бұрын
I always wonder how you learned assembly or these cool low level stuff... can you tell us your story?
@salman0ansari
@salman0ansari 7 ай бұрын
haha this is amazing
@ariqahmer5188
@ariqahmer5188 7 ай бұрын
Could you put this on a QR code just so I can relax and know that there's an entire game on it 😅
@compechdev
@compechdev 7 ай бұрын
This is what converting nested else-ifs to switch case feels like to AAA game developers.
@naptimusnapolyus1227
@naptimusnapolyus1227 7 ай бұрын
an Insane Optimization level that is 🗿
@john.dough.
@john.dough. 7 ай бұрын
I wanted to see it printed on actual stamps...
@unrue1048
@unrue1048 6 ай бұрын
I wonder what happens to the post office it when you print out a qr code that says ;DROP ALL TABLES; --
@a.r.9496
@a.r.9496 7 ай бұрын
I am actually sure you could‘ve pulled it off with a different game. Would have been cool seeing you print out the qr code and puttin it ontop of a stamp
@caittastic
@caittastic 8 ай бұрын
where are you getting the specifications of the new stamp barcodes?
@orange-vlcybpd2
@orange-vlcybpd2 7 ай бұрын
Now i understand why modern triple A games run with barely 60 fps on 5k $ gaming setups..
@TheeBuddylee
@TheeBuddylee 6 ай бұрын
You got me, I went to Subscribe
@KozelPraiseGOELRO
@KozelPraiseGOELRO 7 ай бұрын
Fool, you still could optimize it to a quater. With magic.
@iyoe
@iyoe 3 ай бұрын
Nice
@MarkPentler
@MarkPentler 7 ай бұрын
I had a piece of Arduino code once that used only one variable, and I ended up using a spare register to store the value instead, meaning no variable memory was used at all. Tidy.
@RyanLynch1
@RyanLynch1 7 ай бұрын
very impressive. do you have a background in binary analysis?
@randomuseryt5143
@randomuseryt5143 7 ай бұрын
"mov al,0x5" is 2 bytes (b0 05), saves 3 bytes but doesnt zero the upper 3 bytes of eax
@ejonesss
@ejonesss 5 ай бұрын
1. 70 bytes is enough for basic malware so it could be possible to put malware into the postal system. of course i am sure that may be very illegal and the penalties for crimes against the postal system is so high that maybe no one has ever tried anything
@luna010
@luna010 7 ай бұрын
great video. I feel inspired to have my try at making a similar game, but making a uefi(PE) executable instead of a linux(ELF) executable. I’ll leave it in a reply if I succeed. I’m curious how the different environments may differ in terms of code size.
@nathanbaggs
@nathanbaggs 7 ай бұрын
Good luck!
@joaopetersonscheffer
@joaopetersonscheffer 7 ай бұрын
maybe try a simple run length encoding to try and fit it on 2 stamps? 2 physical stamps? maybe the royal mail might even make a special set of stamps, find 2 and play a game hahaha
@nathanbaggs
@nathanbaggs 7 ай бұрын
I tried a run length encoding but the decompressing code plus the compressed payload were still bigger than 500 bytes
@joaopetersonscheffer
@joaopetersonscheffer 7 ай бұрын
@@nathanbaggs oh, that's a shame, still, very impressive
@frankbose544
@frankbose544 4 ай бұрын
one day i wanna be as good as you at c lol
@Budch
@Budch 7 ай бұрын
Sure thing, you can fit the whole technodemo on it, people have been doing that since the 60s!
@skyr3x
@skyr3x 7 ай бұрын
i have never seen someone rewrite their entire code in assembly and embedding their variables in elf headers where the exact data is arbitrary. this is so sick
@Arnau478
@Arnau478 7 ай бұрын
I'm thinking it may be possible to avoid having the "/dev/fb0" string at all if you could somehow access the major number of the device and then look for a file with that inode in the devfs
@jaques3
@jaques3 4 ай бұрын
how do these sizes compare to really old games like from the zx spectrum or something like that?
@televisedfeedback6660
@televisedfeedback6660 7 ай бұрын
It'd be neat to see what game you could fit into the largest qr code (2,973 bytes). Enough room to fit almost 6 of this project. Some guy made snake in that. Perhaps an ascii form of pacman might fit? Or a bare bones Tetris? It'll be cool to see if people take up the challenge for the best and most polished game they can fit in a qr code. Though not to the extent of kkrieger (Fitting a whole 3d game into 97kb through utter madness and trickery.) That team was crazy. Now I wonder what they could've fit in 2.9 Kb. XD
@lel7531
@lel7531 7 ай бұрын
So no stamp game ? That's too bad
@tomtravis858
@tomtravis858 7 ай бұрын
Putting the string in the headers was genius, awesome video!
@keiyakins
@keiyakins 6 ай бұрын
Honestly, 90 characters is a tough ask in a scripting language. I'd like to see if you can cram a python implementation into that size!
@Toby-ve6gp
@Toby-ve6gp 7 ай бұрын
that isn't a bar code
@unknown-yo2tx
@unknown-yo2tx 7 ай бұрын
could use a game engine that allows for code golfing
@szabolcsmate5254
@szabolcsmate5254 7 ай бұрын
I was fully expecting you to make a guess the number type CLI game. But then, what's the smalled CLI game that one could write? You are allowed to include a imaginary printed manual to get away with a very non-user-friendly implementation. Like guess the number with a ? prompt, and ^/v/= as feedback maybe?
@AlphiumProductions
@AlphiumProductions 7 ай бұрын
So optimizied you could run it on an Abacus
@nathanbaggs
@nathanbaggs 7 ай бұрын
Maybe next video…
@yash1152
@yash1152 7 ай бұрын
0:40 is this a repost? one channel already did this thing years ago!
@Gamer_55-55
@Gamer_55-55 7 ай бұрын
sounds like what matt kc did
@letronix6243
@letronix6243 7 ай бұрын
You watched mattkc but thought: "I can do smaller".
@Patisaloser
@Patisaloser 6 ай бұрын
While also stealing his script and giving zero credit👏
@StealthyDrake12
@StealthyDrake12 7 ай бұрын
Pong??
@InfiniteCoder01
@InfiniteCoder01 7 ай бұрын
Why you didn't put source assembly in the description?
@isheamongus811
@isheamongus811 7 ай бұрын
Consider more native. Like boot sector. Ignoring Windows etc
@TF2Shows
@TF2Shows 7 ай бұрын
What about compression?
@nathanbaggs
@nathanbaggs 7 ай бұрын
I tried but couldn’t get the decompression code and the compressed payload close to 500 bytes
@VarunGupta3009
@VarunGupta3009 7 ай бұрын
I thought you're the same guy that did it with a QR code, but glad that you were more realistic and also optimised it extremely well.
@-stoner
@-stoner 7 ай бұрын
No but you could
@YHK_YT
@YHK_YT 7 ай бұрын
1:05 please lower the sound effects it genuinely hurts
@m4rt_
@m4rt_ 6 ай бұрын
MattKC :)
You Can Only Play This Game By Hacking It
12:03
Nathan Baggs
Рет қаралды 332 М.
EA Won't Let Me Play This Game - So I Hacked It
8:49
Nathan Baggs
Рет қаралды 286 М.
NO NO NO YES! (50 MLN SUBSCRIBERS CHALLENGE!) #shorts
00:26
PANDA BOI
Рет қаралды 68 МЛН
Useful Gadget for Smart Parents 🌟
00:29
Meow-some! Reacts
Рет қаралды 10 МЛН
Is this safe? Creating a custom profiler
5:17
Nathan Baggs
Рет қаралды 10 М.
I made the same game in Assembly, C and C++
4:20
Nathan Baggs
Рет қаралды 629 М.
glsl-livecoder
2:43
pg1twitter
Рет қаралды 41 М.
Unfixable Apple Exploit - How It Really Works
28:43
Nathan Baggs
Рет қаралды 14 М.
How Do Wall Hacks Actually Work?
12:38
Nathan Baggs
Рет қаралды 28 М.
How To Enumerate Processes On Windows
28:15
Nathan Baggs
Рет қаралды 4,7 М.
The Unreasonable Effectiveness Of Plain Text
14:37
No Boilerplate
Рет қаралды 568 М.
I Made a 32-bit Computer Inside Terraria
15:26
From Scratch
Рет қаралды 3,2 МЛН
Can you fit a whole game into a QR code?
20:03
MattKC
Рет қаралды 8 МЛН
Reverse Engineering RollerCoaster Tycoon | How does it work?
38:54
Nathan Baggs
Рет қаралды 222 М.