Ren'Py Image sequences for animation - good, bad, or ugly?

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,896
2,875
One of the things that vexes me about Ren'py (ok, not specifically about Ren'py but about the difference between Mac/Win/Linux and Android) is the need to create animations in two formats, webm for the first group, and mp4 for the second. Recently I have been playing around with animating image sequences, ala this ...

Code:
image ep2_mc_shane_side_sex:
    "ep2_mc_shane_side_sex000"
    pause 0.05
    "ep2_mc_shane_side_sex001"
    pause 0.05

...

    "ep2_mc_shane_side_sex015"
    pause 0.05
    repeat
This seems to play well on my test unit, but admittedly I have a very powerful machine (Xeon E5 with 8 cores) with decent video GTX 760. The sizes of the animations actually shrink when this is done because only the frames that need to loop need to be included, and only once. Are there any negatives to just doing my animations as animated image sequences that anyone has run across? I'd like to hear experiences of others if you have tried this approach and run into problems. Thank you.
 

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,896
2,875
I don't know about animated image sequences but I have managed to run mp4 in android.
Yeah, I know that. But that means I have to swap out the videos and do them webm for the other platforms and mp4 for Android only. So I am wondering if just doing animated image sequences is a leaner, cleaner approach.
 

Egglock

Member
Oct 17, 2017
198
110
If I'm not mistaken, the only thing you lose out on by doing it that way, is the file size will be bigger.
 

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,896
2,875
Actually, the file sizes are ending up much smaller, because with the video in order to display even a minute or two, the file is much larger than just the frames that, when set to a repeat, play the entire animation in a loop. So doing it in a frame sequence turns out to be leaner than doing it in a movie with either webm or mp4.
 

Jon_Sleeper

Member
Nov 14, 2018
284
364
Yeah, I know that. But that means I have to swap out the videos and do them webm for the other platforms and mp4 for Android only. So I am wondering if just doing animated image sequences is a leaner, cleaner approach.
mp4 works for all platforms not just for android last time I checked. I haven't done image sequences myself but I have seen it in several games and they tend to be lot less smoother than the video counterpart but again that depends on the number of frames and other factors like time delay. Try both and decide based on what seems more smoother.
 

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,896
2,875
Case in point, I uploaded 2 webm movies, one at 15 fps and one at 30 fps for the last animation for Episode 1. Together, the two files came to 35 MB. All 19 frames that comprised that video came to just over 28 MB -- and there is no compression/decompression penalty because the frames are fully uncompressed. And since I only have to do it once for both platforms, it's less work for me -- one and done. Is there any reason this is a bad idea?
 

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,896
2,875
mp4 works for all platforms not just for android last time I checked. I haven't done image sequences myself but I have seen it in several games and they tend to be lot less smoother than the video counterpart but again that depends on the number of frames and other factors like time delay. Try both and decide based on what seems more smoother.
I think a lot of the choppy playback you're seeing is because people did animations with big breaks in between each frame. Most of my animations, even sex animations, are running around 20 frames to create a smooth looping animation with no hiccups. I just was wondering if there was anyone who had it run smoothly on their machine to find others who had poor results.
 

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,896
2,875
mp4 works for all platforms not just for android last time I checked. I haven't done image sequences myself but I have seen it in several games and they tend to be lot less smoother than the video counterpart but again that depends on the number of frames and other factors like time delay. Try both and decide based on what seems more smoother.
All the developers are recommending that videos in Ren'py should be done in the webm package, wtih V9 encoding. That's pretty standard. It just has to be dumbed down for Android. I'd rather avoid doing double work if I can, and if there is no compelling reason to do it a different way.
 

Avaron1974

Resident Lesbian
Aug 22, 2018
25,858
89,136
The only thing I know about animations is I wish those that don't know how to do them well would stop doing them.

Those jumpy stop frame animations look shit and ruin the scenes. Every single scene in Dreams of Desire looked shit and all the games that did it since.

Doesn't help that, trying not to hurl abuse as I keep getting warnings so we'll just call them "people" to be diplomatic, keep asking for them and I start playing a game just to see jumpy shitty half arsed abominations and I end up deleting it.

It's like watching 2 fish out of water flopping around on top of each other under a strobe light.

I start a scene, it's hot, I get nice and wet and get ready to jill myself to sexual bliss only for that janky crap to start and instantly my vagina's as dry as the fucking Sahara. It's done wonders for my battery conversation, less so for my sexual needs and when my girls at work and Ava's got the horn it's a struggle to find something that doesn't turn me off faster than Midget zoophilia.
 

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,896
2,875
The only thing I know about animations is I wish those that don't know how to do them well would stop doing them.

Those jumpy stop frame animations look shit and ruin the scenes. Every single scene in Dreams of Desire looked shit and all the games that did it since.
There is a huge difference between stop frame animation, which is what you are talking about, and image sequence animation, which I am talking about. With true image sequence animation, especially if the timing is done correctly, you can't tell the difference between it and a movie -- the two are virtually indistinguishable. You are absolutely right about clunky frame sequences with huge gaps in between each one, and I totally agree with you, they are terrible, and it would be better not to try to animate if you're only gonna go halfway. I just wanted to get feedback if anyone had tried doing regular image sequence animation and had any particular problems with it or not. I do have an incomplete beta that has 8 animations in it already that I would be willing to give beta testers if they would like to give me feedback on the animation part of the question.
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,565
7,376
I think a lot of the choppy playback you're seeing is because people did animations with big breaks in between each frame. Most of my animations, even sex animations, are running around 20 frames to create a smooth looping animation with no hiccups. I just was wondering if there was anyone who had it run smoothly on their machine to find others who had poor results.
One of the main things with creating an animation with a large sequence of images is that you're putting a strain on Ren'py's image prediction, caching and loading. Ren'py tries to avoid stutters in game flow by predicting what images are going to be displayed after the next user interaction and preloading them into an image cache. The size of the cache, however, is typically only configured to hold the equivalent of something like 8 screens worth of data.

What this means is that if you do a full-screen animation as an image sequence, and if you have more than 8 images, Ren'py's going to run into a series of cache misses, and have to be loading the images from disk in real time. Images take a non-zero amount of time to load, so depending on the frame rate and the performance of the system on which it's being played, this can cause stuttering during the playback. Thus, Py'Tom generally only recommends this type of animation where the number of images is comparatively small, and where the images are small, so that they can all fit in the cache.

Now, having said that, things will usually be OK on an awful lot of PC's, because their performance is generally pretty good. Android might be more of an issue - I don't do Ren'py on Android, so I haven't played with it. But, in theory, you should get smoother playback performance with a video on marginal platforms, particularly if you've enabled hardware decoding.

As to your video sizes, it sounds like you have your bitrate set pretty high for your videos. (Or, put another way, your compression pretty low.) You can probably fiddle with the video generation parameters to reduce the size of the video without a lot of visual degradation. (Depends on your video, of course.) How you do that obviously depends a lot on how you're building your videos.

And, as indicated earlier, if you have to use mp4 for Android, that format also works fine on Windows/Mac/Linux, so you don't have to use webm for them.
 
  • Like
Reactions: anne O'nymous

Jon_Sleeper

Member
Nov 14, 2018
284
364
So is 8 the max no. of images recommended to use in a image sequence if I'm planning it to run it on android?
 

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,896
2,875
Now, having said that, things will usually be OK on an awful lot of PC's, because their performance is generally pretty good. Android might be more of an issue - I don't do Ren'py on Android, so I haven't played with it. But, in theory, you should get smoother playback performance with a video on marginal platforms, particularly if you've enabled hardware decoding.
I will do an Android build and test it on my tablet. I have a sufficiently slow Samsung tablet that should be pretty representative and I can see if it stutters too much. My animations are running anywhere from 5 to 19 frames, depending on the animation, and I haven't seen any stuttering, but that's on a very fast machine and HD. I think that if they play smooth on Android, then I will probably be pretty good to go. The other advantage with using image sequences is there is no overhead for compression/decompression, which does take a toll on a computer's processing power as well.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,188
The size of the cache, however, is typically only configured to hold the equivalent of something like 8 screens worth of data.
This can be changed with the value. Note that the value is not directly a size, but the numbers of files using all the display surface that can be cached simultaneously. On a side note the value for 6.99.14 SDK is to 16. As PyTom doubled the default size ?
Or if you want to express explicitly the size, it's that must be used. But I don't recommend to use it, the previous is better since it do all the computations for you.

He can also temporarily put at True to log the image caching process and have a better view of the possible outcomes.


Images take a non-zero amount of time to load, so depending on the frame rate and the performance of the system on which it's being played, this can cause stuttering during the playback.
On the other side, a video need to be fully loaded before being played. I noticed lately that some authors tend to have too big videos that make Ren'py freeze before each one of them.
So, both solution having their pros and cons, it's also a question of balancing.


Now, having said that, things will usually be OK on an awful lot of PC's, because their performance is generally pretty good.
I agree with that. I never experience problems with those animations, except the one pointed out by @Avaron1974 . This even when I was still using my 8 years old computer.
 
  • Like
Reactions: Jon_Sleeper