Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Extended Music Room for Ren'Py

Fully featured music room with improved usability and setup for Ren'Py. · By Feniks

Need Support? Post here! Sticky

A topic by Feniks created Dec 26, 2023 Views: 357 Replies: 14
Viewing posts 1 to 6
Developer

If you're having trouble or run into any bugs with the code, post a comment here! I will try to get back to you within a few days.

(1 edit)

So I just found your awesome tool today, and was going through the readme directions and got things most of the way set up with implementing the tool. It took some tries to get past some initial error messages from Ren'py, mostly due to my lack of understanding of how to set it up, but I got the music room to appear in the menu and visually.

What I didn't understand though was, when I tried to add my own songs to the list, either by replacing the path of the existing entries, or copying the existing music_room.add functions, it was like Ren'Py wasn't seeing the changes. The tracks shown in the music player list weren't changing, even when I outright deleted a few of the pre-existing example entries for the sake of testing.

The steps I followed were:

  1. Copied the "music_room" and "gui" folders from the zip file to my project's "game" folder.
  2. Copied "01_music_room_backend.rpy" and "music_room.rpy" from the "music_room" folder and pasted them into the "game" folder as well.
  3. Copied the entire contents of "music_room.rpy" into the bottom of my project's "screens.rpy" file to use as a starting point.
  4. Added textbutton _("Music Room") action ShowMenu("music_room3", mr=music_room) to the "Main and Game Menu Screens" section of screens.rpy

And up to this point it's more or less working as intended (excuse the clunky visuals in the screenshot, as my game is in 1280x720 resolution so I haven't gotten far enough along yet to worry about making it look and fit better visually.)


It's just when I try to modify or add any tracks under the "Music Room Declaration" section where I start running into issues (here's an example screenshot:)


The track list doesn't update to include the new tracks in any of the 3 layout modes. I even tried taking one of the existing entries and just changing its path from the silence generation to one of the test tracks paths, and it didn't really update visually or functionally in the player.

That's as far as I've gotten with trying to implement things thus far. Are there steps I am still missing or not understanding? Does it have something to do with trying to adapt it to 720p instead of 1080 (seems unlikely?) Maybe the folder setup when I copied things over originally was the incorrect way and now it's causing issues?

Edited to add: I'm using Ren'Py v 8.1.3 and I'm on Linux if that matters at all.

Developer(+1)

How are you testing if this works? I've noticed that 8.1.3 doesn't seem to refresh values declared with define on a shift+R refresh as it once did, so you may need to close the game and re-open it to see any changes. Be sure to search your project folder for music_room also to ensure you're not re-declaring the music room twice or anything!

(1 edit)

I have been closing out the game and re-launching it each time to test. I double-checked the project folder, and there were two instances as you mentioned, so I deleted the extraneous ones, but it still isn't showing the changes to the track list.

I had them in two locations: "game" folder and "game/music_room" folder. I tried deleting each set separately, to see if keeping them in one location or the other would work, and neither seemed to update the track list, although both "worked" equally well, for what it's worth.

Okay, I more or less figured out a solution. I'm not 100% sure which of these steps solved the issue, but it was some combination of the following:

  1. I started over from a fresh copy of my project (it always pays to test stuff in a backup copy!) and installed the Extended Music Room properly with only a single instance in the folder to begin with.
  2. This time, I didn't copy the content of the music_room.rpy over to screens.rpy, and instead just edited music_room.rpy directly itself (I think this was most likely the main issue, user error on my part. The tracks I added into music_room.rpy appeared properly at this point.)
  3. I also noticed that specifying the path name for the audio files while leaving the angle brackets in place (ex: path="<audio/track1.ogg>",) Ren'Py threw an error when I tried to play Track 1. But when I removed the angled brackets and just listed it as path="audio/track1.ogg", everything worked correctly.

Thanks for your suggestions! They did help me figure out what I was doing wrong. If I bump into any more issues I'll post back, but I think it's looking good now!

Hello! I've tried implementing the code in my game but upon trying to access it I get this error. I'm running Renpy 8.2.

