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

How does Wizards and Warriors 3's status bar work?

How does Wizards and Warriors 3's status bar work?
by on (#14314)
How does Wizards and Warriors 3 manage to have a status bar at the bottom of a vertically scrolling screen without the help of an MMC3? It looks like there's a sprite in the bottom row of the graphics, but how can you guarantee a sprite 0 hit when the background scrolls in all directions?
Re: How does Wizards and Warriors 3's status bar work?
by on (#14320)
Dwedit wrote:
how can you guarantee a sprite 0 hit when the background scrolls in all directions?

One way is by drawing an opaque tile at the bottom left corner of the playfield.

by on (#14324)
The Guardian Legend uses the same trick, and it's quite visible too.

by on (#14325)
But in fact, the bottom right corner is slightly less visible because the NES picture is offset two pixels to the right.

NES Scrolling Test by Lasse Öörni (Cadaver) displays the technique, but it's slightly glitchy on Nintendulator because like the NES, Nintendulator doesn't recognize sprite 0 overlaps in column 255.

by on (#14327)
I just watched the name table viewer carefully... It copies the original tile graphics to a specific tile number, changes the tile number for the lower-left corner, and plots a single PIXEL in that special tile. That single pixel collides with a single pixel sprite. Wow.

by on (#14329)
Since you make sure you never have 8 consecutives BG color pixels in the playfield, it will cause no problems to have a sprite zero hit with some 8 pixel tolerance (anyway, the tolerance so that the hit check loop is larger then 8).
I think the best way is to make sure to never have 4 horizontal consecutive BG color in your whole tileset.

by on (#14332)
I think Big Nose Freaks Out also places a solid tile, by the right bottom corner.

I think you have to be really careful with that trick, because even if you make sure the sprite hit will happen, you must also be sure that game logic will never go beyond the place where the hit is to happen.

I was planning on turning the screen off early for a project, by having a sprite 0 hit on the last scanline, but am afraid that the calculations during the frame may take too long.

by on (#14335)
You're right, however there are game engines especially designed to be fast (Konami games ?).
However, in your case, that would just wait until the hit in the next frame, causing a slowdown that would happen anyways.

by on (#14337)
Bregalad wrote:
that would just wait until the hit in the next frame, causing a slowdown that would happen anyways.

Worse than the slowdown is the fact that the bottom part, that should be hidden, will be displayed for a frame, causing flicker and possibly exposing undesired/incorrect tiles/attributes.

by on (#14338)
Yeah... at least the game wouldn't frezee.

by on (#14339)
tokumaru wrote:
you must also be sure that game logic will never go beyond the place where the hit is to happen.

I was planning on turning the screen off early for a project, by having a sprite 0 hit on the last scanline, but am afraid that the calculations during the frame may take too long.

If you aren't using DPCM sound, you could borrow its IRQ for timing the sprite 0 hit. Start a DPCM playback in the vblank NMI, with a length such that it finishes a few scanlines before sprite 0. Then wait for sprite 0 inside the IRQ handler and do the PPUSCROLL/PPUADDR magic. But then you have to use an emulator that supports the game Fire Hawk if you want any accuracy.

by on (#14361)
How to do this without hearing sound glitches ?
Hey, this has gotten me an alternate idea. Before the screen loads, wait a given number of cylces and write the value #$80 to $4017 to enable IRQ and use 4-step sequcne.
Then the interrupt will continue to reliably happen each frame when the game logic goes on. Unfrotuntaly, I think the frequencey is a very bit shorter than the 60Hz framerate, so something to compensate this is needed (re-write to $4017 after wait the difference of time between screen and APU).

by on (#14365)
Bregalad wrote:
How to do this without hearing sound glitches?


Use a DMC sample that's all $00 bytes and write 0 to $4011 at startup.

Quote:
Hey, this has gotten me an alternate idea. Before the screen loads, wait a given number of cylces and write the value #$80 to $4017 to enable IRQ and use 4-step sequcne. Then the interrupt will continue to reliably happen each frame when the game logic goes on. Unfrotuntaly, I think the frequencey is a very bit shorter than the 60Hz framerate, so something to compensate this is needed (re-write to $4017 after wait the difference of time between screen and APU).


Yeah, I tried to work this approach out a while back but was foiled by the APU's frame rate being slightly lower than the PPU's. If it were the other way around, it'd work out since you could reschedule the interrupt for the next frame slightly before the current scanline, after you had found a sprite #0 hit at the exact moment. Oh well.

by on (#14367)
Quote:
Yeah, I tried to work this approach out a while back but was foiled by the APU's frame rate being slightly lower than the PPU's. If it were the other way around, it'd work out since you could reschedule the interrupt for the next frame slightly before the current scanline, after you had found a sprite #0 hit at the exact moment. Oh well.

Sorry, I was really thinking it was the other way arround for some reason. That's a lame.

by on (#14375)
blargg wrote:
Yeah, I tried to work this approach out a while back but was foiled by the APU's frame rate being slightly lower than the PPU's. If it were the other way around, it'd work out since you could reschedule the interrupt for the next frame slightly before the current scanline, after you had found a sprite #0 hit at the exact moment. Oh well.

But on PAL...

by on (#14429)
Well, it would be ONLY on PAL, and I'm afraid I don't want to use stuff that works only on PAL systems.
Also, would the lenght of the DPCM sample should be changed from NTSC to PAL from your above example ?
DMA is done in some division of the main clock, so it shouldn't change the lenght, but since DPCM period values aren't the same in PAL than NTSC, it would still have to be corrected.