RGME Explains the Super Mario 2 Level Format

This one, I won’t lie to you, is pretty dry. It’s an hour and a half of the Retro Game Mechanics Explained narrator describing, in precise detail, how Super Mario Bros. 2 builds each of its rooms from a couple hundred-or-so bytes in the game’s ROM. It’s an hour and 39 minutes, actually:

Even I began to drift off a few times through this one. It is exhaustive, and exhausting, but it’s very thorough.

I won’t even try to explicate it all in text, but here’s a few interesting tidbits of information:

  • Super Mario Bros., the original, built its levels on the fly. As you scrolled forward, the engine read the upcoming data and constructed it up ahead, off screen, in real time, always keeping ahead of the screen’s edge. This is why you can’t scroll backwards, the list is designed to be read going left to right. SMB2 instead includes extra RAM in the cartridge and uses it as a memory buffer to hold the entire current room, up to 10 screens in size. When you enter an area, the game takes a moment to construct the map in that buffer, and copies it to the PPU’s video RAM as you scroll around.
  • Instead of with stored as-is tilemaps, SMB2’s, as well as basically all of Nintendo’s scrolling games at the time, are constructed, made out of tile objects with different locations and parameters attached to them. This saves a substantial amount of ROM space, and functions as a kind of bespoke data compression.
  • The rooms are built screen by screen, although it’s possible for some items to extend horizontally or vertically outside of its home screen.
  • The format makes it seem like vertical rooms were designed first, and horizontal scrolling areas were then added to that functionality.
  • There are weird special cases everywhere in the building code! Some objects only work on certain levels, or serve different purposes in different worlds.
  • Birdo’s color, and behavior, depends on its initial spawning X tile position. If it’s 10 she’ll be a pink Birdo; if it’s 11 she’ll be red, and all other values mean a grey Birdo will be generated.
  • On the enemy list, entity numbers 92-127 are the same as the entities numbered 64 less than them, but with the property that, when they are despawned, the level ends! This property is used for world-ending bosses, but any entity in that range will end the level when it leaves play, even Mushrooms if one such existed.
  • Crawgrip, the boss to World 5, was added to Super Mario Bros. 2 during its conversion from Doki Doki Panic. The decorative rock background objects in its boss arena are especially hacky, like they were hastily added.
  • The stars in the sky in the night levels have a bug in their generation that prevents any from appearing on the first screen of their areas. They also aren’t placed specifically, but using a pseudo-random generation algorithm that always uses the same seed, so they’ll always appear in the same places in the sky.

Loadstar Progress

I imagine some people look at this blog and think something like, “what the hell is its audience?” People who follow indie gaming, retro stuff, classic computer software, weird gaming videos? Should anyone be interested in all of that?

I answer, YES. It’s all important. I vouch for all of it. I want to cast a light into all of the corridors of video, computer, even electronic gaming! I regret that I only have the time and energy for one post a day! Everyone should know of these things!

One of those things is old computer magazines, and the example of those that I have the most contact with is Loadstar, the Commodore 64 disk magazine that lasted for 22 years and 250 issues.

I mentioned Loadstar lately, and the itch.io page I’ve put up distributing, with the permission of its owners, their archives 243 issues of its archives, plus many extras.

A lot of my time the past few weeks has been spend on the “Loadstar Project.” I’m working on an expanded edition of Loadstar Compleat, to make it much more accessible to people who don’t play around with computer emulators as a matter of course. Yes, I understand they exist!

I envision a custom-written program, offering lists of highlights from among the long halls of its archives. What are you interested in? Arcade-style games? Puzzles? Animations? Music? Art? Reviews of old software? Editorials from a bygone age? Dedicated lists of all of these things. You’ll be able to scroll through and pick something to try. One click brings up its instructions. Another starts it up immediately in VICE. Have a favorite author? Many of Loadstar’s most prominent creators will (if I have my way) have their own lists. With literally hundreds of items in each category, that will keep you going for a good long while.

