Where do all the bytes come from?
medium.com
medium.com
I was expecting more of a realistic explanation about how the NES puts up the frame without a frame buffer. This falls into a mess about graphics compression, which is kind of irrelevant.
"How 'oldschool' graphics worked Part 1 - Commodore and Nintendo" https://www.youtube.com/watch?v=Tfh0ytz8S0k
He also used inconsistent mb/MB, etc. which always gets on my nerves in a technical post but now I am just being an asshole at it is 2am here ;)
The original NES console was only designed to output images that were 256 wide by 240 high; meaning that the final image that needed to be displayed to the screen was 180kb in size.
The NES definitely didn't have 24-bit colour, so the final image data was at most 60kb, assuming 256 colours, or 30kb assuming 16 colours and a palette.
I don't know for sure what colour settings the NES had, I doubt it had a freely selectable 256 colours for each pixel. Probably a limited palette, maybe per-sprite, maybe for the whole screen.
http://www.thealmightyguru.com/Games/Hacking/Wiki/index.php?...
"a total of 64 pre-set colors (56 of which are unique), and you can only show 25 on the screen at one time (under normal circumstances)."
So ya, a little more limited than 24-bit colour.
- 4 palettes for sprites at a time, each containing transparent + 3 colors. So 12 sprite colors.
- 4 more palettes for background (applied to 16x16 areas), each sharing their first color, for another 13 colors in the background.
- Total up to 25 colors on screen simultaneously, selected from a 64 color palette that really had 54 useful colors.
Classmate said he would build a machine that only displays that image, and give it an On/Off switch - a whole image with only 1 Bit!
To give an example: one of the most basic tricks, if you're allowed to use OpenGL and WinAPI, is to use WGL to render your system fonts into 3D shapes[0]. This allows you to get a lot of 3D models from just the few bytes it takes to call wglUseFontOutlines()[1]. You may think that there isn't anything interesting in a basic font, but - even forgetting about Unicode - every Windows has Wingdings...
(Or look into the good old .EMF[2] format, which was basically direct encoding of Windows GDI calls.)
For much more in-depth discussion on where exactly information is stored, be sure to read GEB[3], if you haven't already.
[0] - https://www.youtube.com/watch?v=iri5CgLglkk - 1/10th size of Mario!
[1] - https://msdn.microsoft.com/en-us/library/windows/desktop/dd3...
[2] - https://en.wikipedia.org/wiki/Windows_Metafile
[3] - https://en.wikipedia.org/wiki/G%C3%B6del,_Escher,_Bach
This is also an argument I've heard about growing people new bodies to transfer into (like Old Man's War) or digitizing humans (like the Singularity); apparently, a sample of DNA isn't enough to create a whole new person. You need, at least, a womb.
[0] - http://fermatslibrary.com/s/reflections-on-trusting-trust
LenPEG 2 contains a bug that will cause it to corrupt images.
Let's say I have a custom compression algorithm (as allowed by LenPEG 2), let's call it "SurprisedBabyPEG"; it's steps are:
1. Is the image the "surprised baby gif"? If yes, write an empty file.
2. Otherwise, encode the input as PNG, and write that to the file as output.
LenPEG 2 allows us to choose an encoding algorithm:
> 2. Prompt the user to ask what other algorithm to use (GIF, JPEG, PNG, etc).
Take the surprised baby gif, and feed it as input to LenPEG 2. It's not Lenna, so step 1 fails. We proceed with step 2, and it prompts us for an encoding algorithm; we choose "SurprisedBabyPEG".
> 3. Use the user-suggested algorithm to compress the image and write it.
SurprisedBabyPEG outputs the empty file; this is the same output as if we run Lenna through LenPEG 2; on decompression of our surprised baby, Lenna is incorrectly output.
(This bug is correctable, and also affects LenPEG 3.)
Also,
(grep "`./smr`" < input || cat lenna) | xv -
The linked smr.c does not link.This reminds me how you can communicate any finite sequence of octets across a network connection with only a two bits.
An compression algo that returns "surprised baby gif" if it has a file with first bet set to 1... would match LenPEG 1.
- .kkrieger wasn't 64 kb, it's 96 kb. Still impressive though.
- The image in the tweet is 51.4 kb.
I was expecting some explanation about how the sprites are so tiny because they use a palette of 4 colors (and 4 pixels fit in one single byte), then the colors themselves are stored separately.
Here's a couple blog posts on the subject, which I think explain it better.
At the time Super Mario was popular, storing a still raster image took a lot of hardware. Generating an interactive picture on a TV was easy enough on consumer hardware, but simply recording a picture was not! Today we take the concept for granted, eg digital cameras.
The state of the image (jpeg artifacts), was a dead giveaway that the comparison is worthless.
Worthless to anyone who understand both how the NES and JPEGs work, but pretty worthwhile to someone who's just learning about it.
The super mario rom is a very compact description of the super mario game, in the context of its environment.
The jpeg environment isn't very well designed as an environment to display a single frame from a flat colored video game.