It is currently Mon Oct 16, 2017 3:12 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Jul 04, 2016 8:45 am 
Offline
User avatar

Joined: Sun Jun 05, 2016 1:41 pm
Posts: 74
I noticed that some emulators, like Nestopia, handle sprite movement out of the top edge of the screen quite smoothly. A case in point is the intro for Dragon Ball Z - Kyoushuu! Saiya Jin (Japan), in which you see the Z logo (8x8 array of 8x8px sprites) scroll off the top edge smoothly, rather than disappear in 8-pixel wide strips.

I would think that the sensible way to handle this is to interpret the OAM sprite Y position range (240 .. 255) as a signed byte value (-16 .. -1) so that it is easy to calculate that the sprite is within scanline range when in scanlines 0 .. 7. The range 240..255 is invisible as a positive value anyway, however, for 8x8 and 8x16 sprites, this could be used to place them just beyond or straddling the top edge of the screen. Dragon Ball Z seems to use this and Nestopia handles it nicely. I have been less successful with my own implementation, but most likely it is a bug at my end.

What are your thoughts on this?

_________________
Tile IDE and tile engine for XNA: http://tide.codeplex.com/
Fancy Fish Mod - Minecraft Mod: http://fancyfishmod.weebly.com/


Last edited by colinvella on Mon Jul 04, 2016 12:46 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 8:52 am 
Offline

Joined: Mon Apr 01, 2013 11:17 pm
Posts: 437
Are you sure Nestopia isn't hiding the top 8 scanlines? It's pretty common for NES emulators to hide the top and bottom 8 scanlines.


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 9:30 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19081
Location: NE Indiana, USA (NTSC)
In theory, it should be possible to clip a sprite against the top of the screen in software the way Solstice clips everything against the level map. But I don't think any game bothered with that. They just relied on the top 10-16 scanlines just not being visible on consumer NTSC monitors. Many games clipped as a side effect of a top status bar, and those few games that did clipping without a top status bar (e.g. Jurassic Park) did so by switching to a blank CHR bank during the top few scanlines.

If you can spare 8 sprites, you can use those to clip sprites by placing them in front. Add a ninth and you can also use that to determine when to turn on background rendering.


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 12:36 pm 
Offline
User avatar

Joined: Sun Jun 05, 2016 1:41 pm
Posts: 74
Joe wrote:
Are you sure Nestopia isn't hiding the top 8 scanlines? It's pretty common for NES emulators to hide the top and bottom 8 scanlines.


Not sure to be honest, but I did monitor the Y sprite attribute as the Dragonball Logo crossed the top edge and I could see the Y value go down to 0 and then wrap around to 255. I'll need to test further

_________________
Tile IDE and tile engine for XNA: http://tide.codeplex.com/
Fancy Fish Mod - Minecraft Mod: http://fancyfishmod.weebly.com/


Last edited by colinvella on Mon Jul 04, 2016 12:47 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 12:42 pm 
Offline
User avatar

Joined: Sun Jun 05, 2016 1:41 pm
Posts: 74
tepples wrote:
If you can spare 8 sprites, you can use those to clip sprites by placing them in front. Add a ninth and you can also use that to determine when to turn on background rendering.


The logo is a composite 64x64 pixel sprite (save perhaps for missing corners since it is circular) and hence most likely, all sprites are used up. The background is split via the Bandai FCG mapper's IRQ counter, so that the bottom is a rolling sea, whilst the top part shows clouds scrolling out off the horizon. Hence, I doubt it is using IRQ trickery for the top 8 pixels, but I could be wrong.

_________________
Tile IDE and tile engine for XNA: http://tide.codeplex.com/
Fancy Fish Mod - Minecraft Mod: http://fancyfishmod.weebly.com/


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 12:44 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5703
Location: Canada
colinvella wrote:
I would think that the sensible way to handle this is to interpret the OAM sprite Y position range (240 .. 255) as a signed byte value (-16 .. -1) so that it is easy to calculate that the sprite is within scanline range when in scanlines 0 .. 7. The range 240..255 is invisible as a positive value anyway, however, for 8x8 and 8x16 sprites, this could be used to place them just beyond and straddling the top edge of the screen. Dragon Ball Z seems to use this and Nestopia handles it nicely. I have been less successful with my own implementation, but most likely it is a bug at my end.

No, the sprites simply do not wrap. Games rely on the fact that placing a sprite at Y=255 makes it appear offscreen.

As stated, on NTSC the top/bottom ~8 lines are hidden, so the problem isn't visible with 8x8 sprites. On PAL the whole screen is visible, and you can see sprites cut off in games with vertical scrolling.


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 12:52 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5703
Location: Canada
colinvella wrote:
Not sure to be honest, but I did monitor the Y sprite attribute as the Dragonball Logo crossed the top edge and I could see the Y value go down to 0 and then wrap around to 255. I'll need to test further