There’s many technical barriers to making this work, but they are coming down, slowly, one after another. Here is what the menu looks like at this second:

There’s a long way to go. I have to reverse engineer the compression used for text files in later issues, for one thing. I have to finish entering the data for early issues before their Presenter system settled into a single file format. There’s tons of issues left to add to the system, preferably using automatic tools because there’s literally thousands of items here. And yes, the menu system looks really plain right now, and could stand some sprucing up.

I continue to push at the boulder. Sadly the world contains many distractions, and I have other things I need to do with my time. You’re reading one of them right now. But maybe it’ll all come together. Let’s keep our many varied appendages crossed.

I also want to shout out to the Reverend Dave Moorman, Loadstar’s last editor, who oversaw the magazine from issue #200 to #249. He graciously gave me permission to include his range of issues in the compilation, and they’ll be joining their siblings soon! He also has a book on Amazon: The Most Marvelous Machine: A History and Explanation of Computers in General and the Commodore 64 in Particular. If you bought a copy there, there’s no referral code on that link, I won’t see a cent of it, but I’m sure he’d appreciate it! Think it over?

Triggering “Data Over Flow” in Mario Paint

A while back I linked to a video showing the obscure “Data Over Flow” error in Mario Paint. Here’s the post, and here’s the video (1 minute):

It occurs because Mario Paint’s SRAM is only 32K in size, which isn’t large enough to store every possible creation. The cartridge uses data compression to squeeze everything in, but the thing about data compression is, it can never be guaranteed to work. Every possible compression format has data that will cause it to take up more space. It’s a fact about the universe we live in. It just is.

If you only use the canvas, or only use the “Animation Land” motion option, then there is enough RAM, but using both in one composition means the software relies on compression to make everything fit, meaning, some kinds of data won’t fit, and that’s when Data Over Flow happens.

But as it turns out, while if you’re using Mario Paint in the way most people it’s unlikely you’ll trigger the error, it isn’t actually difficult to cause it. Creating a random mess of all the colors of pixels in a stamp, then filling the whole canvas and all the animation frames with that stamp, seems to be enough to do it. Mario Party doesn’t use a particular complex compression format. Maybe if it used something lossy like JPEG it might be able to do it, but rather it uses bit-perfect compression. That kind likes repeating patterns and areas of solid color, and doesn’t like what I’m going to call rainbow snow.

So here, watch a user start from a blank project, on real SNES hardware recorded through video capture, and go directly to the Data Over Flow error. Sorry! Our RAM is too sick to contain your masterpiece, it has vomited it all up, please try again (3 minutes):

Mr Wint’s Investigation Into The Games: Winter Edition’s Copy Protection

This is a deep one. As linked by one for the books over on Metafilter, a GitHub user with the username MrWint was looking at the code of the Olympics-like DOS minigame collection “The Games: Winter Edition.” They wondered why it seemed to be impossible to achieve better than a certain score in some of the events. It turns out to be because of failed copy protection checks in most of the versions of the game produced after the initial release. Most of the cracks of that game that can be found on the internet are affected. They even affect two later official physical releases, and GOG’s release, which is a terrible problem for people who bought any of those versions expecting a working game.

If you’ve played it and never been able to score higher than 86.7 meters in the Ski Jump, it’s not you, it’s the game practically gaslighting you into thinking you failed. It’s impossible to land the jump if you’re affected by the bug and have gone that far!

Here’s their description of the result of the checks, and here’s their lengthy writeup of the problem, what causes it, what it does, which versions don’t fail the check, and a fix for it. Both pages have animations of the bug in action. Here’s their patcher.

Here’s a tl;dr summary, although the most interesting part of it all is the reverse engineering and description of the problem. But in case you aren’t interested in that and just want the gist:

