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

Wavy sprite effect like in Boku Dacula-kun title screen

Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176210)
Whilst working on my emulator project to get VRC2/VRC4 games working, I couldn;t help but wonder how the wavy moon to monster sprite animation is implemented in the game Bocu Dracula-kun.

Anyone care to shed light on this? Is the PPU mid-frame scroll technique being used on a small region of the background here? Or is this a sprite effect?

Title animation:
Image
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176211)
It's background scrolling in a sinusoidal pattern. The same effect is used for warp zones in the port of Super Mario Bros. 2: Mario Madness in Super Mario All-Stars and for the title screen of Solar Wars. Try logging writes to $2005 and $2006 while that animation plays.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176214)
tepples wrote:
It's background scrolling in a sinusoidal pattern. The same effect is used for warp zones in the port of Super Mario Bros. 2: Mario Madness in Super Mario All-Stars and for the title screen of Solar Wars. Try logging writes to $2005 and $2006 while that animation plays.


I suspected so, but what about the static stars and tapering roof of the tower lying within the same horizontal band of the screen? Since they are not affected, are those sprites? Surely it isn't possible to alter just the scroll position of the rectangular region containing the moon graphics.

Edit: I also noticed a subtle parallax effect of the foreground roof where the hero is standing. I'm assuming this is done using the IRQ counter and splitting the screen. Very clever :)

Edit 2: Some quick hacks to highlight game sprites does reveal that the tower roof and stars in the middle horizontal band of the screen are in fact sprites.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176219)
Yeah, the background in that area is sprites. Note how there isn't much detail in that zone.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176229)
Just a suggestion, you can open this game in FCEUX and go to the menu and choose: Debug > Name table Viewer.

It will quickly let you see what is sprite and what is background.

Alternatively you can toggle the sprite or background layers individually: Config > Display > Graphics: BG / Graphics: OBJ


This is a pretty advanced title screen sequence. Lots of interesting interplay between sprites and background going on. (Thanks for sharing.)
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176244)
Quote:
I suspected so, but what about the static stars and tapering roof of the tower lying within the same horizontal band of the screen? Since they are not affected, are those sprites? Surely it isn't possible to alter just the scroll position of the rectangular region containing the moon graphics.

Actually such an effect would be perfectly possible, with mid-scanline $2005 writes. But you'd be limited to 7 pixels in depth of the wave, which is not the case here. To bypass this limit a combination of $2006 and $2005 writes would be necessary, and it'd be extremely though if not impossible to get it to display without garbage, not saying no current emulators would probably support it.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176245)
A few years ago, Bananmos wrote a proof-of-concept that generates a pixel-perfect midscanline split.

However, it generates exactly one midscanline split, so the effect is rather subtle.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176246)
I think my favourite part of this is how the tower and the rooftop do a vertical parallax, and it's by putting an extra slice of tower rows on the second nametable that it switches to for a few scanlines before switching back to the flat roof.

It lets the first nametable stay unchanged during the process (no moving the roof around), and it's important that the trees remain hidden as black during the transition, because they'd be sliced up by the inserted rows of tower.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176255)
lidnariq wrote:
A few years ago, Bananmos wrote a proof-of-concept that generates a pixel-perfect midscanline split.

However, it generates exactly one midscanline split, so the effect is rather subtle.

Have you tried it on a real NES? I actually did recently, and it's not just a single scanline that it splits. It had some glitches but still it was a pretty cool experiment. None of the emulators I tried came close to emulating it correctly.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176256)
I did run it on a real NES, which is how I finally understood what it was supposed to do :)

I should perhaps have said "a single scroll change done with pixel precision in the middle of a scanline", since it doesn't revert on later scanlines.

(I would have taken a picture and posted it in that thread, if I had had a flashcart with more than the 1 KiB that my m218 one does)
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176266)
rainwarrior wrote:
I think my favourite part of this is how the tower and the rooftop do a vertical parallax, and it's by putting an extra slice of tower rows on the second nametable that it switches to for a few scanlines before switching back to the flat roof.

It lets the first nametable stay unchanged during the process (no moving the roof around), and it's important that the trees remain hidden as black during the transition, because they'd be sliced up by the inserted rows of tower.


At first I was wondering why the copying of rows was needed.. thinking that it would suffice to have a static background name table and a static foreground one that is simply scrolled in with a moving IRQ counter split.. then I realised that before the flat roof pans up, the tower already occupies a whole nametable in height. I think I understand the trick now.. presumably the extra tower rows are held in the invisible bottom part of the flat roof nametable with a split done twice.

It makes one truly appreciate the resourcefulness of 8 bit game programmers of the time! :)
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176268)
lidnariq wrote:
I did run it on a real NES, which is how I finally understood what it was supposed to do :)

I should perhaps have said "a single scroll change done with pixel precision in the middle of a scanline", since it doesn't revert on later scanlines.

(I would have taken a picture and posted it in that thread, if I had had a flashcart with more than the 1 KiB that my m218 one does)


So essentially its impossible to do a vertical split on several scanlines then (leaving aside MMC5 for the moment).

On a related note, there is a test rom (scanline.nes) that tests PPU-CPU timing precision by hiding a column of asterixes on the right quarter of the screen by turning the PPU off and on at specific intervals dictated by CPU cycles. This seems to flicker slightly even on the best emulators and I'm thinking having a second nametable rendered in a vertical split would not work well due to the fetch cycles required. I believe the ROM in question is here: https://github.com/christopherpow/nes-test-roms/blob/master/scanline/scanline.nes
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176269)
colinvella wrote:
At first I was wondering why the copying of rows was needed.. thinking that it would suffice to have a static background name table and a static foreground one that is simply scrolled in with a moving IRQ counter split.. then I realised that before the flat roof pans up, the tower already occupies a whole nametable in height. I think I understand the trick now.. presumably the extra tower rows are held in the invisible bottom part of the flat roof nametable with a split done twice.

It's on the second nametable. There's no use of "invisible" parts of the screen, this intro remains perfectly fine if you show the top and bottom 8 pixels.

When the pan stops and the extra tower segment is no longer needed, the second nametable is then filled with the demon face instead.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176270)
colinvella wrote:
So essentially its impossible to do a vertical split on several scanlines then (leaving aside MMC5 for the moment).
Hmmm. Impossible? I dunno, it seems like once you've got one perfect cycle-timed mid-scanline split, putting a few more with constant relative spacing should be doable. As long as you have enough time to load and store all of the new values to the scrolling registers, or ≈28cy=84pixels.

Impractical? Yeah.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176612)
lidnariq wrote:
colinvella wrote:
So essentially its impossible to do a vertical split on several scanlines then (leaving aside MMC5 for the moment).
Hmmm. Impossible? I dunno, it seems like once you've got one perfect cycle-timed mid-scanline split, putting a few more with constant relative spacing should be doable. As long as you have enough time to load and store all of the new values to the scrolling registers, or ≈28cy=84pixels.

Impractical? Yeah.

341 px per scanline modulo 3 = 2. So, you wouldn't be able to line them up perfectly.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#176614)
But precise to within 2 pixels is good enough, because background tile fetches are aligned to multiples of 8 pixels. I just don't understand what Bananmos did well enough to be able to set it up on multiple scanlines.
Re: Wavy sprite effect like in Boku Dacula-kun title screen
by on (#185015)
That raster reminds me of this intro:

Image