This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Best way to draw nearly a whole BG during vblank

Best way to draw nearly a whole BG during vblank
by on (#33377)
I'm doing a clone of the game Columns and, when you score lines, it's not unusual for various parts of the BG to change. I've been trying several methods and it seems too much happens in vblank, although this occurs randomly.

My basic plan of attack was this:
-I have an array of 96. 16 rows, 6 columns (2 rows on the top and 1 extra on the bottom. The 2 on the top are used in detection for game over. The one on the bottom is just there for use with the attribute function)
-The array spots will hold a value 0-5 for one of the various blocks you've got. 7 is used for empty spaces (it was easier this way). 6 is reserved for whatever
-When you score something, it looks at the array and obviously "touching 3 of a kind tiles". Then I have it ORA those tiles with $10. So any three of a kind will now have $10 added to it as a sort of "marker".
-When going to the scoring function, it currently just looks at the tiles in the array and writes the BG tiles to use to another array (this is done outside of vblank)
-During vblank, I look at that secondary array, and use a loop to write approx. 36 tiles to the screen and up the indexes and such.

My question is: Is this logic good or is there far better logic I could use?

by on (#33378)
Maybe throw some repeating LDA #xx \ STA $200x code inside RAM, then modify the XX's during drawing time. Worked for MC Kids.

by on (#33381)
Well, I don't know the game columns so it's hard to tell.
However, if you do repeated updates in a 1-frame interval, the player is likely not to notice it, so if your (ROM) code is fast enough you can do 4x4 lines or something like that to redraw half the whole screen in 4 frame, and this is barely noticeable to the user. If you use a lot of RAM as dwedit says, you could do 256 $2007 writes using $500 bytes of RAM, allowing to redraw 8 lines so the whole screen in 4 frames.

by on (#33383)
Disch: Did you know that MC Kids's Levels and MetaTiles are Compressed, I learned that at Data Crystal (The ROM Hacking Wiki, Google it if you can.)

BTW (on Mckids): The Palettes seem to be also compressed, Did anyone crack the code so I can edit it?

by on (#33385)
Tetramino turns off the screen about nine lines early to update a whole 10x20 tile playfield in one NTSC vblank. I can help you write the refresh code if you want.

by on (#33386)
I was talking in chat last night and think I got a pretty good solution: I disabled sprite DMA as no sprite are moving/updating at this point and optimized my drawing code a tiny bit and the end result is great!

Thanks for the tips though.