Ren'Py How To: Package Renpy game so the contents are not able to be accessed

LadyLilith-3D

Newbie
Dec 16, 2020
79
245
Does anyone know if there is a way to package your Renpy game so the contents are not able to be accessed? The reason I ask is that some of the music in my game is free for commercial use BUT the license specifically says it can't be freely available in the source/contents. They don't want end-users to be able to access them easily and basically keep them for their own.

So far it seems like once you download a Renpy game you can just open up the game files / sift through and take out anything you want. Images, Movie files, Music, etc. How could I package my Renpy game so that I can at least comply with said license agreements? Any ideas?

P.S: Forgive my ignorance if this is something that is easy to do. I'm new to Renpy. I did read something about archiving so I still need to do more research into that as well.
 

riktor

Active Member
Nov 26, 2018
906
1,161
for audio specifically, you could perhaps convert the files to base64 and code them as constants in python. would be a bit involved though.

they could still be extracted of course, but it would take more than just unren.

archiving in renpy just packages assets into rpa files, they are easily extracted with unren.

it all depends on how they mean 'freely available'
 
Last edited:

LadyLilith-3D

Newbie
Dec 16, 2020
79
245
This is my hangup.


Items Incorporated Into End-Products Cannot be Extracted or Used Separately
You cannot allow items incorporated into end-products to be extracted or used separately from the end-product. You must take all reasonable steps to prevent this from happening and inform any client who the project is for of their responsibilities in relation to this.
 

riktor

Active Member
Nov 26, 2018
906
1,161
yeah that's vague enough to be troublesome. might try asking them what they'd consider reasonable.
ultimately it will almost always be extractable through some method.
 

baka

Engaged Member
Modder
Oct 13, 2016
3,519
7,340
not sure how much u can do in ren'py.
I encrypt the assets. that way they are not readable.
but no matter what Im doing theres always a way to crack it.
a person could debug the memory and look at how the decryption works when running the program or use a memory dumper that extract data directly from memory.
so, theres no 100% safeguard here.

what I would do is to check what kind of functions ren'py has, is it possible to read the mp3 into memory?
and send that data (array or pointer) to the sound-engine ren'py uses?
the end result would be to:
create a tool that encrypt all mp3. and have from ren'py when u load that data, to decrypt it before sending it to the sound-engine. but, people can still access the scripts from ren'py. so even if u create such thing, people would be able to crack it in minutes if they really want. but at least you did " take all reasonable steps to prevent "
otherwise u need to change programming language, something cross-platform that allow such functionality and also give you more protection.
 

Meushi

Well-Known Member
Aug 4, 2017
1,146
12,727
Does anyone know if there is a way to package your Renpy game so the contents are not able to be accessed? The reason I ask is that some of the music in my game is free for commercial use BUT the license specifically says it can't be freely available in the source/contents. They don't want end-users to be able to access them easily and basically keep them for their own.

So far it seems like once you download a Renpy game you can just open up the game files / sift through and take out anything you want. Images, Movie files, Music, etc. How could I package my Renpy game so that I can at least comply with said license agreements? Any ideas?

P.S: Forgive my ignorance if this is something that is easy to do. I'm new to Renpy. I did read something about archiving so I still need to do more research into that as well.
When building your distribution, put the music into an (RPA file). Then the users can't access them directly, they'd need third party tools to extract the contents of an RPA.

If never done a build, but in theory it should be something like:
Code:
# Declare music archive.
build.archive("music", "all")

# Put music files into the music archive.
build.classify("game/**.ogg", "scripts")
build.classify("game/**.mp3", "scripts")
This is what they do in games like BaDIK, which contains licensed music.
 
  • Like
Reactions: LadyLilith-3D

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
Note: I'm not a lawyer, just a guy who know the subject. Therefore, what I'll say isn't to be took as effective legal advice.


