Reference Manual: (offline | online) Quickstart: (offline | online)

Movies

Ren'Py is capable of playing MPEG-1 movies. This allows you to include video as part of your game. There are two ways that this can be done. Displaying video in fullscreen mode allows video to be scaled up to very large sizes, while displaying video in a displayable allows it to be blended with images and text.

Displaying a video fullscreen allows it to take advantage of hardware decode and scaling support. The downside of fullscreen mode is that nothing else can be displayed while the movie is being displayed.

Whenever a movie is playing, it is expected to provide all sound that the user hears. Ren'Py disables sound hardware for the duration of the movie.

The easiest way to display a movie fullscreen is to display it using the renpy.movie_cutscene function. This function displays a movie for a specified length of time. When that time has elapsed, or when the user clicks to dismiss the movie, the movie ends and the function returns.

$ renpy.movie_cutscene("On_Your_Mark.mpg", 394)

Displaying a movie in a displayable is more difficult, but it allows the movie to be mixed with rendered text and graphics. A downside of this method is that the screen needs to be re-rendered with each frame, a process that may be unacceptibly slow when the screen is large. We don't recommend this when the game window is larger that 640x480.

To display a movie in a displayable, we must start the movie and show a Movie displayable on the screen. The movie is then displayed on the screen along with any other widget. When we no longer want to show it, we need to stop the decoding of the movie and hide the displayable.

Function: renpy.movie_start_displayable( filename, size, loops=0)

This starts a MPEG-1 movie playing in displayable mode. One or more Movie widgets must be displayed if the movie is to be shown to the user.

filename - The filename of the MPEG-1 move that we're playing.

size - A tuple containing the size of the movie on the screen. For example, (640, 480).

loops - The number of additional times the movie should be looped. -1 to loop it forever.

init:
    image movie = Movie()

$ renpy.movie_start_displayable("bg.mpg", (640, 480), -1)
scene movie
show eileen happy

e "I'm standing in front of a movie."

e "Isn't that keen?"

hide movie
$ renpy.movie_stop()
Reference Manual: (offline | online) Quickstart: (offline | online)