Question about 8 sprite per scanline limit
Moderator: Moderators
Question about 8 sprite per scanline limit
Hey folks,
I'm just wondering, if I use 16x8 sprites do I still get 8 per scanline? Or because the sprites are double the width do I only get four?
The reason I ask is my ship is 3 sprites wide, bullet is 1 with max 2 bullets on screen so that only leaves me with two sprites for any enemies without having to code in some ugly flicker. If I get 8 bigger sprites that seems the way to go.
Sorry, I'd test it myself but not near my dev machine.
I'm just wondering, if I use 16x8 sprites do I still get 8 per scanline? Or because the sprites are double the width do I only get four?
The reason I ask is my ship is 3 sprites wide, bullet is 1 with max 2 bullets on screen so that only leaves me with two sprites for any enemies without having to code in some ugly flicker. If I get 8 bigger sprites that seems the way to go.
Sorry, I'd test it myself but not near my dev machine.
- FrankenGraphics
- Formerly WheelInventor
- Posts: 2064
- Joined: Thu Apr 14, 2016 2:55 am
- Location: Gothenburg, Sweden
- Contact:
Re: Question about 8 sprite per scanline limit
You don't get double width (unless you turn your monitor 90 degrees), you get double height.
Even if one sprite is made of two tiles in this mode, it's still one sprite. You get 8 per scanline, since the special internal/indirect scanline memory in PPU can hold up to 8 sprites.
16x8 8x16 mode increases the likelyhood of sprites intersecting the same scanline geometrically (since they're bigger), but lessens the amount of sprites doing so. It varies a lot if it's beneficient or not, depending on game design.
Edit: 8x16
Even if one sprite is made of two tiles in this mode, it's still one sprite. You get 8 per scanline, since the special internal/indirect scanline memory in PPU can hold up to 8 sprites.
Edit: 8x16
Last edited by FrankenGraphics on Tue Aug 08, 2017 8:20 am, edited 1 time in total.
- rainwarrior
- Posts: 8735
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Question about 8 sprite per scanline limit
Every NES emulator emulates the 8 sprite limit.mantanz wrote:Sorry, I'd test it myself but not near my dev machine.
- FrankenGraphics
- Formerly WheelInventor
- Posts: 2064
- Joined: Thu Apr 14, 2016 2:55 am
- Location: Gothenburg, Sweden
- Contact:
Re: Question about 8 sprite per scanline limit
^ that too. But i always seem to mix them up.
Re: Question about 8 sprite per scanline limit
The PC Engine's sprite system (which allows for 16 sprites on a scanline) counts sprites with double width as two sprites when it comes to the scanline limit. On the other hand sprite size is set per individual sprite, so you can mix and match sprite sizes however you want.
In Nintendo's consoles, sprite size is usually a global setting but each sprite is always counted as one sprite towards the scanline limit I think (I mean for Game Boy, SNES etc).
In Nintendo's consoles, sprite size is usually a global setting but each sprite is always counted as one sprite towards the scanline limit I think (I mean for Game Boy, SNES etc).
Re: Question about 8 sprite per scanline limit
Like the NES, the Game Boy has only one sprite width. But it allows ten 8-pixel-wide sprites on a 160-pixel-wide picture, or 50% coverage. This is twice the effective coverage of the NES, which allows eight 8-pixel-wide sprites on a 256-pixel-wide picture, or 25% coverage.
Like the TurboGrafx-16 (aka PC Engine), the Sega Genesis and Super NES have a sprite coverage limit close to 100 percent of a scanline. But they also limit total sprite count per scanline regardless of size. And because they allow 8-pixel-wide sprites, sprite count can become the limiting factor on a scanline that contains mostly 8-pixel-wide sprites.
Like the TurboGrafx-16 (aka PC Engine), the Sega Genesis and Super NES have a sprite coverage limit close to 100 percent of a scanline. But they also limit total sprite count per scanline regardless of size. And because they allow 8-pixel-wide sprites, sprite count can become the limiting factor on a scanline that contains mostly 8-pixel-wide sprites.
- Genesis in 256px mode: 16 sprites or 32 8-pixel-wide slivers
Coverage with 8x8 pixel sprites is 50%; coverage with larger sprites is 100%. - Genesis in 320px mode: 20 sprites or 40 8-pixel-wide slivers
Coverage with 8x8 pixel sprites is 50%; coverage with larger sprites is 100%. - Super NES: 32 sprites or 34 8-pixel-wide slivers
Coverage with 8x8 pixel sprites is 100%; coverage with larger sprites is 106%.
But because all sprites are square, sprites often have to include more blank space at the top or bottom, reducing coverage on adjacent lines. TG16 suffers from this as well because of the 16x16 pixel minimum sprite size.
Re: Question about 8 sprite per scanline limit
Ah sorry, I had my dimensions around the wrong way. Carry on, nothing to see here
Re: Question about 8 sprite per scanline limit
Ah you answered another question I had... whether sprites had to be at the exact same height or any part of them on the scanline would count.FrankenGraphics wrote:You don't get double width (unless you turn your monitor 90 degrees), you get double height.
Even if one sprite is made of two tiles in this mode, it's still one sprite. You get 8 per scanline, since the special internal/indirect scanline memory in PPU can hold up to 8 sprites.
16x88x16 mode increases the likelyhood of sprites intersecting the same scanline geometrically (since they're bigger), but lessens the amount of sprites doing so. It varies a lot if it's beneficient or not, depending on game design.
Edit: 8x16
Re: Question about 8 sprite per scanline limit
(deliberately off-topic trolling) Unless you're decided to target the VT03. That's like an NES but has a toggle to switch sprites to either 16-pixel wide 2bpp or 8-pixel wide 4bpp.
Re: Question about 8 sprite per scanline limit
I don't know for other Nintendo's consoles, but the SNES there is two limits, one for number of sprites (32 per line), and one for number of equivalent 8x8 sprites (34 per line). So it's effectively false to say each sprite is counted as one sprite towards the scanline limit. Using a size larger than 8x8 is basically hardware metasprites made of 8x8 sprites, and you only gets two extra 8x8 sprites per line doing that. Still better than nothing, considering 34 sprites allows to simulate for a horizontally scrolling background, wheras 32 sprites only allows to simulate a non-horizontally scrolling background.Pokun wrote: In Nintendo's consoles, sprite size is usually a global setting but each sprite is always counted as one sprite towards the scanline limit I think (I mean for Game Boy, SNES etc).
While this is true, the coverage doesn't indicate everything. For example if you know your metasprites are going to be 16x16, Gameboy only allows 5 objects, one more than the NES.This is twice the effective coverage of the NES, which allows eight 8-pixel-wide sprites on a 256-pixel-wide picture, or 25% coverage.
Re: Question about 8 sprite per scanline limit
Oh I see, it's not much different from PC Engine then which is also effectively using hardware metasprites to make bigger sprite sizes then the default one by combining neighbouring patterns in the pattern table into a metasprite. Although the PC Engine's smallest sprite size is 16x16 instead of 8x8 (which is both good and bad I guess).
I remember wondering about this for the longest time too. Everyone said "you can only have 8 sprites on a scanline". On a scanline? A sprite is bigger than a scanline so what does it mean exactly? Then I learned it means that more than 8 sprites can't have any of their pixel lines sharing the same scanline at the same time.Ah you answered another question I had... whether sprites had to be at the exact same height or any part of them on the scanline would count.
Re: Question about 8 sprite per scanline limit
As far as the PPU is concerned, sprites are only one scanline tall, because it draws the picture line by line. The PPU does a little math in order to know which lines of which sprites it has to show on each scanline (if scanline - sprite_y < sprite_height, that's the line to show), but it only has time to draw 8 sprite lines per scanline.
Re: Question about 8 sprite per scanline limit
Yeah that makes sense, thanks.
Re: Question about 8 sprite per scanline limit
A nice trick is to have each sprite one pixel below its neighbour, and it becomes possible to have as many sprites as you want diagonally, as there will always be exactly 8 sprites per line. This effectively allows to write any arbitrary text with sprites only, at the only "cost" that is should have this weird diagonal lining.
On the other hands, sprites partially hidden by the 8-sprites per scanline limitation are useful to partially hide sprites, as seen in Castlevania II - Simon's Quest when simon enters a swamp and his feet are hidden, for example.
On the other hands, sprites partially hidden by the 8-sprites per scanline limitation are useful to partially hide sprites, as seen in Castlevania II - Simon's Quest when simon enters a swamp and his feet are hidden, for example.