The reason I ask is that some of the music in my game is free for commercial use BUT the license specifically says it can't be freely available in the source/contents. They don't want end-users to be able to access them easily and basically keep them for their own.
All depend of the underlined part. Even with Unity (and globally any engine), the music would generally be available. Not easily, not for everyone, but as long as the content is on your computer, there's always a way to access it for someone who've the knowledge and the time. And even if the music was stored online, there will always be a moment when it will be on your computer.
If they effectively state it as "freely available", then what matter isn't that the music can't be accessed, but that not everyone can easily access it. Words have a meaning, and this meaning is really important when it come to legal talk.

Therefore, you can try to contact them, telling them how you intend to distribute the music. Something like : "The music would be converted in a not playable format, stored in the archive format used by the game Engine, and only the compiled version of source code will be included."
What matter is that they explicitly allow you to distribute the music this way.
If it appear that it's possible to revert this, well what can they do ? Sue you ? Yes, but then your lawyer will provide the e-mail (and its header) where they explicitly authorized you to distribute the music this way... If it appear that it's possible to (relatively) easily revert this, you didn't knew it, and they should have thought about it before giving you their authorization, not after.

This being said, isn't there effectively free, to use and distribute, music that you can use ? It would be a way better solution.
 

Avaron1974

Resident Lesbian
Aug 22, 2018
25,248
86,497
Therefore, you can try to contact them, telling them how you intend to distribute the music. Something like : "The music would be converted in a not playable format, stored in the archive format used by the game Engine, and only the compiled version of source code will be included."

This being said, isn't there effectively free, to use and distribute, music that you can use ? It would be a way better solution.
These are essentially your only options.

Contact them and explain your plans or find free to use music.

Like Anne said, anyone with the slightest know how can access anything in these games regardless of engine.

Ren'py, RPGM and Unity all have unpacker tools you can download on this site and I know Unreal has one too.

The only way to cover yourself is to get their written, and that's important because a verbal contract isn't worth shit in court, consent to use their music or find some freeware tunes.
 
  • Like
Reactions: anne O'nymous

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,789
To extend Anne's answer:

Clipping any part out of a legal text is a no-go. If you want serious answers posting the entire license would be a start.

Aside from that: wording that leaves room for interpretation is usually a warning sign especially if it is part of a legal text.

Extraction of assets is very common nowadays as the tools for it have become public domain. A few years back that was a different matter. Access to decompilers etc was usually limited to professionals thus licenses could expect to uphold a certain degree of knowledge and difficulty when it came to extraction from other packages.

With the implementation of industry standards that heavily changed and also made certain licenses legally obsolete. There are millions of properly licensed and completely free for distribution songs available. I personally would suggest to switch to those. The wording of your current license leaves too much legal leeway to become a problem.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
[...] the license specifically says it can't be freely available in the source/contents.

I think the thing you need to focus on here is "freely available".

Yes, it's possible to unpack RenPy games. But "most" players won't be able to.

So the solution, as Meushi said before me, is to package up the game when you build it into an .rpa archive.
Just head into your options.rpy file and configure the build parameters to compress the game for you. The source files will not be "freely available", even if there are tools that will extract things for those technically minded enough.

The section of my standard options.rpy file looks like this:

Python:
    ## Classify files as None to exclude them from the built distributions.

    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**.psd', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)
    build.classify("game/**.rpy", None)


    ## Files matching documentation patterns are duplicated in a mac app
    ## build, so they appear in both the app and the zip file.

    build.documentation('*.html')
    build.documentation('*.txt')

    # Declare three archives.
    build.archive("scripts", "all")
    build.archive("images", "all")
    build.archive("sounds", "all")

    # Put script files into the scripts archive.
    build.classify("game/**.ttf", "scripts")
    build.classify("game/**.rpyc", "scripts")

    # Put images into the images archive.
    build.classify("game/**.jpg", "images")
    build.classify("game/**.png", "images")
    build.classify("game/**.mp4", "images")
    build.classify("game/**.mpg, "images")
    build.classify("game/**.avi", "images")
    build.classify("game/**.webp", "images")
    build.classify("game/**.webm", "images")

    # Put sounds into the sounds archive.
    build.classify("game/**.ogg", "sounds")
    build.classify("game/**.wav", "sounds")
    build.classify("game/**.mp3", "sounds")

    build.include_i686 = False

In my case, I'm actually using 3 separate archives, scripts.rpa, images.rpa and sounds.rpa, just choosing to put different file types in different files.

Copy/paste this into your game... and the music files won't be "freely" available.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
With the implementation of industry standards that heavily changed and also made certain licenses legally obsolete. There are millions of properly licensed and completely free for distribution songs available. I personally would suggest to switch to those. The wording of your current license leaves too much legal leeway to become a problem.
I would add that there's now a new tendency in the music industry, the "royalty free licenses". You need to pay (not this much) for the music, but then you're free to use it as much as you want without having to pay royalties. This by opposition to the original model, where you've to pay according to the number of game you'll sold.

Generally those licenses don't put effective restriction in the way to distribute the music. This mostly because they aren't the main source of income for the artists who, in the same time, have records sold "the old way". The music they release with those license is a way to advertise for their creation (and share their passion), and what you've to pay for the license is, generally, here just to cover the cost.
 

LadyLilith-3D

Newbie
Dec 16, 2020
79
245
I would add that there's now a new tendency in the music industry, the "royalty free licenses". You need to pay (not this much) for the music, but then you're free to use it as much as you want without having to pay royalties. This by opposition to the original model, where you've to pay according to the number of game you'll sold.

Generally those licenses don't put effective restriction in the way to distribute the music. This mostly because they aren't the main source of income for the artists who, in the same time, have records sold "the old way". The music they release with those license is a way to advertise for their creation (and share their passion), and what you've to pay for the license is, generally, here just to cover the cost.
So in full disclosure, the place I was looking for music to use was "elements envato". They have a ton of music and all full under the same commercial license agreement and it costs like $15 a month. You can use anything you download for your project even if you cancel. This is the exact terminology that was giving me pause.

Items Incorporated Into End-Products Cannot be Extracted or Used Separately
You cannot allow items incorporated into end-products to be extracted or used separately from the end-product. You must take all reasonable steps to prevent this from happening and inform any client who the project is for of their responsibilities in relation to this.

To me, that seems like an almost impossible thing to achieve with a variety of products (not just games) but maybe they worded it like that in purpose. I think I'll just reach out to them and worst case, use free music. It's just I was trying to make my game stand out a little bit and use some really good music that you don't hear often.


I think the thing you need to focus on here is "freely available".

Yes, it's possible to unpack RenPy games. But "most" players won't be able to.

So the solution, as Meushi said before me, is to package up the game when you build it into an .rpa archive.
Just head into your options.rpy file and configure the build parameters to compress the game for you. The source files will not be "freely available", even if there are tools that will extract things for those technically minded enough.

The section of my standard options.rpy file looks like this:

Python:
    ## Classify files as None to exclude them from the built distributions.

    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**.psd', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)
    build.classify("game/**.rpy", None)

    ## To archive files, classify them as 'archive'.

    # build.classify('game/**.png', 'archive')
    # build.classify('game/**.jpg', 'archive')

    ## Files matching documentation patterns are duplicated in a mac app
    ## build, so they appear in both the app and the zip file.

    build.documentation('*.html')
    build.documentation('*.txt')

    # Declare three archives.
    build.archive("scripts", "all")
    build.archive("images", "all")
    build.archive("sounds", "all")

    # Put script files into the scripts archive.
    build.classify("game/**.ttf", "scripts")
    build.classify("game/**.rpyc", "scripts")

    # Put images into the images archive.
    build.classify("game/**.jpg", "images")
    build.classify("game/**.png", "images")
    build.classify("game/**.avi", "images")
    build.classify("game/**.webp", "images")
    build.classify("game/**.webm", "images")

    # Put sounds into the sounds archive.
    build.classify("game/**.ogg", "sounds")
    build.classify("game/**.wav", "sounds")
    build.classify("game/**.mp3", "sounds")

    build.include_i686 = False

In my case, I'm actually using 3 separate archives, scripts.rpa, images.rpa and sounds.rpa, just choosing to put different file types in different files.

Copy/paste this into your game... and the music files won't be "freely" available.
I may make this part of my "case" when I reach out to them. Thank you.


Thanks everyone for giving me your feedback on this. It's much appreciated.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
Items Incorporated Into End-Products Cannot be Extracted or Used Separately
You cannot allow items incorporated into end-products to be extracted or used separately from the end-product. You must take all reasonable steps to prevent this from happening and inform any client who the project is for of their responsibilities in relation to this.

To me, that seems like an almost impossible thing to achieve with a variety of products (not just games) but maybe they worded it like that in purpose. I think I'll just reach out to them and worst case, use free music. It's just I was trying to make my game stand out a little bit and use some really good music that you don't hear often.
Yeah, it really looks like it was wrote by a lawyer who know near to nothing about computers. People were already ripping music from games in the early 80's, and since nothing prevented them to continue. Of course, it's possible to complicate their task, making it possible for only a bunch of people really determined to do it, but that's all ; even hardware DRM can be bypassed, so effectively preventing "items incorporated into end-products to be extracted", is pure utopia.
But the second sentence, "you must take all reasonable steps to prevent this from happening", is more interesting.

I remember that I'm not lawyer, it's just my thoughts, but coding the music in Base64 (or other), storing it in a RPA file, and releasing only the rpyc files, seem to be reasonable steps ; it should prevent at least 99% of the people to access this music. It's not 100% secure, but as I said previously, nothing is 100% secured. Even if you were using your own game engine, wrote in a compiled language, and then stored the music Byte by Byte with random data between each one, and finally encrypt the result, it would still be possible, for someone determined, to extract the music then use it without your end-product.


But, this being said, I think that the question you should ask yourself is: Is this really worth it ?

I mean, is this music really so exceptional and unique, that you can't find something similar that wouldn't really cost you more, while not forcing you to do all this additional work ?
It's not too difficult (relatively speaking) to store the music in Base64, then play it in Ren'py. But you'll need to make a small script that will turn it into Base64. Then your game will have to turn it back into its normal form soon enough for the player to not notice a waiting time ; what probably imply the use of a thread. This while keeping the said "normal form" into the RAM, what probably imply a small rewrite of Ren'py's core ; because if you store it on a cache it would become available and break the license.
Be noted that the same would apply for any other game engine. The only difference being that some of them, like Unity by example, works natively with music stored into the RAM ; but it just remove one of the steps needed to comply to the impossible terms of their license.

What lead to a rephrasing of what toolkitxx said previously: wording that ask you for the impossible is usually a warning sign especially if it is part of a legal text.
They clearly don't understand how both digital media and software works, therefore you can't predict their future actions. Since they ask for something that no one can do, at anytime they can decide that you aren't doing it and sue you for this reason. Of course, you would surely win in justice, but at what cost, both in time, stress, and money ?

So, yeah, is this music really worth it ?
 
  • Red Heart
Reactions: LadyLilith-3D

LadyLilith-3D

Newbie
Dec 16, 2020
79
245
Thanks everyone for
Yeah, it really looks like it was wrote by a lawyer who know near to nothing about computers. People were already ripping music from games in the early 80's, and since nothing prevented them to continue. Of course, it's possible to complicate their task, making it possible for only a bunch of people really determined to do it, but that's all ; even hardware DRM can be bypassed, so effectively preventing "items incorporated into end-products to be extracted", is pure utopia.
But the second sentence, "you must take all reasonable steps to prevent this from happening", is more interesting.

I remember that I'm not lawyer, it's just my thoughts, but coding the music in Base64 (or other), storing it in a RPA file, and releasing only the rpyc files, seem to be reasonable steps ; it should prevent at least 99% of the people to access this music. It's not 100% secure, but as I said previously, nothing is 100% secured. Even if you were using your own game engine, wrote in a compiled language, and then stored the music Byte by Byte with random data between each one, and finally encrypt the result, it would still be possible, for someone determined, to extract the music then use it without your end-product.


But, this being said, I think that the question you should ask yourself is: Is this really worth it ?

I mean, is this music really so exceptional and unique, that you can't find something similar that wouldn't really cost you more, while not forcing you to do all this additional work ?
It's not too difficult (relatively speaking) to store the music in Base64, then play it in Ren'py. But you'll need to make a small script that will turn it into Base64. Then your game will have to turn it back into its normal form soon enough for the player to not notice a waiting time ; what probably imply the use of a thread. This while keeping the said "normal form" into the RAM, what probably imply a small rewrite of Ren'py's core ; because if you store it on a cache it would become available and break the license.
Be noted that the same would apply for any other game engine. The only difference being that some of them, like Unity by example, works natively with music stored into the RAM ; but it just remove one of the steps needed to comply to the impossible terms of their license.

What lead to a rephrasing of what toolkitxx said previously: wording that ask you for the impossible is usually a warning sign especially if it is part of a legal text.
They clearly don't understand how both digital media and software works, therefore you can't predict their future actions. Since they ask for something that no one can do, at anytime they can decide that you aren't doing it and sue you for this reason. Of course, you would surely win in justice, but at what cost, both in time, stress, and money ?

So, yeah, is this music really worth it ?
Thank you for such an in-depth response and honestly....I think you're right. I'm going to spend some more time scouring around to see what I can come up with for free-to-use music so I don't have to worry about this issue. It's just one thing I don't have to worry about coming back and bitting me in the ass.
 

toolkitxx

Well-Known Member
Modder
Donor
Game Developer
May 3, 2017
1,473
1,789
Well - let me add just some very basic information to enhance your search or decision making:

There are certain licenses that are standard when it comes to music usage. What you will have to read up on is called a 'streaming license'. That is when you combine the music with any kind of visual either as background music or scene specific element.

Next part you want to read up on is 'single use'. That is a very clearly defined legal term you need to understand! Often this particular term also gets combined with the word 'personal' - make sure you read all the nifty bits very careful.

Aside from all that: I think you forgot to read para 22 on - the famous words offensive, pornographic etc ;)
 