The original release came with a code wheel copy protection system, and performed a number of checks for the event that the protection was bypassed. A value was created as the result of the check, and was modified and stored in various other places. Each of the events itself checked one of those places against a second, obfuscated copy of the code wheel’s lookup table. If the original wheel check is bypassed, which happens for most of the versions of The Games: Winter Edition now, illegal or legal, those places won’t have the correct value, and the game will sabotage those events during play in different ways.

It’s really sneaky, and as it turns out, it also affects the GOG release of its sequel, The Games: Summer Edition in a similar manner, although cracks of that game managed to fix the sabotaged events.

Poking Technology Tries To Play Samples On A Commodore PET

The Commodore Amiga has quite nice digital sound output. The Commodore 64 has the SID chip, well-regarded in 8-bit computing circles. The Commodore PET, on the other hand….

I’ve seen people call the PET the first home computer. This is false. There were computers before it, but they were sold in the form of kits. One of them, the KIM-1, was sold by MOS Technology before they were bought by Commodore. The PET was released the following year as an all-in-one unit, even with an integrated monitor.

Some PETs had a basic speaker included. The speaker had to be driven directly. With the later SID, you wrote data into registers and the chip’s circuitry handled the sound generation over time, freeing up the process for other things. On the PET, the processor has to push bits into the register itself, or else use a shift register set up to do the bit pushing. That means, if you get the data in fast enough, that you actually have a fair bit of flexibility over what the speaker does, but it also means you spend a lot of CPU cycles in doing in.

The Youtube channel Poking Technology recently tried playing digitized sound through the PET’s poor little speaker and documented their work in a fairly long 58 minute video. This is it:

58 minutes is a bit of a time imposition. And there is some hardcore hackery going on, with them writing assembly code on camera and testing it over and over in an emulator until it works, as well as both harsh hiss and very high-pitched beeping. To avoid those fine examples of audio torture, you can jump here to hear the final result, at around the 56 minute mark. By the way, the sound being played is the Windows 95 start up noise, the one composed by Brian Eno.

CBS 8 San Diego’s Visit to Atari in 1982

I’ve been working a lot on compiling lists of programs that appeared in Loadstar, and it’s taking a lot of time. So here’s a quick item for today: a visit by the news team of CBS 8 in San Diego to Atari’s headquarters. 12 minutes from the company heyday in 1982, when they were riding high off the success of the Atari VCS/2600 and their many beloved arcade titles.

Super Metroid Map Logic Project

If you explore the internet long enough, you find wonders and horrors, but you also find very weird and obsessive things. One such thing is sm-json-data, a project to not only comprehensive catalog all of the tricks in Super Metroid and the situations they apply to and their uses, but to express it in a machine-readable fashion, so randomizers can use it.

I don’t even really know how to read it, but just the level of detail present here kind of makes me think it’s worthy of presentation here. It also sets off my allergies against obsession, it makes me itch like I’ve got hives, so I won’t be spending much time here. But maybe it’s the kind of thing you might find interesting?

Warning: this way lies madness.

sm-json-data (Github)

Romhack Thursday: Hyper Metroid Super

On Romhack Thursdays, we bring you interesting finds from the world of game modifications.

Why do people play romhacks in the first place? I’m setting aside joke hacks (most aren’t that funny), and hacks that seek to make something completely different from the original. I’m talking about the normal style of hack, the type that tries to deliver more of the original game. Especially for a game that’s beloved and well-made in the first place, like Super Metroid?

But you can’t go home again. Without substantial modification to the game’s code that even extensive hacks almost never pull off, the result is a remix of the original game. Making a game by itself is pretty hard, making an interesting modification that works as an extension of the original, while not going overboard in one of a half-dozen ways, is nearly impossible. Many hacks are unplayably hard. For some, like those invaders from the dark universe of kaizo hacks, that’s the point, but most players just aren’t into that scene. But if the game isn’t harder, then the people who are in the hack’s audience will probably just be bored.

