Masked sprites

Request patches for Keens 1-3.
Post Reply
User avatar
levellord
Crazy pAtChEr
Posts: 1401
Joined: Thu Nov 20, 2003 11:35 pm
Location: NewZealand
Contact:

Masked sprites

Post by levellord »

As you know by making the sprite mask different colours you can do some interesting effects with sprites in Keen (Such as sprites that look like shadows or change colour depending on their background.)

However while looking at the Keen 1 code I found that there was no way for the program to handle colour masks. Subsequent investigation shows that the program does masks in black or white.

Is this just a problem with modkeen, or the program? Is there any way around this?
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

Um, what's actually the problem? :) Isn't it a good thing it works, and maybe you haven't noticed all the code, because the stuff works.. Hmmm..
User avatar
XkyRauh
Posts: 1114
Joined: Sun Aug 31, 2003 9:14 pm
Location: San Diego, California

re: color masks

Post by XkyRauh »

You're probably thinking of SNES-style color masks... where if a sprite passes under, say, a green color mask, the white tints to a bright green, the red tints to a brown, the blue becomes a sort of turquose/teal, and so on. Not possible with our Keen:Vorticons engine. Why? Because we're working with the EGA palette--16 colors! You can't do an RGB style addition and subtraction of the palette when you've only got 16 colors!

The best you can do is some trial and error with different colors as masking tiles and come up with an effect that you think looks good. Full on SNES-style masking would require a 256+ color engine.

--Xky
User avatar
levellord
Crazy pAtChEr
Posts: 1401
Joined: Thu Nov 20, 2003 11:35 pm
Location: NewZealand
Contact:

Post by levellord »

No I'm NOT talking about masked TILES (although they have neat effects)
Just as the mods use coloured tile masks for neat effects, (The origionals used only black and white.) sprites in Keen2-3 can be given colour masks. The sprites colour then depends on what background it is shown against.

As an example make the vorticons mask in Keen 2\3 dark red and see what happens. I want the same effect in Keen 1
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

I see - but at least all that works on my Keen 1.. Sure you have version 1.31? Though I think it works with older version too..
Too bad iD didn't use this feature..
User avatar
XkyRauh
Posts: 1114
Joined: Sun Aug 31, 2003 9:14 pm
Location: San Diego, California

re: Masked Sprites

Post by XkyRauh »

Sorry for the misunderstanding--and also sorry that I can't help with this at all. Thanks for clearing me up quickly though. ;-)

--Xky
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin »

All the Keen games use a 1-bit mask to indicate transparency or opacity for sprites: so the mask can actually only be "black" or "white".
Modkeen looks for black in the mask to indicate opaque pixels; anything else ends up transparent. So your sprite with the mask filled with dark red ends up just as if you'd filled the mask with any other colour (excluding black), or made the whole mask white. Try it, you'll see.

The reason you get semi-transparent effects when the mask indicates transparency is due to the compositing that the Keen engine does when drawing the sprites. In essence, it does a bitwise AND of the mask with the screen (which essentially keeps the darkest colours of each--keeping in mind that the mask is only black or white), and then a bitwise OR of the sprite image (which essentially keeps the brightest colours).
Post Reply