View Full Version : Automatic "transparency" ?

01-08-2007, 11:55 PM
I imagine this is handled by script but perhaps its something that might be an "automatic" feature like shadows.

Imagine you are a character in a top down game there is a wall in front of you (or a forest, whatever). When you walk around the wall and now have the wall between you and the player is it possible to make that wall transparent so that you can still the the character. One scenario for this might be when you walk into a house, instead of going to another level the "roof" becomes transparent...

So two questions:
1) is this doable via lua scripting (is there an opacity value)
2) might this be a property you set on a tile ("revealable" or something)

01-09-2007, 02:22 AM
You should hypothetically be able to set the opacity of any entity through scripting (though I haven't tested it.) Just as you would change an entity's color, you would change the alpha value which is the fourth color value (after red, green, and blue.) It can range from 0-255 (a byte.)

However, this would only work for changing the entire alpha (opacity) of an entity. Usually games instead dynamically reveal a section of an obstruction in a radius around the player. (Traditionally dithering was used, but alpha blending is cooler, perhaps not "old school" though.) Anyway, I don't know if this is possible at the moment. You'd probably need a special entity to indicate to the map render from where to subtract alpha.

01-10-2007, 06:16 PM
Use a new map layer, that can go transparent when someone is in a room?

01-10-2007, 07:58 PM
Er, the second paragraph was strictly hypothetical. That functionality probably doesn't exist in the engine yet. Also, I don't see a facility in the API to set the visibility of a layer (however, this should be trivial to implement.)

What can be done currently (I think) is to make a single entity translucent/transparent. If you wanted to, say, make an entire roof transparent you'd have to iterate over every entity composing the roof and set its alpha to 0. (The efficiency of this depends on how many entities compose the roof.)

I guess I should be useful and code an example. (will do later maybe)

Also, you can play with opacity yourself by opening up the editor, opening an entity's properties and changing the fourth number in its base color (which is alpha.)