Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.
3 posts • Page 1 of 1
For one of my stages in my game with lava at the bottom, I'd like to create a sine wave movement pattern to make things look more interesting. However, my game is small and is based on very simple cart hardware so I use the DMC for raster effects. I know that I need to do this with timed code because for the effect to look nice I have to be able to change the X scroll every scanline, which is not possible with DMC IRQs alone. I have minimized the jitter from the uneven timing but there's still up to about half a scanline's worth of difference and I'd have to start my timed code at the same pixel (or close to the same pixel) every frame. Is there any way to do this without bringing sprite 0 into the picture? My only idea is that I'd wait for an IRQ a bit above the lava and then start polling the sprite 0 bit to get the proper timing, but I can't afford to risk missing one of these hits because I also need the sprite 0 bit to be set during the frame to wait for the end of Vblank at the end of the frame (needed for the IRQ timing adjustment).
Short answer : Probably not, the DMC only has approximate timing and can serve as a way to get a broad IRQ approximately before an expected sprite zero hit, but it does not replace the said sprite zero hit.Is there any way to do this without bringing sprite 0 into the picture?
Long answer : Actually it's possible to work around this by using 2 interrupts and measure time before the 1st one gets triggered and compensate for that. Look at Tepple's "letterbox" demo in order to have an example of how to achieve that. This is however highly non-standard and you shouldn't expect emulators or famiclones to behave correctly on this one.
Depending on what your game is you might not even need DMC at all, just run your game logic and poll sprite zero hit afterwards - however if your game logic takes too long then you'll have problems, while with DMC it's safer and you know that slow-downs will be handled correctly. So if you are afraid your game would slow down and you want the graphics to continue to look fine even through there is slow down, then keep your DMC system. (Plenty of games such as Super Mario Bros or Double Dragon have glitches when they slow down but they didn't care).
Then you have to set up your graphics so that there's a reliable sprite zero hit anyway, no ? Then I don't see how make it just before your lava section changes a thing - there's plenty of ways to make your sprite zero invisible, the most obvious one is to use a black sprite behind BG and on a background colour set to black, but that's not the only way.but I can't afford to risk missing one of these hits because I also need the sprite 0 bit to be set during the frame to wait for the end of Vblank at the end of the frame (needed for the IRQ timing adjustment).