Sumez wrote:
Compression as bitmasks is generally pretty convoluted on a 6502, unless there's some trick I don't know about.
Well, the same can be said about many other things in game programming, don't you think? Like I said, the straightforward thing to do is indeed to use an extra 8KB of RAM and forget about it, or you could keep thinking and end up devising something more advanced.
One way to do it would be to pack breakable blocks into objects of 4x4 bricks (requiring 2 bytes of state), or whatever size is more convenient for your level design. Then, when decoding the active portion of the level map to RAM, "patch" that using the states of the blocks in the same area. Whenever a block breaks, locate its parent object based on its coordinates and update its persistent state. It's certainly not a no-brainer, but it's definitely not undoable either if you have the time and determination to design such a system.
The way these features are designed might affect the level layout a bit, so I'm not necessarily saying you can recreate SMB3 levels 1:1 without the extra RAM, but had the development team gone with another strategy from the beginning, they'd probably be able to create levels just as dynamic that would have had the same impact on players.
Quote:
SMB3 already has a lot of other things to keep track of, and the stock 2K ram is pretty limited.
Once you realize the Atari 2600 only has 128 bytes of RAM and that somehow people were still able to make moderately complex games on it (I created a RAM layout to fit a screen-by-screen puzzle platformer in that machine and things were really tight!), 2KB starts looking pretty spacious!
You can use most of the stack page for other things. You can reuse the same RAM for different purposes in systems that don't run concurrently (i.e. don't make every variable/array global). You can even sacrifice some sprites and get 3.5 bytes of extra storage for each unused OAM slot (the Y coordinate must be > 239, so you can even use its lower nibble for other purposes). As a last resort, even VRAM can be used for storage of things that are not accessed all the time (if you use CHR-RAM, you can probably afford to lose a few tiles).
Again, the solutions aren't always straightforward​, but if you know beforehand most of the features you'll need to implement and you have the time to do it, you can usually create a memory map that'll be able to accommodate it all, unless you're going for something really unconventional that's not typical of 8 and 16-bit games. I personally think that finding creative ways to make game features fit in 2KB of RAM is a very fun exercise!
Like I said, it might not be possible to backport SMB3 to only 2KB of RAM now and get the exact same final product, but had this limitation always existed, the resulting game would probably feel equivalent in every way, if time wasn't such a big constraint.