radonballoon wrote:
I've already programmed a pong game for the nes
So I'm sure you get the basics of how a game works. One of the hardest parts is understanding that, the concept of how to update things as the time passes.
Quote:
I at least understand the basics of the nametable/attribute table,palette, sprites, input.
IMO, this is much less important than understanding the concept of a game engine.
Quote:
I guess my first question is what foreground objects versus background objects are. I'm guessing that the foreground like blocks, ground, etc. are sprites, and the background is a nametable that scrolls.
This is your call, really. Of course it would be easier to make everything that interacts with the player as sprites, but the NES is not very strong in the sprite department (too few of them to use and the small ammount of them that can be displayed on the same scanline), so, depending on the complexity of the game (ammount of objects and how detailed they are), you may find yourself using the background for objects and items.
Quote:
how would you scroll a repeating background? Would you load two nametables, and switch them out?
Well, typically, in platform games, the background does not repeat, but if you really wish to do that, the NES has 2 name tables avaliable, so if you fill them both before starting the game, you get a 512-pixel scrollable are without having to update them again. There is no need to switch them. If you have vertical mirroring, and we call the name tables "A" and "B", let's say you start displaying name table A. As you scroll right, name table B will start to show up, until it fills the whole screen. If you keep scrolling right, the NES will automatically show name table A again.
Quote:
And my final question is what is the normal way to go about creating levels? And how would this be stored?
How you create the depends on the format they are stored, and the format is all up to you.
For actual games, you obviously can not store all the level as uncompressed name table and attribute table data. First, because that uses a lot of space (1KB per screen), and second, because even using that much space it does not include any collision information.
Games tipically use what is called metatiles. Metatiles are groups of tiles (usually arranged as blocks of 2x2 or 4x4 tiles) that you use to actually build the level. You have to define these metatiles somewhere in the ROM, defining what tiles each one uses, what palette, and their type (empty, solid, slippery, water, etc).
For a side-scroller, it'd be easier to arrange those metatiles in the form of columns, because as you scroll you have to draw columns with the new metatiles that show up in consequence of having scrolled.
But even that is not enough compression if you plan on having really big levels. That means that you have basically 2 options: use the same trick used with the metatiles, that is, instead of placing metatiles directly into the level, define entities that are groups of metatiles and place that directly into the level. The Sonic games for the Megadrive/Genesis do that. The other option is to use a compression algorithm (RLE, LZ, etc) to compress the level map data, and decompress it to RAM (you'll probably need large ammounts of it) as the level is played. I'm a big fan of the first option, because I find it faster and simpler, but it can result in levels that look repetitive if used in the wrong type of game.
Thing is there is no rule at all for this kind of stuff.