For kicks - what method do you guys use?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
JoeGtake2
Posts: 333
Joined: Tue Jul 01, 2014 4:02 pm

For kicks - what method do you guys use?

Post by JoeGtake2 »

Just futzing around making malleable HUD tables/pop up menus/etc. Of course, getting the att's to behave right for a truly malleable table on an 8x8 grid has been fun. But even constraining to full attribute grid, I noticed something, and I wondered what all of your favorite solutions for this sort of thing would be.

Essentially, I throw all the new nametable reads into a buffer and fire it out during the NMI, 8 tiles per frame, leaving me plenty of room in the NMI. The trick though, is, when is the lesser distracting time to load new attributes.

Do you guys think I should essentially flash the attributes to the entire to-be-affected area first, so that for a frame or two, the *color* changes before the pop up box is drawn? Or do you like having the box drawn for a frame or two with the wrong attributes, and then after a pickup frame get the right new nametable tiles in place? Or do you guys do it sort of procedurally - load a metaTile to coincide with a new attribute and sort of do it metaTile by metaTile rather than a run of nametable data then a run of attribute data/vice versa? Or maybe even something I haven't thought of?

I have played around with all of these to see which method I like more. They all have pros and cons. Curious what you guys would think of this.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: For kicks - what method do you guys use?

Post by tokumaru »

I always go with the least glitchy-looking option, so I'd probably always do AT-aligned updates (e.g. metatiles).
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: For kicks - what method do you guys use?

Post by Kasumi »

Image
I did it per tile both ways above. Which... wasn't easy.

Edit: For more clarity, my strategy there was when the textbox was appearing it should win. (Level is the wrong color when the boundaries aren't aligned.) And when the textbox is disappearing, the level should win. (Textbox is the wrong color when the boundaries aren't aligned.)

If you're locked to the metatile grid (which may even look better than the above) absolutely update the attributes and tiles at the same time so nothing is ever colored wrong.
User avatar
rainwarrior
Posts: 8062
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: For kicks - what method do you guys use?

Post by rainwarrior »

If you do it in two passes, you can use a clean looking "black box" as an intermediate step.

1. Fill the overlay area with black (or color 0) tiles, line by line.
2. Replace the attributes in the overlay area.
3. Draw the finished overlay line by line.

When it's done, do the reverse.
JoeGtake2
Posts: 333
Joined: Tue Jul 01, 2014 4:02 pm

Re: For kicks - what method do you guys use?

Post by JoeGtake2 »

Great advice, both of you! Kasumi...buzarre that I remember a time long ago now that I think you were walking me through how you werw having this exact problem while patiently giving me some great ‘beginners’ tutelage! Seems like a lifetime ago now.

Rainwarrior - brilliant. I already have a routine that fills said box area with *blanks*, so that’s a brilliant way to handle it! Hadn’t even thought of extending it to two steps like this, but sure, that makes sense. Would completely solve the problem. Thanks for the thought!

EDIT - Like this :-)

Image
Post Reply