obsessionau

Member
Game Developer
Sep 27, 2018
268
368
They are not asking you to do the impossible. In tort law if something can't be done and nobody does it then it is not a "reasonable step".

"The file is not to be used in conjunction with pornographic / offensive material" ... on the other hand they would ping you.

What about websites like fiverr? and look for a freelance person?

I typed in music for visual novel and got a number of artists and voice artists starting from around $5 for a 30 second song with 3 instruments... If you indicate what it is for, many wouldn't have an issue with adult content.
 

Asmodeus_

Creator of Neuvau
Game Developer
Apr 5, 2020
939
3,871
I think the thing you need to focus on here is "freely available".

Yes, it's possible to unpack RenPy games. But "most" players won't be able to.

So the solution, as Meushi said before me, is to package up the game when you build it into an .rpa archive.
Just head into your options.rpy file and configure the build parameters to compress the game for you. The source files will not be "freely available", even if there are tools that will extract things for those technically minded enough.

The section of my standard options.rpy file looks like this:

Python:
    ## Classify files as None to exclude them from the built distributions.

    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**.psd', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)
    build.classify("game/**.rpy", None)

    ## To archive files, classify them as 'archive'.

    # build.classify('game/**.png', 'archive')
    # build.classify('game/**.jpg', 'archive')

    ## Files matching documentation patterns are duplicated in a mac app
    ## build, so they appear in both the app and the zip file.

    build.documentation('*.html')
    build.documentation('*.txt')

    # Declare three archives.
    build.archive("scripts", "all")
    build.archive("images", "all")
    build.archive("sounds", "all")

    # Put script files into the scripts archive.
    build.classify("game/**.ttf", "scripts")
    build.classify("game/**.rpyc", "scripts")

    # Put images into the images archive.
    build.classify("game/**.jpg", "images")
    build.classify("game/**.png", "images")
    build.classify("game/**.avi", "images")
    build.classify("game/**.webp", "images")
    build.classify("game/**.webm", "images")

    # Put sounds into the sounds archive.
    build.classify("game/**.ogg", "sounds")
    build.classify("game/**.wav", "sounds")
    build.classify("game/**.mp3", "sounds")

    build.include_i686 = False

In my case, I'm actually using 3 separate archives, scripts.rpa, images.rpa and sounds.rpa, just choosing to put different file types in different files.

Copy/paste this into your game... and the music files won't be "freely" available.
Thank you for this! You are the real MVP! :love: