Zelda dungeons

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
cpow
NESICIDE developer
Posts: 1089
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Zelda dungeons

Post by cpow » Wed Apr 15, 2009 9:06 pm

I am noticing my emulator does not hide Link under the door frame when he transits through a top-of-screen or bottom-of-screen door in a dungeon. I originally thought it was a problem with sprite priorities and some kind of sprite overlay that hides Link behind, like the effect in BlasterMaster when the vehicle moves through an arch-way. However, I do not see any entries in OAM for sprites for this purpose.

What hides Link? I see other emulators hide him, and I know that not hiding him makes it look rather silly so is obviously wrong...

I should clarify I don't mean he isn't hidden while the screen is scrolling. I mean he isn't hidden as you walk toward the edge, so it looks like he's walking OVER the door frame instead of through the door.

User avatar
Dwedit
Posts: 4236
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit » Wed Apr 15, 2009 10:14 pm

There's 8 other (lower indexed, higher priority) sprites in the same row. Link is only properly hidden if you emulate the 8 sprite limit.
Last edited by Dwedit on Thu Apr 16, 2009 10:42 am, edited 1 time in total.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg » Thu Apr 16, 2009 10:26 am

What about horizontal doors in both? I thought they put a higher-priority sprite below the background, so that it brought those background pixels in front of later sprites (including the player).

mattmatteh
Posts: 345
Joined: Fri Jul 29, 2005 3:40 pm
Location: near chicago
Contact:

Post by mattmatteh » Thu Apr 16, 2009 12:16 pm

Also the top and bottom is off by one line too when link is hidden, wont line up correctly with the door. ( bug in zelda ? )

User avatar
MottZilla
Posts: 2832
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla » Thu Apr 16, 2009 12:19 pm

Left and right doors are the sprite masking effect that is used in Super Mario 3 to have sprites come out of pipes or blocks.

I hadn't heard about the vertical going doors using the 8 sprite per scanline limit but it seems that is so. I'm not aware of any other game using the limit like that.

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg » Thu Apr 16, 2009 1:03 pm

Some of the Ninja Gaiden games use the 8-sprite limit on cutscenes.

User avatar
MottZilla
Posts: 2832
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla » Thu Apr 16, 2009 1:07 pm

Almost gives me a reason to implement that in my emulator now.

User avatar
Bregalad
Posts: 7766
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Post by Bregalad » Thu Apr 16, 2009 2:01 pm

I'm pretty sure the left and right doors are made by simply turning Link's sprite priority to background, so that he is below the BG. When passing the right door, the right half of Link becomes behind BG while the left part is still in front of BG, and there is a 8-pixel window that is entierely black so it's impossible to see it.

This wasn't possible for top and bottom doors beacause Link is made of two 8x16 sprites. This would have been possible if he was made of four 8x8 sprites.

As far I know few games uses the sprite clipping trick on purpose. Castlevania (when entering the castle and falling into water + when secret items pops up from the ground), SMB3 (when items pops out of blocks) and Battletoads & Double Dragon (at the screen between stages 1 and 2) are the only ones I can think of.

Mega Man 2 uses it accidentally each other frame in Air Man stage if you jump into the life bar.
Life is complex: it has both real and imaginary components.

User avatar
tokumaru
Posts: 11466
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru » Thu Apr 16, 2009 5:03 pm

Gimmick! uses the 8-sprite limit to make him jump out of the portal at the start of the level.

Nightshade uses the background priority trick to have the character walk behind pillars. In fact, it appears to have a wide range of shapes to use as masks in the pattern table.

User avatar
MottZilla
Posts: 2832
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla » Thu Apr 16, 2009 5:22 pm

Bregalad wrote:I'm pretty sure the left and right doors are made by simply turning Link's sprite priority to background, so that he is below the BG. When passing the right door, the right half of Link becomes behind BG while the left part is still in front of BG, and there is a 8-pixel window that is entierely black so it's impossible to see it.
I don't believe that is the case. In my emulator sprite priority is implemented and so is sprite masking as used by games like Castlevania and SMB3, but the 8 sprites per line limit is not. When I tested Zelda, traveling left and right through dungeon doors does mask Link like he is going under the tile. This does not happen when going up or down through doors.

EDit: Nevermind, confusion.
Last edited by MottZilla on Thu Apr 16, 2009 7:53 pm, edited 1 time in total.

User avatar
cpow
NESICIDE developer
Posts: 1089
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Post by cpow » Thu Apr 16, 2009 6:28 pm

Bregalad wrote:I'm pretty sure the left and right doors are made by simply turning Link's sprite priority to background, so that he is below the BG. When passing the right door, the right half of Link becomes behind BG while the left part is still in front of BG, and there is a 8-pixel window that is entierely black so it's impossible to see it.
Yes, this appears to be correct. The OAM attribute changes from 40h to 60h when moving through the left door.
Bregalad wrote:This wasn't possible for top and bottom doors beacause Link is made of two 8x16 sprites. This would have been possible if he was made of four 8x8 sprites.
I had implemented the emulation of setting the PPUSTATUS overflow bit but not the behavior of NOT showing more than 8 sprites. Now that I have implemented that Link walks THROUGH doors instead of over them.

Thanks!

User avatar
Dwedit
Posts: 4236
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit » Thu Apr 16, 2009 10:11 pm

Gremlins 2 uses the 8 sprite limit to mask rows for the cutscenes.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
Jon
Posts: 47
Joined: Fri Apr 03, 2009 10:55 pm
Contact:

Post by Jon » Thu Apr 16, 2009 10:49 pm

These tricks are interesting for homebrew development too. Has anyone collected a few of these tricks as examples/guides or at least lists a few games and what tricks they use? While I don't object to disassembling a ROM to find out bits of what it does, my capacity to do that with more than a handful of games in a few months is limited.
If they're secret bits that nobody wants to share, I understand, but from the comments on this thread it seems somewhat common knowledge.
I especially like tricks that don't require an MMC5 or other sophisticated mappers. Mostly because I am only targeting UNROM and CNROM (edit: I think I mean ANROM, the one with just RAM and PRG that doesn't suck) type carts, and partially because I think it's better to know what a NES can do on its own before trying to dig into the complexities of a "modern" mapper.

User avatar
MottZilla
Posts: 2832
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla » Thu Apr 16, 2009 11:20 pm

AxROM is PRG-ROM and CHR-RAM, with One Screen Mirroring. UxROM is the same think except it has fixed Horizontal or Vertical Mirroring.

User avatar
tokumaru
Posts: 11466
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru » Thu Apr 16, 2009 11:36 pm

MottZilla wrote:AxROM is PRG-ROM and CHR-RAM, with One Screen Mirroring. UxROM is the same think except it has fixed Horizontal or Vertical Mirroring.
And there is the big difference that AxROM uses 32KB PRG banks, while UxROM uses 16KB banks and has the last one hardwired to $C000-$FFFF, so they are more different than they are alike.

Post Reply