Vram usage for mixed modes

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Vram usage for mixed modes
by on (#233974)
How was vram typically used for levels that contain Mode-7 and non Mode 7 parts? Such as the airplane in Contra III? Originally I had 16kB of sprites, 8kB of tile maps, 8kB for 2bpp tiles and 32kB of 4bpp tiles.

Because I decided to use mode 7 at the end of level 2, I crammed both the 2bpp and 4bpp tile sets into the same 8kB, to give room for 32kB for mode 7. Is this how it was normally done?
Re: Vram usage for mixed modes
by on (#233993)
I just checked the fighter crash scene in Stage 1 of TARGA (Rendering Ranger). It seems to use 16 KB for Mode 7 (half the map and half the tile pool are garbage), 12 KB for Mode 1 tilemaps (three 64x32 layers of 8x8 tiles, according to bsnes-plus, and they're all valid layers except for some offscreen scroll artifacting that suggests that some of the tile pool was overwritten), and 16 KB for sprites (including stuff that doesn't show up during the Mode 7 sequence - actually, come to think of it, BG2 and BG3 don't show up in that scene either). This would appear to leave a solid 20 KB for BG tiles, assuming no sharing between BG and OBJ pools, and ruthless optimization might get it close to double that.

In my game, for Mode 7 scenes I usually use 24 KB of Mode 7 data and 40 KB of combined OBJ, 4bpp BG and tilemap data. There's a bit of a dance going on between mid-screen OBSEL changes and partial double buffering of the Super FX layer, so I ended up needing five OBJ tables to cram everything in; fortunately I don't need much Mode 1 tilemap data. This scheme only works because the Mode 7 layer's behaviour is deterministic, so I can ensure that the player never sees the part of the map occupied by an OBJ table.

I'd expect a game like F-Zero to use the full 32 KB for Mode 7. Something with a smaller and/or more scripted affine layer using fewer tiles might be able to get away with using a lot less than 32 KB by either masking off the garbage area somehow (sprites? windowing?) or just ensuring that it's always offscreen.
Re: Vram usage for mixed modes
by on (#234063)
You can use the emulator ZSNES and take a savestate at the moment you want to analyze. Then use the program BGMAPER in order to check how VRAM is used (requires DOSBox as Windows7 refuses to run it natively - but it'll work natively in XP).
Re: Vram usage for mixed modes
by on (#234076)
Or just use vSNES.