How many times can the NES change scrolling in a frame?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
Marscaleb
Posts: 240
Joined: Fri Sep 11, 2015 10:39 am
Contact:

How many times can the NES change scrolling in a frame?

Post by Marscaleb »

Another kind-of-random question that came to my mind, reflecting on some things I've seen in the games of my youth...

I remember a few years ago noticing a particular effect that seemed to be commonly used in Game Boy Color games, and at the time I kind of wondered what was so special about the hardware that led to so many games using it.
Now I understand exactly what the system is doing for this effect, and can recognize the many ways in which the same trick was used in so many other games on the NES, SNES, and so on.
The effect in particular can be seen here: https://youtu.be/UdVJY1gs6n4?t=21281
It is, of course, simply changing the point where it is drawing the background after each scanline. It's how NES games had nifty scrolling effects where clouds could fly by faster than the rest of the scenery, its how the SNES had nifty effects like the dancing flames in the background of the first stage of Dracula X, or the wavy water distortion effects in Magical Quest and Demon's Crest.

By the way, does this technique have a name? Is there some word or term I can use to refer to it without giving examples or explaining in detail how the system is drawing a different part of the background?

At any rate, this effect has seemed so brilliant and cool now that I understand what is going on, and it's great to see the many different ways people have used it to pull off interesting results.
But when I think about it and look back, I don't see it used too often in one frame on the NES. Sure, it gets used a lot to have things like status bars and to divide backgrounds to have elements scroll at different speeds, but I can't think of any situations where it was used for the cool warping effects I've seen on later hardware. This strikes me as a little odd, because really, it is such a fundamentally simple effect that I would think the NES should be able to use it more frequently. I mean, even to draw a boring stationary background, the system still has to change where the image is drawn from for each scanline anyway, or else you'd have 224 identical scalines.
So why did we never see the NES make an underwater level have a wavy distortion effect by moving that draw point a little in the X value every line? Was there actually some kind of limit that kept the system from changing the starting point too many times? Is this just too computationally intense to be done in the H blank and still be able to calculate the rest of the game's code in a single frame? And why was the Game Boy able to do this for every horizontal line when it was in many ways inferior hardware? (Granted doing the whole screen meant fewer lines, but still.) Or was it capable, but just that nobody thought to do it for whatever reason?
User avatar
toggle switch
Posts: 139
Joined: Fri Sep 30, 2016 8:57 pm

Re: How many times can the NES change scrolling in a frame?

Post by toggle switch »

recca comes to mind....

you can see it in this vid about 3 minutes in:

https://www.youtube.com/watch?v=nfY79-3AdGY
User avatar
Broke Studio
Formerly glutock
Posts: 181
Joined: Sat Aug 15, 2015 3:42 pm
Location: France
Contact:

Re: How many times can the NES change scrolling in a frame?

Post by Broke Studio »

My first game : Twin Dragons available at Broke Studio.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How many times can the NES change scrolling in a frame?

Post by tepples »

The limit to how much line scrolling you can do on the NES is CPU time. Changing the scroll on consecutive lines takes essentially the CPU's full attention. It's not like the Genesis, whose VDP could read a scroll position table from VRAM, or the Super NES, whose CPU had a DMA controller that could rewrite the scroll registers every scanline out of a table in RAM. This is why you most often see it done for only part of the screen, as in Slalom or Rad Racer.
User avatar
Marscaleb
Posts: 240
Joined: Fri Sep 11, 2015 10:39 am
Contact:

Re: How many times can the NES change scrolling in a frame?

Post by Marscaleb »

toggle switch wrote:recca comes to mind....

you can see it in this vid about 3 minutes in:

https://www.youtube.com/watch?v=nfY79-3AdGY
Image
tepples wrote:The limit to how much line scrolling you can do on the NES is CPU time. Changing the scroll on consecutive lines takes essentially the CPU's full attention. It's not like the Genesis, whose VDP could read a scroll position table from VRAM, or the Super NES, whose CPU had a DMA controller that could rewrite the scroll registers every scanline out of a table in RAM. This is why you most often see it done for only part of the screen, as in Slalom or Rad Racer.
That would make sense why it wasn't seen in game too often. Of course, that relegates questions like "why they didn't use it in X situation" like the warp effect in Dragon Warrior (where it wasn't during game play and thus could be done without impacting anything) comes down to "they just didn't think to use it," which is both disappointing and hard to really confirm.

But at the same time, the two example shown above managed to pull off that effect across most of the screen while in the middle of gameplay, so it seems like it should be possible, just not optimal.
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How many times can the NES change scrolling in a frame?