Lots of games places sprite Y anywhere from 239 to 255. That doesn't mean they're trying to make them appear at the top of the screen. The NES doesn't do that. All of these Y values mean "offscreen".

It might be convenient for a game to use that whole range of numbers, e.g. you could have an enemy that wraps around as it moves off the top and returns from the bottom, so you're going to see games that do it. It doesn't matter, though, because no sprites from that range will display.


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 1:06 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6272
Location: Seattle
I think colinvella is asking whether it would be a nice augment (the same as the "allow more than 8 sprites per scanline") to treat slightly-negative Y scroll values as off-the-top.

To which I basically have three thoughts:

1- Games probably don't actually comply with that definition, but you won't know if you don't try it
2- It should really only be thought as applicable to PAL consoles anyway, since NTSC televisions already treat small positive values as off-the-top.
3- There should definitely be a toggle for "authentic" behavior instead of "better than reality" behavior.


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 1:11 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5703
Location: Canada
Oh sure, as an option that's not on by default it's perfectly reasonable.

It would still apply to NTSC cropped output when in 8x16 mode, too.


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 1:56 pm 
Offline
User avatar

Joined: Sun Jun 05, 2016 1:41 pm
Posts: 74
rainwarrior wrote:
Lots of games places sprite Y anywhere from 239 to 255. That doesn't mean they're trying to make them appear at the top of the screen. The NES doesn't do that. All of these Y values mean "offscreen".

It might be convenient for a game to use that whole range of numbers, e.g. you could have an enemy that wraps around as it moves off the top and returns from the bottom, so you're going to see games that do it. It doesn't matter, though, because no sprites from that range will display.


Thanks for the clarification. As suggested in another comment, it was mostly a consideration about an aesthetic improvement provided by the emulator, such as, for example, the ability to allow unlimited sprites and not signalling an overflow to prevent flicker (which I am aware, may actually break some games that rely on overflow).

I will look into the idea of clipping the top 8 rows of pixels.

_________________
Tile IDE and tile engine for XNA: http://tide.codeplex.com/
Fancy Fish Mod - Minecraft Mod: http://fancyfishmod.weebly.com/


Last edited by colinvella on Mon Jul 04, 2016 1:59 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 1:58 pm 
Offline
User avatar

Joined: Sun Jun 05, 2016 1:41 pm
Posts: 74
lidnariq wrote:
I think colinvella is asking whether it would be a nice augment (the same as the "allow more than 8 sprites per scanline") to treat slightly-negative Y scroll values as off-the-top.

To which I basically have three thoughts:

1- Games probably don't actually comply with that definition, but you won't know if you don't try it
2- It should really only be thought as applicable to PAL consoles anyway, since NTSC televisions already treat small positive values as off-the-top.
3- There should definitely be a toggle for "authentic" behavior instead of "better than reality" behavior.


Pretty much on the same wavelength there. Indeed, I have already implemented the 8 sprite per scanline override, but as an aesthetic option that is disabled by default.

_________________
Tile IDE and tile engine for XNA: http://tide.codeplex.com/
Fancy Fish Mod - Minecraft Mod: http://fancyfishmod.weebly.com/


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 1:59 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19081
Location: NE Indiana, USA (NTSC)
A lot of games would need to be hacked to output these negative values. I know that the metasprite decoder in Haunted: Halloween '85 just skips any horizontal strip whose top isn't within 1-239 pixels from the top of the screen.


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 2:02 pm 
Offline
User avatar

Joined: Sun Jun 05, 2016 1:41 pm
Posts: 74
Incidentally, I can confirm that Nestopia, for instance, clips both the top and bottom 8 pixels, regardless of mirroring mode, scrolling etc. That explains why I couldn't eliminate a number of artefacts.

_________________
Tile IDE and tile engine for XNA: http://tide.codeplex.com/
Fancy Fish Mod - Minecraft Mod: http://fancyfishmod.weebly.com/


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 2:14 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
The "clipping Nestopia does" is under Options -> Video. Specifically, you're allowed to define the visual screen area for both PAL and NTSC based on horizontal (scanline) and vertical pixel row. The defaults are:

PAL: Left = 0, Right = 255, Top = 1, Bottom = 239
NTSC: Left = 0, Right = 255, Top = 8, Bottom = 231

This looks correct (i.e. like correct behaviour) to me.


Top
 Profile  
 
PostPosted: Tue Jul 05, 2016 12:11 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7223
Location: Chexbres, VD, Switzerland
Quote:
This looks correct (i.e. like correct behaviour) to me.

Nope, PAL should default to Left=2 and Right=253, and I believe to Top=0.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group