Page 1 of 1

Layering images

Posted: Tue Dec 21, 2004 3:49 pm
by RedSlash
Does renpy support layering of images, that is to compose an image by layering multiple images on top of each other?

Posted: Tue Dec 21, 2004 4:22 pm
by PyTom
Yes. Just show multiple images.

Code: Select all

scene whitehouse
show eileen happy
show lucy happy
The pictures are shown with the newest on top. You can only have one picture with a given prefix (first part of the name) on screen at once, and showing a second picture with the same prefix places the new picture at the same point in the order as the old one.

So if I do a:

Code: Select all

show eileen upset
Lucy will still be on top of her. Hope this helps.

Posted: Tue Dec 21, 2004 8:50 pm
by Tage
Maybe RedSlash means, a transparent image that is placed over a faceless "model" to change the expression of a character while using less disk space at the same time. Sorry if that's what you just answered, but it didn't seem like it to me. :?

Posted: Tue Dec 21, 2004 8:55 pm
by PyTom
Oh.

The answer to that question is "not really". I'm sure one could do it with enough careful programming, but Ren'Py doesn't make it easy. I didn't see much of a need, as computer nowadays have enough ram and disk space to make this not worth the added complexity.

This is the same reason why I don't support color-keyed images, but instead only support formats with actual alpha channels, like PNG.

Posted: Tue Dec 21, 2004 9:38 pm
by RedSlash
Opps sorry, I guess I should've explained in more detail. Yeah, I meant to do what Tage is saying. But I just wanted to know if I could just slap layers of images on top of each other in general cause there might be other uses for that too. I didn't specifically say color-keying, but if the use of transparent PNGs on top of each other achieves the same effect, then thats fine.

People may have plentiful disk space around, but they may not have high speed modems though. I personally like to keep files small and save whenever I can.

Posted: Tue Dec 21, 2004 10:21 pm
by PyTom
Yeah, I thought about that. Theoretically, one could come up with a script that precomputed images from layers when the game was installed. This might save space on the download, but I'm not sure how much, if it would be enough to be worth it.

Posted: Wed Dec 22, 2004 6:23 am
by Grey
More than download size it means that the artist just has to edit one body if a change needs to be made.

If the expression isn't seperate then it means copying and pasting, resizing etc the same thing for however many expressions the character has.

Posted: Wed Dec 22, 2004 10:50 am
by rioka
Actually, RenPy can do what RedSlash wants to accomplish. The Love Revo system is based on a paperdoll method and it works fine on RenPy. (We're currently putting together the demo's on RenPy as our own engine is not finished.)

It saves a lot of space doing it the paperdoll method. Consider this: you have 4 expressions: neutral, happy, mad, sad. If it was the complete person, it could run about say 15KB per image. Total: 60KB. Now, take that and add in all the different outfits (let's say 4), it runs to 240KB.

Now, if you do the paperdoll method, you get 12KB for the body base, around the same for the each clothing at 12KB each, totaling 60KB. Each expression is about 8 KB, let's say. Grand total = 92KB.

It may not seem a lot but once you make something with a lot of characters or have high quality character images - it helps a lot.

Posted: Wed Dec 22, 2004 6:12 pm
by PyTom
Well, I'm convinced. I just added layer support to the latest version of Ren'Py. Basically, if you create an image using a constructor like:

Code: Select all

init:
    image eileen happy beret = Image(("9a_happy.png", "beret.png"))
Ren'Py 4.4 will now layer the images together. What's more, it will precompute the merged image, which should speed up performance over the layered approach.

I didn't know Love Revo was using Ren'Py, at least for a demo.

And in other news, dentistry is significantly less fun when the Novicane just doesn't work on you.

Posted: Wed Dec 22, 2004 8:36 pm
by RedSlash
Can you specify the position of the second layered image? Cause the second image may be smaller size, but you need to specify an offset to display it.

Posted: Wed Dec 22, 2004 9:22 pm
by PyTom
Not as of right now. The images are aligned to the upper-left corner of the base image. Since transparent areas compress really well, I think that this is an acceptible compromise that also keeps the feature fairly easy to use. (The idea is that the various paper doll parts will be the same size as the character, and so will align to the right spot without the user needing to get into pixel-by-pixel positioning.)

Posted: Wed Dec 22, 2004 11:19 pm
by rioka
Wow, thanks PyTom! That'll make things a whole lot easier. ^_^

We just decided on using RenPy fairly recently for Love Revo as both demo's have been coming along lately.
PyTom wrote:(The idea is that the various paper doll parts will be the same size as the character, and so will align to the right spot without the user needing to get into pixel-by-pixel positioning.)
Yup, that's what we're basically doing. All the expression's look like floating heads if viewed on their own. XD

Posted: Thu Dec 23, 2004 12:01 am
by PyTom
Cool. Let me know if there's any features that the Love Revo folks want. I've penciled the next release for Christmas, which gives me a day or two to add the new stuff.