It is currently Fri Nov 24, 2017 11:44 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Fri Jul 31, 2015 10:36 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3116
Location: Nacogdoches, Texas
It kind of reminds me of Microsoft Paint art. :lol:


Top
 Profile  
 
PostPosted: Tue Aug 04, 2015 7:03 pm 
Offline
User avatar

Joined: Tue Jun 02, 2015 9:17 pm
Posts: 35
Location: Florida
I'm having problems setting the scroll values mid-scanline, can someone tell me what I'm doing wrong? It works fine if SCROLL_X and SCROLL_Y are #0, but anything else and I get weird results (for example, after a certain point SCROLL_X scrolls in both X and Y). I'm trying to do the $2006, $2005, $2005, $2006 trick.

Code:
 ; Set scroll, adding current scanline
  lda PPUSTATUS   ; reset scroll status
 
  ; In-scanline scroll = PPUADDR,PPUSCROLL,PPUSCROLL,PPUADDR
  ; ((Y & %11000000) >> 6) | ((Y & %00000011) << 4) | (N << 2)
  ; Simplified to just (N << 2)
  lda #%00000100
  sta PPUADDR
 
  ; X
  lda SCROLL_X
  sta PPUSCROLL
 
  ; Y
  lda SCROLL_Y
  adc #32      ; Add current scanline+1 to scroll
  sta PPUSCROLL
 
  ; ((X & %11111000) >> 3) | ((Y & %00111000) << 2)
  ; Compute munged Y
  and #%00111000
  asl
  asl
  sta HBLANK_TEMP ; Store munged Y in Temp
  lda SCROLL_X
  lsr
  lsr
  lsr
 
  ora HBLANK_TEMP ; Or munged X with munged Y
  sta PPUADDR


I understand it's not optimized as it can be (and I'm eventually going to move the scroll-pos munging out of there, since this code is in the middle of scanline drawing), I'm just trying to get it to work first.


Top
 Profile  
 
