FinalZero wrote:Ok. While we're on the topic of tiles and sprites, is there any way to just grab and display a 4x4 tile/sprite? or is 8x8 the smallest size that can be done?
8x8 is the smallest unit. For sprites you can make part of the 8x8 tile transparent so objects can appear to be any size you want, but the backgrounds are always composed by 8x8-pixel blocks.
I'm wondering because if so, then smoother fonts could be created and used, rather than the typical ugly monospaced 8x8 one...
If you use CHR-RAM you can manipulate graphics to the pixel level, but because of space and speed constraints, there are severe limitations to what you can do with that.
To write text with proportional fonts you have to use CHR-RAM, reserve a number of tiles that span the maximum length of your text, and in order to write the text you'd update the pattern tables, rather than the name tables. Since there are only 256 tiles for the background, you can conclude that this will waste a lot of tiles quickly.
Under normal circumstances, those 256 tiles are not enough to make an entirely unique screen (such screen would need 960 tiles). But if your graphics use only 2 colors (which is usually the case with text), you can use a few tricks. First, NES tiles have 4 colors, so they use 2 bits per pixel. 2-color graphics need only 1 bit per pixel, so you can actually store 2 1-bit images in 1 tile (to display one image or the other you have to use different palettes), which basically doubles the tile count to 512. The next trick is to switch to the other half of the pattern tables halfway through the rendering of the screen, which will result in 1024 1-bit tiles, enough for an unique screen with no repeated tiles.
So yeah, it's possible to write a whole screen of text with proportional fonts. In fact, there was
some talk about this a while ago when someone wanted an e-book reader made for his portable NES clone. I don't think this would be practical in actual games though.
I have played FF1, but not for the NES. I'm trying to ask how they do store the data if they can't store it in one or two char banks. Also, do you mean the monster graphics themselves, or the possible combinations of monster the player's party might meet? If the latter, why is that stored in char rom? It's not graphical.
I haven't played FF1, but the thing with CHR-ROM is that the tile combinations you can make are limited. The maximum CHR division in existing mappers is 4 1KB banks per pattern table. This means that there are 4 switchable blocks. If you wanted to combine enemies for example, you'd have to map a different enemy to each slot. But what happens if you want to combine more than 4 different enemies? You can't with blocks that size, unless you start hardcoding the combinations in a huge CHR-ROM chip, which might not even be possible depending on the number of combinations. The solution in this case is to use CHR-RAM, so that each tile can be edited freely and you can make all the combinations of graphics you want, as long as they add up to 256 tiles.
So, what does one do if one needs data from two separate banks? Load it from one, switch to the other, and then load the rest?
Yeah, this can get complicated depending on the number of switchable and fixed banks each mapper has. This is something you have to take into consideration when designing your program.
In my current project for example (UxROM: 2 16KB slots, one fixed, one switchable), the main game engine is in the fixed bank, so that it can read level maps and things like that from all the other banks. Other things that are more or less self contained (i.e. don't need to access other banks) stay in switchable banks too (like the music engine, navigation menus/screens, etc).
Of course there are ways to access anything from anywhere by using trampoline code (i.e. call a routine in the fixed bank which will switch banks, read the data, switch back and finally return the data), but that can be very slow because of all the overhead.