I’m not quite sure that Hyper Metroid SUPER walks the line perfectly. I haven’t finished it (I have a deadline after all), and while I find it interesting there’s at least one sticking point I’ve noticed. But it does its job about as well as any other romhack I’ve seen, I haven’t spotted any bugs, and it’s fun to explore and work through the structure of Super Metroid once again, with a different map and items found in a different order.

The hyperbolic name is a result of it being a sequel to a sequel (to a sequel). Hyper Metroid was a previous hack from ten years ago, by creator RealRed, that’s pretty highly regarded by the Super Metroid hacking community, judging by its rating of 4.62 on Metroid Construction‘s user rating poll. Hyper Metroid won an award in the year of its release, and is at 19th place on its ranking of all Metroid hacks. While it’s only been out six days now, Hyper Metroid SUPER has a rating of 4.87, and is currently at the top of that same list.

Hyper Metroid did an excellent job of turning the Super Metroid engine to the exploration of a new world. Hyper Metroid SUPER is a great refinement in design, and shows what ten years of consideration and attention to design can bring to a game. The sudden deaths and hard stalls that are a problem with most romhacks are not here, but neither is it easy or simple. It’s still the work primarily of one person, and that presents limitations that are not easy to overcome when compared to an original game that was a strong team effort. But I haven’t rolled my eyes in the parts of the game that I’ve played so far, and that by itself is an accomplishment.

One aspect that’s deserving of mention is how, perhaps inspired by Metroid Zero Mission, Hyper Metroid SUPER guides the player along in their explorations in a manner similar to Nintendo’s own games, but also purposely allows for sequence breaking by an experienced player.

As stated, I haven’t finished Hyper Metroid SUPER yet, and it’s the kind of game where all it takes is one badly-designed element to wreck the whole experience. But so far, like the users of Metroid Construction, I rate it highly.

Hyper Metriod SUPER (hack of Super Metroid, metroidconstruction.com)

LOADSTAR Compleat: Commodore 64 Disk Magazine Archives

This is something I’ve been trying to make happen for some time. But then some work I put into it hit an unexpected snag (the maker of a library I had been depending on decided he wanted to be paid a subscription fee to use it or else he was going to put a nag screen on people’s projects), then other things came up, and so the project languished for months.

So now, on the premise that it’s better to get it out there and available and add features and fix things later, instead of sitting on it and potentially nothing happening with it ever, I have put up on itch.io ⅘ths of the run of classic Commodore 64 computer disk magazine LOADSTAR, with the blessing of owner/long-time managing editor Fender Tucker.

This isn’t the first time I’ve mentioned LOADSTAR in these pages. The magazine’s name came from the commonly-entered command on Commodore 64 computers LOAD”*”,8,1, to load the first program on disk into memory, and sometimes also to run it. LOAD”(star)”, you see. I packaged one of its programs, Dungeon, for sale on itch.io for $5 some months back and mentioned it here. This is an opportunity to get the collection it was drawn from. I recognize this is a bit self-serving, but I don’t do it very often, and there’s so much on LOADSTAR that the world deserves to know about. The price of $15 is because that’s what Fender has always sold it for. The issues can also be gotten for free elsewhere, yes. This is mostly an opportunity to get them all at once, and with the Fender’s approval: the person most responsible for all of it, the driving force behind it, the one who always believed the most in LOADSTAR, its very heart and soul.

I had been working for an explorer program for getting the contents of issues and searching through them without having to load each issue individually, but it had been stymied by the issue I mentioned in the first paragraph. Something else I’d like to do is supply an emulator that will run the issues directly, with sensible defaults. The version that’s up has an absolutely ancient copy of VICE for Windows with it. It’s so old that I’m not sure if there might be security issues with it; I should probably just remove it. In any case, current versions of VICE are available for many platforms and are free and open source.