Post by rainwarrior »

Marscaleb wrote:Of course, that relegates questions like "why they didn't use it in X situation" like the warp effect in Dragon Warrior (where it wasn't during game play and thus could be done without impacting anything) comes down to "they just didn't think to use it," which is both disappointing and hard to really confirm.
I don't think that's fair to assume, at all.

It's not trivial to implement, and 1000x less so when you take 30 years of reverse engineering and emulation tools off the table. "Didn't think to use it" is extremely dismissive of the amount of work required. Even if it's a small amount of code, it's a lot of work to tune to get working properly. That's all assuming you even know how to do it to begin with.

...and that's assuming they even have practical hardware for it. Dragon Warrior (1989) didn't have an IRQ (MMC1), which makes the problem a lot harder than with later hardware. Recca (1992) has an MMC3, and it's literally a different generation of machine.

Even if you have the knowledge, tools, skills, and hardware at your disposal, it still takes time to design a situation that uses it. It takes ROM space to implement. It takes accompanying graphics, etc. to use it, and most of all it takes up developer's time, which was always a limited resource. The question you must ask as a commercial game developer is not "Can I do a wavy background?" but "Is there something else that is worth more than a wavy background?" It's a question of whether you think this is a good use of resources. Every thing you put into a game takes away a multitude of other potentials.
User avatar
Dwedit
Posts: 4921
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: How many times can the NES change scrolling in a frame?

Post by Dwedit »

Recca actually waits at least 4 scanlines between each scroll change, so it doesn't use all that much CPU, and it also does not need to be accurately timed because of how chaotic the background is.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Bregalad
Posts: 8055
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: How many times can the NES change scrolling in a frame?

Post by Bregalad »

By the way, does this technique have a name?
Isn't if called wavy effect or something like that ?
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: How many times can the NES change scrolling in a frame?

Post by Sumez »

Typically I just see effects that are created via code timed to specific scanlines referred to as, well, "scanline effects".
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How many times can the NES change scrolling in a frame?

Post by rainwarrior »

"raster effect" is also common
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: How many times can the NES change scrolling in a frame?

Post by Sumez »

Kind of misleading though, considering raster typically refers to pixel/bitmap manipulation?
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: How many times can the NES change scrolling in a frame?

Post by tokumaru »

The word "raster" refers to the scanning nature of CRT displays, which draws pictures one line at a time, and these effects are achieved by manipulating rendering parameters each line, so I think that "raster effect" is a very appropriate name.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: How many times can the NES change scrolling in a frame?

Post by FrankenGraphics »

I don't think it is quite that simple. The word has undergone several semantic shifts. If we skip the latin roots, and focus on its modern use, it is simply from the german word raster (which means screen). It has then been associated with scanlines. But in recent modern usage, "raster" is mostly used to differentiate "raster graphics" from "vector graphics", which in todays' tools is just the difference between pixel bitmaps and algorithmic drawing. So if you talk to someone working with digital graphics today, they do not associate the word with scanline technology, but with bitmaps. While technically correct to call it "raster affects", sumez is right that this would cause confusion.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: How many times can the NES change scrolling in a frame?

Post by tokumaru »

But raster graphics get that name because they are composed of discrete units arranged as lines, it's the exact same meaning as in a raster display, I don't see any conflicts there. If a person can only think of the word "raster" as a distinction from "vector", then that's their problem, "raster effects" are effects achieved by manipulating the data sent to a raster display, and it's OK if not every graphic designer that deals with raster and vector graphics knows that, specially if they're not into retro gaming.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: How many times can the NES change scrolling in a frame?

Post by FrankenGraphics »

You're right. In a technical sense, this is where it comes from. But the use of "raster" as a distinction from vector graphics in graphics editors like illustrator, indesign and photoshop would far more common than the use within small retro computing scenes. It's not an argument why one should be preferred over the other, just an explanation to why there's risk of confusion.

"raster effects" in an illustrator context would refer to effects only available if you rasterize (ie bitmap convert) your objects, such as photoshop filters and the like. So here, we're talking about per pixel manipulation, rather than per line. So it wouldn't surprise me if "raster effects" would give people the idea that it's about per pixel manipulation... maybe software generated tiles or sprite masking in a NES context. It's not crystal clear without further research. So, if you're writing a tutorial i think it's best to include a short and sweet explanation if you use the term "raster effect", and an author of a wiki article using the term may want to link it to an article on the subject of raster/scanline effects themselves.
Post Reply