# – How is it that the first Mario Bros. game was about 32kb, but a JPEG of the game is over 300kbs in 2023?

20 views
0

I’ve seen the meme/info-graphic that the original file for Mario Bros. was approx. 32kb, but a picture file would be 10x more.

I’ve googled it and looked, but it seems to have some nebulous answers. Could someone please ELI5?

In: 26

Back in the day, memory was extremely expensive. Programmers actually had to conserve memory by utilizing tricks of the trade to fit everything into a small package.

These days, memory is cheap, so programmers are allowed to freely utilize more memory resources (and even to be sloppy, in this old programmer’s opinion) , and not have to conserve as much.

jpg is supposed to be able to represent any type of picture. It’s especially good at compressing photos. Photos have a lot of colors. jpg is capable of representing more than 16 million colors in each dot. (256 levels or Red, Green, and Blue each). jog has a lot of smart ways to compress it, but those methods actually don’t work that well for blocks of solid colors since they were invented to compress photos.

Mario Bros has only a few colors on the screen rather than specifying each dot with enough information to represent 16 million colors, they can give each dot a much smaller number. They also don’t have to store data for a whole screen worth. They say, here is the data for what Mario should look like. Here’s what each koopa should look like and there are three koopas on the screen. Here’s what a coin looks like, there are 8 coins on the screen. Etc.

The original Super Mario Bros game was more of a set of instructions to the computers inside the video game console of how to produce the graphics of the game. These had to be very simple instructions because back then you didn’t have a lot of space to program the game in. Your codes had to be very precise and simple.

A JPEG is likewise a set of instructions to a computer, but it’s a more complicated form of instructions. It’s designed to handle very elaborate images, so even if you take a picture of something very simple looking, the code that describes that image for a JPEG is more complicated and long.

It’s sort of the difference between telling a computer “put red dot in 5,45” and “in the intersection of the fifth row, and the 45th column, place one pixel that is this specific shade of crimson.” Using the second set of instructions, you theoretically can produce a lot more complex artwork. But even if you’re using that to just make a simple image, it’s going to be a lot longer than the sort of programming used in the original Nintendo.

In addition to all the answers here, theres the issue of resolution.. The original Maria was like 12 pixels X 12 pixels (a bit of an exaggeration, but not too much) whereas a modern jpeg is likely done on. 1080 9r 4k display… So each “pixel” of the original Mario is probably being represented by 16 or 64 actual pixels

Code is more efficient than pictures.

To make a sprite dance around a screen, you have to have the sprite, which in the case of Mario Bros is only a few pixels (Mario was literally 12×16 pixels, 142 coloured pixels in total) and a two 8 (or maybe even only 7) bit numbers for coordinates to say where on the screen ot is. If that sprite is only made out of like 16 possible colours, that’s 4 bits per pixel to describe it. Some pixels won’t even have colours, so they don’t need to have anything. So that’s 590 bits to put Mario on a black background (I don’t know if that’s the actual number, but it’s just to compare with the following).

An image has to save ALL of the pixels from the whole image. So if you have a 256×244 image (the game’s resolution), even at the same 16 colours (4 bits per pixel) that’s already 31kb (without compression or anything, of course).

Add some really clever coding tricks, and you have a really small game size.

For comparison, in 2004 .kkrieger won a small size game file competition. It’s an FPS with graphics comparable to the best of its time. It was 96kb. Just three times that of Mario Bros. All because it had no actual art assets, everything was code (some very clever procedural generation stuff).