To start an issue, you first start up your copy of VICE. The Commodore 64 emulator included is x64, or else x64sc; the Commodore 128 emulator is x128. Under the File menu, choose “Smart Attach…,” then pick the issue from within the LS64 folder for Commodore 64 issues, or LSQ128 for Commodore 128 issues. Make sure to click the Autostart button: it’ll load the Presenter program and run it automatically! You’ll find both 1541 (*.d64) and 1581 (*.d81) disk images. 90% of the time you’ll want to load the 1581 version, because those disks were much larger and a whole issue could fit on one of them! The 1541 versions (which while growing up I had to put up with) are split up into four disk sides, and are a hassle. By the way: the 1541 disk drive was excruciatingly slow. If you press Alt-W, you can toggle “Warp Mode,” which will speed up loading greatly! Just be sure to toggle it back off once your program has loaded!

And something the collection really needs is a list of highlights of interesting things on each issue, and also a directory of the people who made this unbelievable wealth of software. Here’s a few names to watch for: Jeff Jones (Assistant Editor), Barbara Schulak (Puzzle Maven), Ian Adams (Mathematician), Maurice Jones (Card Game Implementor of Great Skill), Jim Weiler (Third in Command), J.C. Hilty (BASIC Game Programmer who never let it get him down), Nick Peck (Creator of A Couple Of Awesome Games), Jon Mattson (General Gamesperson) and Walt Harned (Pixel Artist Extraordinaire). If I could affix all their names in the stars for the world to see forever, I absolutely would.

To construct the itch.io page I needed some screenshots, so I dipped into a few issues to make them, and got the names of their makers along the way. Here you go, but understand this is only a tiny fraction of what’s included.

Zorphon by Nick Peck, from LOADSTAR issue 39. A rather polished space shooter! The aliens are drawn using character mode. I like the classic Astrocade-like font for the text.
Pipe’s Peak by Bob Blackmer, from LOADSTAR issue 73. It looks like an action game, but I think it’s more of a timed puzzle?
Outpost by Thomas Czarneki, from LOADSTAR issue 60. A fairly blatant Missile Command clone, but it’s well polished. The opening menu asks if you want to play to lose, or play to win. I think the difference is, playing to lose starts you on Wave 7.
King’s Ransom by Scott Elder, from LOADSTAR issue 68. An interesting little game, you control a greedy king trying to scoop up coins before they fall into the lava. When a coin falls off the bottom, a gush of lava shoots up! There’s also skulls to avoid. In one of those little touches that you sometimes find in LOADSTAR software, if you wait on the title screen you get to see a hi-res illustration of the gameplay.
Quadrilation by Dave Johannsen, from LOADSTAR issue 68. A two-player game, playable against a computer opponent with four difficulty levels. Take turns placing your pieces so they overlap with as many squares of the same color as possible.
Stream, hi-res art by prolific Commodore 64 artist Walt Harned and included as part of The Compleat Walt.

Romhack Thursday: About Parallel Launcher

On Romhack Thursdays, we bring you interesting finds from the world of game modifications.

This week’s find isn’t a romhack specifically, but a way of playing them, both in patching and running them in an emulator, in a fairly automated way, at least if the hack you seek to play is for an N64 game, and especially if that game is Super Mario 64. It’s Parallel Launcher.

Parallel Launcher is an all-in-one solution to running N64 hacks. When you first run it, it’ll install a small Retroarch binary for its own use and set it up for exclusively for a couple of N64 emulators. You can supply the path to a folder of N64 roms and BPS patches, and it’ll try to apply patches to the roms on the fly when you try to play them.

It also has integration with the website romhacking.com, which is not connected with the hack news site romhacking.net or its follow-up romhack.ing. I’m not sure what the full extent of this integration entails, but if you have Parallel Launcher and a properly set up SM64 rom, and click on a Play Now link on a hack’s page on romhacking.com, it’ll mostly-automatically download the patch, patch the rom, and run it for you, without you having to do anything else other than allow the link to be passed from your browser to Parallel Launcher. There’s even some integration to track what stars you’ve found.

