Thursday, October 27, 2011

Programming for the NES

"Why the hell would you want to do that?" I can hear someone say.

I always had that nagging feeling that it would be a waste of time. Every time I'd try to start learning (again), I would end up convincing myself SDL would be a better use of my time. Or Irrlicht. Or basically anything using C++ and not assembly for an ancient 8-bit processor. If my friends are going to run my programs (and presumably they may), then I'd be better off using something I'm more comfortable with, already know a good deal of, and has much, much better capabilities.

To put it bluntly, screw that. More than once I've set out with SDL or Irrlicht and tried to make some kind of game engine. Every time, though, I end up with something that functions, but not well, and leaks memory. They're sloppily-written, and too large for me to go and clean up. Plus, I have two enormous books about writing game engines in C++ and they don't seem to be doing me a whole lot of good.

Will working with a limited machine help me to think in better, more efficient terms? Will I have a deeper appreciation for STL after having to do data structures with no help at all? Will I be a better game programmer and better programmer in general? God, I hope so. But the road is going to be bumpy; programming in assembly is no small ordeal.

But among those benefits that may come, there are some that I will certainly enjoy. Small file sizes are nice: my typical SDL programs, including graphics and extra libraries to run them are rarely under 2MB. Not a big deal most of the time, but I don't have web hosting that can handle that kind of thing currently. The simplicity of distributing one single file instead of a ZIP file and explaining how to run it would be much better for my friends when I have them try out my work. Finally, there are NES emulators everywhere. We all have them on our PCs, I have one on my Wii, my Dreamcast, my PSP, my DS... The fact that the NES is a limited and old hardware platform actually becomes an advantage when you consider how easily it can be emulated by other platforms.

So I've decided, again: I'm going to take another stab at it. I have a bunch of documents printed and laying around from my first try; I may as well use them.

Now, if only I can get these damn pattern tables and attribute tables figured out. I'm sure I'm just over-thinking them, but they've always been the stopping point when I've tried to learn NES programming. I fake it for a while, going along with the documents, but I never actually understand them well enough.

Here's to hoping I'll actually put forth a decent effort and that the effort will get me to a place I can be proud of. I've already started getting my build environment set up and began working through a tutorial. I don't have anything worth sharing yet, but I'm sure I'll be blogging some more when I have something to bitch about during my lessons!