Ren'Py Splashscreen music and video

MGDS

Member
Jan 31, 2024
214
117
121
Hello ! After trying hard on Twine+Sugarcube, I realized I was far better in DAZ3D than in coding... So I tried to "move" to Ren'Py. I have a fonctionnal presplash screen, a main and in-game menu working fine but have some issues with label splashscreen. I have a disclaimer picture, a question/answers to validate the +18, a very small webm video. I tried several methods but can't make the music play through the entire splashscreen and continue to the main menu ?!?

I tried both play movie and $ renpy.movie_cutscene but nothing really helped. My splashscreen code for the moment (It happened once the music - I had it coded after the disclaimer - continued after the video but I found a bug where Eileen shadow appeared just after the video and... On the disclaimer background) :


label splashscreen:

# 1. MUSIC
play music "audio/sinfull_desire.ogg" loop
# 2. DISCLAIMER
show image "images/disclaimer_18.png" with fade

# Reading Pause
$ renpy.pause(10.0)
show image "images/disclaimer_18.png":
alpha 0.5
linear 1.0 alpha 0.5
# 3. INTERACTION
menu:
"Do you agree the terms and conditions and confirm you're legal age in your country to play."
"I agree and confirm I have the legal age":
pass
"Quit":
$ renpy.quit()
# 4. VIDEO
$ renpy.movie_cutscene('video/intro_video.webm')

return
 

Turning Tricks

Rendering Fantasies
Game Developer
Apr 9, 2022
1,954
3,650
353
AFAIK, the splashscreen is initialized before the main game loop, so that is why it only will play music while the media is being shown.

Other than that though, it's easy getting music to play through any disclaimer screens you have.

In the options.rpy file is this section...

Python:
## Uncomment the following line to set an audio file that will be played while
## the player is at the main menu. This file will continue playing into the
## game, until it is stopped or another file is played.

define config.main_menu_music = "your_audio_here.mp3"
That plays the music file you have at the main menu and into the game until it is stopped. In fact, I had to remember to add a stop music command in my script files so the theme doesn't keep blasting through.

So, if you call your disclaimer pages from inside the start label then the music will keep playing (unless you stop it or start another file on the same channel)

Here's how I do my legal disclaimer pages. You'll see I had to add that stop music command to stop my main menu theme song before jumping into the story. Then there's a call to show the disclaimers, but if the player already clicked through them, then they get returned right away (persistent variable) ...

Python:
label start:

    stop music fadeout 3.0
    pause 1.0

    call game_disclaimer from _call_game_disclaimer

    call Flow_Control from _call_Flow_Control  ## this is the label block I use to control the actual scenes

    return


label game_disclaimer:

    if persistent.legal_notice:
        return
    else:
        scene adults_only  with fade
        $ renpy.pause(3.0, hard='True')
        pause

        scene content_warning with fade
        $ renpy.pause(3.0, hard='True')
        pause

        scene disclaimer with fade
        $ renpy.pause(4.0, hard='True')
        pause

        $ persistent.legal_notice = True

        return
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
12,749
20,963
1,026
AFAIK, the splashscreen is initialized before the main game loop, so that is why it only will play music while the media is being shown.
It's more simple than this, and you gave the reason without noticing it:

Python:
## Uncomment the following line to set an audio file that will be played while
## the player is at the main menu. This file will continue playing into the
## game, until it is stopped or another file is played.

define config.main_menu_music = "your_audio_here.mp3"
The main menu is considered independent from the game, and the game music is paused when you enter it.
More precisely, Ren'Py have an "in game menu" state. When you enter it, it will play the music defined for the game menu, and when you leave it, it will play the music defined for the game. Like the splashscreen isn't in the "in game menu" state, its music is considered as being the one of the game.
 
  • Like
Reactions: Turning Tricks