Once set up, Parallel Launcher works well! One of the biggest obstacle to playing romhacks, after sourcing the rom images themselves, is the effort and focus needed to generate them. You obtain the rom, then the patch, then the utility to do the patching. Then you run the utility, supply the location of the rom and the patch, and then roughly half the time the patching fails. If you’re using a format like BPS you’ll be told, and will then have to get the right version of the rom file or figure out how to repair yours. If you’re not using BPS or a similar kind of patch, you won’t find out until you try to run the game.

None of these steps is very hard to understand, but it’s a big hassle. While Parallel Launcher won’t help you find versions of roms, it’ll do just about everything else for you. In the way of emulators and emulation tools, it’s available for most current and popular desktop platforms. It’s a useful tool for a hack player’s box.

Foone Examines The Code of Carmen Sandiego

Foone! Everyone’s favorite examiner of old game code! She’s been looking at the Enhanced DOS Port of Where In The World is Carmen Sandiego! The surplus of exclamation points is how you know I’m not an “AI!” I use the scare quotes because it’s not “Artificial Intelligence” at all! Introduction and silly digression concluded! Opening paragraph complete!

Foone began her journey in search of the elusive mastermind back at the start of the year, and the thread is still going on. One of the early hacks she made is putting herself into the game as one of the criminals. I think this screen isn’t faked. She made and maintains the Death Generator website, so it wouldn’t even be particularly hard for her I think.

Some notes from the very long thread, which is still going:

  • Nouns used as verbs encountered: gibberish, chunk.
  • The game has support for changing the Acme Detective Agency image depending on different seasons of the year.
  • There is a handheld version of Where In The World Is Carmen Sandiego, which is actually a small DOS emulator, here’s the back of its box:

And here’s all of the people you can talk to in the DOS version:

I love this kind of cartoon art style, you (okay, I) don’t see it much anymore, now everything wants to look like anime.
  • The 1985 DOS version (so, not the one we’ve been following) has an invert-Y function for the joystick, in case you want to use a flight yoke controller.
  • A reference is made a post on Raymond Chen’s (awesome) Old New Thing blog, about a DOS game running under Windows 95 that crashed because it saw too much memory. It handled memory by allocating and allocating and expecting to be told “no” eventually. Windows 95 would keep giving it memory, going to virtual memory, from the swapfile. The program didn’t expect to keep being given more memory, and eventually it overflowed the array it used to keep track of it all. This seems to be the Old New Thing post.
  • On the world changing beneath the game: the frowned-upon word for Romani (beginning with ‘G’) is patched, the Brazilian currency name was wrong even when the game was released, lots of changed flags, the fall of the Soviet Union changed lots of things.

Behind The Code Examines the Mario 3 Revision

Displaced Gamers and their various technical dives, including the Behind the Code series, are favorites around here, and we’ve linked to them many times before. They take a lot of time with their content, but they always do a good job, much better than the average Youtube channel of whatever type, and it’s always something interesting to learn about. They have a new video up now (22 minutes) that examines the differences between the original and revised versions of Super Mario Bros 3, released a few months apart back in 1990.

Most of the differences were superficial: they changed the cover art slightly and added a ® symbol replacing a ™ on the Official Nintendo Seal. On the rom itself, they changed the names of the lands in the ending, from a flavorful set of localized names to just Adjective Land eight times in a row.

But there were other changes, and one of them was a substantial difference in the code, one that required moving much of it around by seven bytes to make room for it.

What was it? In brief, there’s one level in the game, 7-3, that uses a vertical-only scroll instead of a horizontal or multi-directional scroll, and it writes the images of the cards in the status window to the wrong place. So in the original release, on that one level, the card images are mysteriously blank during the vertical section.

That was fixed in the revision, which meant a check for what kind of scroll the level was using, and which changed the pointer to where to write them. Code needs space, and that space came out of a section of unused bytes at the end of the rom, with all the code between the change and that section shifted to account for it. If you had a Game Genie code that relied on data in those memory locations, too bad! You’ll need a modified version of that code.

Here’s the full low-down, which goes into much greater detail: