Ren'Py Displaying animation in renpy

formerflame

Newbie
Game Developer
Mar 28, 2018
89
1,192
So I'm having some problems inserting movies into my renpy game. Here's what I've tried and the problems I'm having with each. The clip is 5 seconds long at 30fps encoded with VP9.
Code:
scene v1t7
"Characters talking"
$ renpy.movie_cutscene("images/v1/flashback/v1tpan.mkv", delay=None)
scene v1t8
That code works but at the end it flashes the previous image v1t7 for about half a second then shows v1t8.

I also tried:
Code:
image v1tpan = Movie(play="images/v1/flashback/v1tpan.mkv")
show v1tpan with fade
That code plays the first second of the clip then skips right to the end without playing the rest.

As well as:
Code:
play movie "images/v1/flashback/v1tpan.mkv"
That works but is not skippable and it won't freeze on the final frame so I have to save the final frame and put it in the script (scene v1t8 in this case) which isn't a big deal but I'd like them to be skippable if possible.

I'm also wondering how to insert a clip that loops until the player clicks to move on.
 

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
image v1tpan = Movie(play="images/v1/flashback/v1tpan.mkv")
show v1tpan with fade

You nearly had it with this one, you simply need a pause or something.

image v1tpan = Movie(play="images/v1/flashback/v1tpan.mkv")
show v1tpan with fade
pause

I call a screen for camera buttons

image v1tpan = Movie(play="images/v1/flashback/v1tpan.mkv")
show v1tpan with fade
call screen camera

Or you can use dialogue too I think

image v1tpan = Movie(play="images/v1/flashback/v1tpan.mkv")
show v1tpan with fade
"Fuck me Jim"

The movie will loop until the player clicks
 
  • Like
Reactions: formerflame

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
Coding off the top of my head, may need testing...

Python:
image v1tpan = Movie(play="images/v1/flashback/v1tpan.mkv", loop=True)

label start:

    scene v1t7 with fade
    "Characters talking"
  
    scene v1tpan with Pause(8) # assuming movie is 8 seconds long.

    scene v1t8 with dissolve

The movie should still be skippable.
I've done this with displayables using animations which are a series of still images on a loop, should be more or less the same. Obviously test it... my assumptions could be wrong.

I'd also draw your attention to , which is an image/displayable to put on the screen while RenPy spends time decoding the first frame of the video rather than a blank/transparent screen.

Anyway, try it. Worse case... it doesn't work - in which case, you're no worse off than you are now.

If you really do want the movie to loop infinitely, until the player continues - you're going to have issues. The primary one is auto-advance.

You could code something like:
Python:
    scene v1tpan
    pause

... which would be fine, except if auto-advance is switched on. In which case, that pause will wait it's minimum possible time and then continue - probably before the movie has barely started showing.

Python:
    scene v1tpan with Pause(8)
    pause

# -or-
    scene v1tpan with Pause(8)
    "Some other line of dialogue"

# -or- # late edition...
    scene v1tpan
    pause 8.0

Might be more an option, but again it's all about testing with auto-advance switched on and off.
Because that first example is a pause followed by a pause... which auto-advance is switched OFF, will make the game feel unresponsive when the player clicks within the first 7 seconds and it seems to do nothing.

Honestly, a looping anything when shown as a scene is best followed by 5 or 6 lines of dialogue - so the video continues to play in the background while the player is reading the lines. Not that that is always practical.
 
Last edited:
  • Like
Reactions: formerflame

formerflame

Newbie
Game Developer
Mar 28, 2018
89
1,192
For anyone that is having this problem in the future.
This works. Changing loop=True will loop the movie. To make sure the next image in sequence shows up rather than flashing back to the image before the movie until a click add the image="next image path" .

Code:
scene v1t7
"talking"

image v1tpan = Movie(play="images/v1/flashback/v1tpan.mkv", loop=False, image="images/v1/flashback/v1t8.jpg")
show v1tpan with fade
pause
scene v1t8

"talking"
[\CODE]
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,191
Code:
scene v1t7
"talking"

image v1tpan = Movie(play="images/v1/flashback/v1tpan.mkv", loop=False, image="images/v1/flashback/v1t8.jpg")
show v1tpan with fade
pause
scene v1t8

"talking"
Two things :

Firstly, the image declaration (image v1tpan = [...]) should be at level 0 of indentation and outside of any label.

Secondly, since you know how long is you movie, it's better to give a duration to your pause. This way the player will not have to click to continue, what is annoying when there's no text displayed.
But be careful, when given a duration, the pause statement is silently transformed into a transition. This mean that players who decided to configure Ren'py to skip transition will not see the movies. Therefore, you need to use the Ren'py equivalent here, $ renpy.pause( 5.0 )