PostPosted: Tue Aug 04, 2015 7:17 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6454
Location: UK (temporarily)
The order you write to PPUSCROLL is backwards from what you intend. (here it's Y first, then X.) Also, there will be visible corruption on-screen between the 3rd and 4th writes if you change fine X.

If you don't change fine X, consider the faster PPUADDR-only method.


Top
 Profile  
 
PostPosted: Wed Aug 05, 2015 5:21 am 
Offline
User avatar

Joined: Tue Jun 02, 2015 9:17 pm
Posts: 35
Location: Florida
Thanks a lot, just swapping the X and Y in PPUSCROLL worked like a charm. I'll get you next time, PPU!

Here's the demo if anyone's interested, scrolling with HUD (with its own HUD palette):
http://www.dreamzle.com/blade/scroll_demo.nes


Top
 Profile  
 
PostPosted: Wed Aug 05, 2015 7:49 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1834
Location: DIGDUG
Is there some reason you're trying to find the hardest way to do everything? Zelda didn't need MMC5 or use complicated scrolling tricks. Learning how to use them is cool and all, but it can also be a form of procrastination. One way artists spark creativity is to force some kind of limitation... Today I'm only going to use blues. Embrace the limitations, say to yourself, "I can make it work with only 4 palettes for background" :)

"Procrastination" because you spend all your time solving technical problems rather than programming your game.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Wed Aug 05, 2015 1:57 pm 
Offline
User avatar

Joined: Tue Jun 02, 2015 9:17 pm
Posts: 35
Location: Florida
Actually, The Legend of Zelda did use complicated scrolling tricks, to put their own HUD at the top of the screen - if you want a HUD at the top that doesn't scroll, but your game uses vertical scrolling, you have to. Zelda used sprite-0 collision instead of the MMC5 scanline IRQ, but in the end the technique is basically the same.

And as I've mentioned before, I am not going to be the artist on this, and I can't guarantee that the artist will be amazing at limited-color and limited-tile pixel art, so I'm trying to make their job as easy as possible. And why wouldn't I, when I'm doing this in my spare time? I have no deadlines, and at worst I end up with a good general reusable MMC5 game engine with some nice special tricks.


Top
 Profile  
 
PostPosted: Wed Aug 05, 2015 3:02 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1834
Location: DIGDUG
OK, you're right about zelda. My memory is shitty.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Tue Aug 11, 2015 8:33 pm 
Offline
User avatar

Joined: Tue Jun 02, 2015 9:17 pm
Posts: 35
Location: Florida
Darn, I just ran into a technical limitation I hadn't realized: just how little time there is per vblank on NES. Only being able to update a couple rows of chars per frame while still updating other things like sprites throws my 4-row HUD under a bus if I want vertical scrolling, since I'd have to update all 4 rows plus the actual scroll-reveal row every scroll update. I can't get around it by keeping the HUD on another nametable, because when using MMC5 extended mode all nametables share the same extended palette/char table.

The only solution I can think of that doesn't involve dropping extended mode or the BG HUD is to use the MMC5 vertical split for a side HUD, but that would be insane (and I'd lose my extra HUD palette). That or turn the HUD off during scrolls, which seems rather janky (admittedly, with the Zelda-style scrolling I had planned on it's not as bad, but still janky).


Top
 Profile  
 
PostPosted: Tue Aug 11, 2015 9:02 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6454
Location: UK (temporarily)
Dreamwriter wrote:
I can't get around it by keeping the HUD on another nametable, because when using MMC5 extended mode all nametables share the same extended palette/char table.
Can't you turn off the extended nametable behavior for just the HUD?


Top
 Profile  
 
PostPosted: Tue Aug 11, 2015 9:43 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1834
Location: DIGDUG
Most of the NES games I've seen, with free bidirectional scrolling, either use a sprite health bar, or no HUD.

Though, it is an interesting puzzle. Can it be done? And, can it be done without lots of attribute glitches.

Edited.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Last edited by dougeff on Tue Aug 11, 2015 10:09 pm, edited 3 times in total.

Top
 Profile  
 
PostPosted: Tue Aug 11, 2015 9:58 pm 
Online
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10118
Location: Rio de Janeiro - Brazil
Lots of games have glitch free status bars combined with bidirectional scrolling. Some of them use name table layout tricks, but since you seem to be stuck with a single name table (unless it's indeed possible to disable extended attributes for part of the screen, and you're OK with that) I think that the solution that would work best in your case is the solution used in Crystalis: simply use mapper IRQs to skip the hud during the rendering of the playfield, and always keep it in the same place. Look at a name table viewer while playing some Crystalis and you'll see how it works.


Top
 Profile  
 
PostPosted: Tue Aug 11, 2015 9:58 pm 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1037
Check how ROM City Rampage did it, perhaps? Of course, you'll have to rip it out of Retro City Rampage. But it's an MMC5 game with extended attributes, a HUD and multdirectional scrolling. (Though it doesn't try to use extra palette for the HUD, so if that's part of the problem this is a bad suggestion.)

1.70 MB gif of what ROM City Rampage's HUD/Nametable updating looks like: http://i.imgur.com/pP6VDps.gif

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Tue Aug 11, 2015 10:10 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1834
Location: DIGDUG
Crystalis is a great example, but it does have those attribute table glitches I mentioned. And a nice big line of a glitch, right at the split screen.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Tue Aug 11, 2015 10:30 pm 
Online
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10118
Location: Rio de Janeiro - Brazil
Kasumi wrote:
1.70 MB gif of what ROM City Rampage's HUD/Nametable updating looks like: http://i.imgur.com/pP6VDps.gif

Looks like the Crystalis trick to me. If you pause, you can see that whatever is right above and right below the status bar in the name table connect directly in the final render. Also notice that there's a blank row above the status bar in the final render, so that the gameplay window can scroll smoothly without glitches.

dougeff wrote:
Crystalis is a great example, but it does have those attribute table glitches I mentioned. And a nice big line of a glitch, right at the split screen.

Yeah, lots of commercial games were glitchy. The technique is perfectly valid, though, you just have to time it right.


Top
 Profile  
 
PostPosted: Wed Aug 12, 2015 12:16 am 
Offline
User avatar

Joined: Tue Jun 02, 2015 9:17 pm
Posts: 35
Location: Florida
I think I see, don't just use the scanline IRQ once for the HUD at the top of the screen, but also a second and third time to adjust hardware scrolling to show the lines above the HUD as if they were directly connected to lines below the HUD. Tricksy hobbitses! Sounds like a plan...

Disabling extended attributes while rendering a HUD on a second nametable is something I considered trying and might actually work (the HUD is all on char bank 0 and only using one palette), but pushing MMC5 that way is a dangerous thing to do when I don't actually have access to the hardware I'm developing for yet, to test how that MMC5 implementation handles it. The way I'm testing now I've got four emulators, and if what I'm doing doesn't look mostly the same on all four, then chances are I'm doing something wrong or dangerous even if one of the four is doing exactly what I want. As long as I'm not doing anything tricky/out of the ordinary for MMC5 I should be fine with this testing method, worst case is I might need to tweak timing a bit once I can get the game on hardware.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Bing [Bot], getafixx and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group