Page 1 of 3

Movie Sprites

Posted: Thu Feb 04, 2016 10:01 pm
by PyTom
Just a heads up on a new feature I'm in the process of adding to Ren'Py. It's now possible to use code like:

Code: Select all

image eileen movie = Movie(channel="eileen", play="eileen.webm", mask="eileen_mask.webm")
to define what I'm calling a movie sprite. When shown with code as simple as:

Code: Select all

show eileen movie
You'll get:


This starts both movies playing, and uses the red channel of the mask movie as the alpha channel of the other movie. The result is an animated sprite that can have far more frames than would be possible with ATL, Animation, or other methods that have to load all images into ram at once.

For now, this only works on desktop (Window, Mac, Linux) platforms. There isn't a fundamental limit to the number of movie sprites Ren'Py can display at once, but it is limited by how fast the player's computer is. Memory consumption should be about 24 bytes per pixel, so a 400x720 animated sprite will take about 7 megabytes, although garbage collection may make it be a little more.

This provides a far-superior alternative to animated gifs (it's pretty easy to use ffmpeg to convert an animate gif into two webms, and the example I used is 15% the size of the gif equivalent), and provides a uniquely flexible animation format.

Right now, the new audio/video code is living on a git branch. Once I fix a slow memory leak, I'll add it to the nightlies, and I play to get a release with this out soon.

Thanks to renoa-heartily for the animated gif I converted, which can be found in this thread: http://lemmasoft.renai.us/forums/viewto ... 79#p364740

Re: Movie Sprites

Posted: Fri Feb 05, 2016 12:46 am
by Geckos
Awesome ^^

Re: Movie Sprites

Posted: Fri Feb 05, 2016 3:21 am
by AXYPB
To what extent can movie sprites be manipulated as with static displayables, and can a loop point be defined so as to not replay the entire video as shown in the example?

Re: Movie Sprites

Posted: Fri Feb 05, 2016 4:19 am
by Vaendryl
AXYPB wrote:To what extent can movie sprites be manipulated as with static displayables, and can a loop point be defined so as to not replay the entire video as shown in the example?
asking the important questions!
If I can use this inside a dynamic displayable there are so many neat things possible :D
this is something for ren'py 7 I assume?

Re: Movie Sprites

Posted: Fri Feb 05, 2016 4:23 am
by Meg'
That seems like a pretty cool feature! :D Thank you PyTom!

Re: Movie Sprites

Posted: Fri Feb 05, 2016 4:54 am
by Harliqueen
This looks like it's going to be an awesome feature! :D

Re: Movie Sprites

Posted: Fri Feb 05, 2016 9:21 am
by Voight-Kampff
Well that looks particularly awesome.

And yes, like AXYPB, I'm curious about the ability to loop.

Something I've always disliked whenever people have spites that are "animated" during a transition, or while "talking", is that the sprites typically stop moving during the interim. Nothing makes a character "die" faster than turning into a completely immobile, inanimate object (also makes it pretty jarring once they start moving again, as well).

So I'm wondering if we can generate sequences that can be looped in which the sprite constantly moves just a little bit—just a little bit of sway or shifting of their weight, etc.

Re: Movie Sprites

Posted: Fri Feb 05, 2016 11:03 pm
by uyjulian
Ooh, we get updated ffmpeg too?

Well, this will open up new possibilities.

Re: Movie Sprites

Posted: Sat Feb 06, 2016 6:40 pm
by SundownKid
I am curious... would there be a way to do lip flap in combination with this?

Like maybe playing two versions of the movie at the same time, one where the character is talking, and then swapping between them while the text is going on?

Re: Movie Sprites

Posted: Sat Feb 06, 2016 6:58 pm
by Alex
This sounds promising!

Re: Movie Sprites

Posted: Mon Feb 08, 2016 4:38 am
by OldGoateye
Wow, what a time to be checking in! This sounds like an incredibly cool and interesting feature; I can foresee many novels with mostly static/lip + blink animations, but suddenly one or two instances of full animation for key scenes... :D Fantastic!

Re: Movie Sprites

Posted: Thu Feb 11, 2016 2:50 am
by PyTom
Answering in near-random order, since it's late and I got confused as to the order of posts.
AXYPB wrote:To what extent can movie sprites be manipulated as with static displayables, and can a loop point be defined so as to not replay the entire video as shown in the example?
The only major problem would be that you have to define different channels for each movie sprite shown. This makes transitions - dissolving between two moviesprites using the same channel - hard, although you could get around this by allocating a new channel for each pose.
SundownKid wrote:I am curious... would there be a way to do lip flap in combination with this?

Like maybe playing two versions of the movie at the same time, one where the character is talking, and then swapping between them while the text is going on?
The best way to do this would be to play a lipflap movie when the character starts, and then transition it into a normal movie when talking is done.

You could plausibly play two (really four) movies, but movie playback can be expensive. So it's best to avoid playing too many at once.
Voight-Kampff wrote:So I'm wondering if we can generate sequences that can be looped in which the sprite constantly moves just a little bit—just a little bit of sway or shifting of their weight, etc.
Yes, things will loop by default. Obviously, you'd have to loop the animation proper - Ren'Py should just seamlessly play frames.
Vaendryl wrote:If I can use this inside a dynamic displayable there are so many neat things possible :D
this is something for ren'py 7 I assume?
It should work in a DD. It'll be out as soon as I finish debugging things, in 6.99.9.

Re: Movie Sprites

Posted: Thu Feb 11, 2016 4:49 am
by Kia
looks pretty good ^_^
would there be a way to use it in screens? I can think of few ways it would be useful, I've been waiting to see better masking options like this in the screen language.

Re: Movie Sprites

Posted: Thu Feb 11, 2016 11:48 pm
by PyTom
it should just work in screens.

Re: Movie Sprites

Posted: Fri Feb 12, 2016 12:23 am
by Kia
Well a character inside screens is not that useful. I meant something like this:

Code: Select all

Movie:
    channel "eileen"
    play "eileen.webm"
    mask "eileen_mask.webm"
    frame:
        something...
possibly with a way to control the animation of the movie and the mask. or better...

Code: Select all

frame:
    mask "eileen_mask.webm"
    text "something"
I asked for masks inside the screen language before but I think it gone unnoticed. ^_^