Doorstop

Description

Doorstop is an unfinished game for the Nintendo Entertainment System.

This was my first bigger 6502 project and also the first time I coded for the NES. It's a very interesting platform to code for, the limitations make it a lot of fun, actually. Most of the work went into writing a custom music engine and an exporter from Famitracker to my engine's own data format.

There's also an exporter from Tiled XML files to my own tilemap format optimized for the NES. The tile and sprite engine don't support scrolling, but it all runs pretty smooth.

Some of the limitations of the NES made this pretty interesting. There is no way to directly generate (pseudo) random number seeds on the NES. There's no global timer that could be queried or anything like that. I ended up implementing a linear feedback shift register random number generator which works without multiplications or divisions... something the 6502 cannot do in hardware and is pretty slow in software. I seeded the PRNG with timing taken from the player while starting the game. The "Press Start" start screen is actually an integral part of the game's core, because it's the timing thing used.

Another interesting thing is that the RAM is very limited (only 2KB!) unless there's extra RAM on the cartridge (which was not allowed for the Compo). The idea was that the player can move freely between rooms connected through the doors. And all that in a randomly generated world. It's impossible to keep all the generated world data in RAM. The only feasible solution was to generate the door layout for each room from the world seed when entering and only storing the state of buttons for the whole world - saving RAM is everything and I ended up using bits that would usually just go unused in games for modern hardware. If a number only goes from 0-127, there's one bit left. Use it :-)

The game was supposed to be submitted for NESDEV 2016 Compo, but I never finished it. You can try it in a NES emulator of your choice. The idea was to set the switches and then try to get through the doors. The doors show how many switches are in the right position, just like in the boardgame Master Mind. That's the part that's implemented.

Then the idea was to have a Boss come for the player and add some pressure to solve those little puzzles. Sadly, the puzzling and switch flipping are not much fun and time was running low for the compo, so I gave up at that point. The Bosses never got implemented.

I am planning to continue this project at one point, but then with a completely new gameplay idea.

Links