Masking (hidding) priority sprites, how?

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
eteream
Very interested
Posts: 81
Joined: Tue Dec 22, 2009 2:13 pm

Masking (hidding) priority sprites, how?

Post by eteream » Wed May 01, 2013 11:21 pm

Returning to old good times with some questions:

I read on "Sega Genesis VDP documentation" by Charles MacDonald that you can hide (or mask) sprites putting one of them on x=0, then all the horizontal lines witch the sprite resides are masked and no other further sprite will be drawn on those lines.

The problem is that this doesn't work on several emulators (Regen,Gens,Fusion), or may be I'm doing something wrong.

So I planned to use W to show player info, but I can't use planes A,B or W because I'm on high-priority (and high-light) mode. As now I'm using sprites, but I would like to know if the other solution is possible.

Changing the subject, one of the big steeps I done in my on going development is using some basic scripting, it transformed the code from a bunch of functions with lots of "if"s to some structured and easy to read/modify piece of little code. Is there any example of scripting on MD? or any study of a commercial game with scripting? An by scripting I mean something very basic, but functional (MD is 2MIPS, mostly used by the game!).

And finally a curiosity, anyone know why Outrun works at 15fps? when there are similar games on NES which run at 30 or 60fps.
(by fps I mean changing the contents of the screen)

Thanks for your help.

Charles MacDonald
Very interested
Posts: 292
Joined: Sat Apr 21, 2007 1:14 am

Re: Masking (hidding) priority sprites, how?

Post by Charles MacDonald » Thu May 02, 2013 2:45 am

eteream wrote:I read on "Sega Genesis VDP documentation" by Charles MacDonald that you can hide (or mask) sprites putting one of them on x=0, then all the horizontal lines witch the sprite resides are masked and no other further sprite will be drawn on those lines.
IIRC, put one sprite at X=0, and then another at X=1. For all scanlines where both sprites fall on the same line, the other sprites that come later in the sprite list will be masked. I think that's what Galaxy Force II does. The two sprites don't necessarily have to have the same Y position either, just so their heights overlap somewhere.

Sorry it's not documented more clearly, hardly any games use this function so there just aren't a lot of test cases. It always behaved weirdly for me in my own tests, and honestly it's been years since I looked at this.

If this doesn't work I can do some experiments and find settings that will work for you. We can solve this problem! :D

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Thu May 02, 2013 3:35 am

The masking sprite can't be the first sprite on the line. So you need another sprite earlier in the list on the same line as the masking sprite that has x > 0. It can still be offscreen though. I think Nemesis might have been the one to figure it out.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Thu May 02, 2013 12:58 pm

I used sprite masking in Glass Breaker MD, I accidentally stumbled upon it.
I moved all stuff that I did not need visible to X=0 and saw that I was losing sprites on the lines that the hidden ones occupied, so I started moving the sprites to Y=0 instead, but I kept some empty sprites at X=0 to make sure nothing goes on top of my status bar.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Charles MacDonald
Very interested
Posts: 292
Joined: Sat Apr 21, 2007 1:14 am

Post by Charles MacDonald » Thu May 02, 2013 5:05 pm

Mask of Destiny wrote:The masking sprite can't be the first sprite on the line. So you need another sprite earlier in the list on the same line as the masking sprite that has x > 0. It can still be offscreen though. I think Nemesis might have been the one to figure it out.
Well that's just so you can have several visible sprites on a line, and then mask out the remaining ones. If you always make it the first sprite on the line then nothing gets shown. But like in a status bar you may want to show 1 or 2 sprites first (say for indicators), then mask everything else so the game sprites don't appear in the status area.

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Thu May 02, 2013 5:37 pm

Charles MacDonald wrote:
Mask of Destiny wrote:The masking sprite can't be the first sprite on the line. So you need another sprite earlier in the list on the same line as the masking sprite that has x > 0. It can still be offscreen though. I think Nemesis might have been the one to figure it out.
Well that's just so you can have several visible sprites on a line, and then mask out the remaining ones. If you always make it the first sprite on the line then nothing gets shown. But like in a status bar you may want to show 1 or 2 sprites first (say for indicators), then mask everything else so the game sprites don't appear in the status area.
Nope. See this thread: viewtopic.php?t=541&postdays=0&postorder=asc&start=30
TmEE co.(TM) wrote:I moved all stuff that I did not need visible to X=0 and saw that I was losing sprites on the lines that the hidden ones occupied, so I started moving the sprites to Y=0 instead, but I kept some empty sprites at X=0 to make sure nothing goes on top of my status bar.
Using Y=0 is better for temporarily hiding a sprite anyway. Sprites that are offscreen still count against the per-line sprite limit (20 for H40 mode).

Charles MacDonald
Very interested
Posts: 292
Joined: Sat Apr 21, 2007 1:14 am

Post by Charles MacDonald » Thu May 02, 2013 7:33 pm

Cool, you're absolutely right.

Post Reply