MagicEngine
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Japanese English 

How does sprite masking work?

 
Post new topic   Reply to topic    MagicEngine Forum Index -> General
View previous topic :: View next topic  
Author Message
ethylene
Member
Member


Joined: 19 Apr 2002
Posts: 51

PostPosted: Mon Jul 22, 2002 8:35 am    Post subject: How does sprite masking work? Reply with quote

I exchanged email with the coder of the TurboGrafx Phantasy Star project. One of the things I asked him was if he planned on implementing any kind of sprite masking, so that the characters could stand 'behind' parts of the background, like trees or other structures. His reply was:

"The Genesis had multiple background layers and the Sega Master System had a priority bit for each block in the background. The Turbo Grafx has neither, so I thought it would be more trouble than it's worth. There was some trick where you could overlap sprites and make the background come out on top (it might have on the NES and not the TG) so I guess it is something I could add eventually."

Genesis has an extra background layer over the Turbo, right. (Not with SuperGrafx, though, heh) SMS has a priority bit setting the Turbo lacks? That's a blow!

Anyway, I think I can see the trick he's talking about being used in games like Ys 4. In the MagicEngine emulator, switching off the background plane allows you to see weird black sprites covering the parts of the screen where the background ordinarily 'covers' the character sprite.

Anyone know this trick?

C2H4
Back to top
View user's profile Send private message
cgfm2
Visitor
Visitor


Joined: 23 Jul 2002
Posts: 9

PostPosted: Tue Jul 23, 2002 6:40 am    Post subject: Reply with quote

Sprite masking works by placing a low priority sprite behind the background, which comes first in the sprite list. When the VDC gets around to drawing a high priority sprite that comes later in the sprite list, it will not draw any pixels in the same locations where the low priority sprite was. So the low priority sprite acts like a mask against the high priority sprite, and gives the appearance of the background overlapping the sprite.

Most games like Y's and Neutopia will wait for the main character to get close to an obstacle like a tree or fence, and then place a low priority sprite over that obstacle. This prevents the main character sprite from being drawn, and it looks like the background is above your player.

A good example of this is in Dungeon Explorer in the inn at the start of the game. If you disable the background layer there is a little sprite that covers the bottom of the innkeeper, which makes him look like he is standing behind the table.

The NES has the exact same feature though it isn't used that much, since the sprites are much smaller and less of them can be displayed. But some games like Castlevania do use it. For that matter other systems like the Genesis can do this too, though as you said having the programmable priority bits for both background layers is a more common way of doing things.
Back to top
View user's profile Send private message Visit poster's website
ethylene
Member
Member


Joined: 19 Apr 2002
Posts: 51

PostPosted: Tue Jul 23, 2002 6:59 am    Post subject: Reply with quote

Ah! I see! Thanks very much for explaining that so well, I can totally visualize how it works now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    MagicEngine Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group