-- Full Traceback ------------------------------------------------------------
Full traceback:
  File "renpy/common/00gamemenu.rpy", line 174, in script
    $ ui.interact()
  File "F:\renpy-8.2.0-sdkarm\renpy\ast.py", line 823, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "F:\renpy-8.2.0-sdkarm\renpy\python.py", line 1178, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "renpy/common/00gamemenu.rpy", line 174, in <module>
    $ ui.interact()
  File "F:\renpy-8.2.0-sdkarm\renpy\ui.py", line 301, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "F:\renpy-8.2.0-sdkarm\renpy\display\core.py", line 2165, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, pause_modal=pause_modal, **kwargs) # type: ignore
  File "F:\renpy-8.2.0-sdkarm\renpy\display\core.py", line 2683, in interact_core
    root_widget.visit_all(lambda d : d.per_interact())
  File "F:\renpy-8.2.0-sdkarm\renpy\display\displayable.py", line 431, in visit_all
    d.visit_all(callback, seen)
  File "F:\renpy-8.2.0-sdkarm\renpy\display\displayable.py", line 431, in visit_all
    d.visit_all(callback, seen)
  File "F:\renpy-8.2.0-sdkarm\renpy\display\displayable.py", line 431, in visit_all
    d.visit_all(callback, seen)
  [Previous line repeated 1 more time]
  File "F:\renpy-8.2.0-sdkarm\renpy\display\screen.py", line 480, in visit_all
    callback(self)
  File "F:\renpy-8.2.0-sdkarm\renpy\display\core.py", line 2683, in <lambda>
    root_widget.visit_all(lambda d : d.per_interact())
  File "F:\renpy-8.2.0-sdkarm\renpy\display\screen.py", line 491, in per_interact
    self.update()
  File "F:\renpy-8.2.0-sdkarm\renpy\display\screen.py", line 697, in update
    self.screen.function(**self.scope)
  File "game/music_room/music_room.rpy", line 718, in execute
    screen music_room3(mr):
  File "game/music_room/music_room.rpy", line 718, in execute
    screen music_room3(mr):
  File "game/music_room/music_room.rpy", line 744, in execute
    fixed:
  File "game/music_room/music_room.rpy", line 788, in execute
    frame:
  File "game/music_room/music_room.rpy", line 790, in execute
    has hbox
  File "game/music_room/music_room.rpy", line 806, in execute
    vbox:
  File "game/music_room/music_room.rpy", line 840, in execute
    hbox:
  File "game/music_room/music_room.rpy", line 849, in execute
    music_bar:
  File "game/music_room/01_music_room_backend.rpy", line 39, in __init__
TypeError: super(type, obj): obj must be an instance or subtype of type

Developer

I initially wondered if this was a compatibility issue with 8.2, but as I check for compatibility, I haven't had any issues running the Extended Music Room on 8.2. Can you try adding the music room to a fresh project to see if you get the same error? If not, try using Force Recompile for your current project to make sure you don't have any old files lying around, and perhaps double check that you don't have anything else named AudioBar in your project.

Force recompiling did the trick and it should have been the first thing I tried, honestly! xD Thank you so much and sorry for the bother!

when selecting a song, this weird thing pops up, i have no idea what it is    

Developer

Unfortunately I can't see anything in that image, as it's too small. Can you send the image at a larger size, or describe what you're seeing?

Hey.

I want to make the music room available only in the main menu and specific places in the game. After the segments where the player can access the music room, I want control over what music plays as a developer again, so I try to do `stop music`, but that doesn't seem to work anymore with this script.

Update: Managed to solve it.

At first, `stop music` just refused to work, even after restarting. Then, I adjusted the script to be `stop music fadeout 1.0` and it worked. And when I changed it back to `stop music` that worked too now! Very odd, but I guess it is what it is...

Hey, how do I change the size of the cover art along with the music bar and buttons?
My game is at 1280x720, so some things are popping off the screen

Developer(+1)

Hello! Feel free to adjust the size of the images directly (e.g. in Photoshop) - that said, the example screens are made specifically for 1920x1080 so you will be responsible for adjusting any styles or positions to suit your resolution if you want to use the provided screens. Otherwise, you can follow them as a template and design your own screen!

Thank you, I already managed to adjust everything here :)