Page 1 of 1

.rpyc files and obfuscation

Posted: Mon Jun 17, 2013 12:06 am
by trueheartsdestiny
Hi guys.

I just read some disheartening news about free Ren'Py games getting stolen and earning people other than the creator a nice chunk of profit. This has brought me to think of how the "game" folder look for some of the games I played. I noticed that some games have .rpy and .rpyc files while other just have .rpyc files. After some poking around, I figure that .rpyc files seems to hide the original code. Yet, if I tried to delete the .rpy files in the folder, the game would stop working.

So my question is, how do other game makers do it? How do their games not rely on .rpy files? What about images in the game? Where do those pictures go?

Re: .rpyc files and obfuscation

Posted: Mon Jun 17, 2013 12:51 am
by apricotorange
IIRC, if you have the .rpyc files, you shouldn't need the .rpy files to run the game. Not sure why that isn't working for you. See http://www.renpy.org/doc/html/build.html#archives for the most common way used to protect the files in Ren'Py games. That said, nothing is going to stop someone who is sufficiently determined from pirating your game; this happens to even the biggest commercial PC games with publishers who spend a lot of money to build elaborate DRM schemes.

(On a side note, if someone is selling your game without your permission, I would suggest talking to a lawyer; it's a pretty open-and-shut copyright infringement case.)

Re: .rpyc files and obfuscation

Posted: Mon Jun 17, 2013 12:57 am
by PyTom
trueheartsdestiny wrote:I just read some disheartening news about free Ren'Py games getting stolen and earning people other than the creator a nice chunk of profit.
Can you point out where this has happened? As far as I can tell, this is more of a theoretical problem - people may pirate games, but it's pretty rare for someone to take credit and make money of a game someone else created.
This has brought me to think of how the "game" folder look for some of the games I played. I noticed that some games have .rpy and .rpyc files while other just have .rpyc files. After some poking around, I figure that .rpyc files seems to hide the original code. Yet, if I tried to delete the .rpy files in the folder, the game would stop working.
Consider:

Code: Select all

init python:
    build.classify("**.rpy", None)
Actually deleting the .rpy files is scary - too much potential for data loss. This command will tell Ren'Py to not include rpy files in the distributions.

Note that .rpyc files are obfuscation - people can recover something resembling a .rpy script from a .rpyc file. That's true of every script file format - the game has to be able to run, after all.

Re: .rpyc files and obfuscation

Posted: Mon Jun 17, 2013 1:12 am
by trueheartsdestiny
Thank you for all of the responses! They were very helpful.

Is there a code that would also prevent image files from showing up in the game folder as well? Does this affect the size of the packaged game? It does seem to, but I don't want to leap to any conclusions.

Re: .rpyc files and obfuscation

Posted: Mon Jun 17, 2013 1:52 am
by Ryue
trueheartsdestiny wrote:Thank you for all of the responses! They were very helpful.

Is there a code that would also prevent image files from showing up in the game folder as well? Does this affect the size of the packaged game? It does seem to, but I don't want to leap to any conclusions.
build.classify("**.jpg", None)
build.classify("**.png", None)
.....

Thus for each filetype (aka file ending) you want to be obfuscated you need to include one such line.
But be sure to test the distribution afterwards......some of the methods for accessing files won't work any longer (although that problem is restricted to a handful of commands that probably most ppl won't use anyways, but I wanted to mention it in case you stumble upon a problem there). With testing it you can see if it all functions
as intended (normally like I said it should be no problem as only a few very specific commands are affected).

Re: .rpyc files and obfuscation

Posted: Mon Jun 17, 2013 1:55 am
by pwisaguacate
trueheartsdestiny wrote:Is there a code that would also prevent image files from showing up in the game folder as well?
If you haven't yet, click on "Build Distributions" once (no need to build) to add build information to the end of options.rpy, and you will find archive stuff too at the end of options.rpy.

Re: .rpyc files and obfuscation

Posted: Mon Jun 17, 2013 1:55 am
by PyTom
You don't want that - the .jpg and .png files won't show up, but then the game won't be able to use them either.

You likely want to archive the files instead - check out the docs for more on that.

Re: .rpyc files and obfuscation

Posted: Mon Jun 17, 2013 2:05 am
by netravelr
As a commercial developer, I'm also wondering where exactly you've seen an instance of someone stealing someone's code and passing it off as their own. I've seen it done for Flash games and the like, but I don't think it's happened to RenPy, as far as I know.

Working with RenPy you accept the risk that someone may have an easier time getting to your source code than others. For the images, you can put them into an archive; but again someone can get them from .rpy files if they really tried. Since all of the functions and code are provided, it's fairly trivial to be able to figure out when and how certain functions are being called through the source. You need to weigh that with your desire to use the engine. I personally don't think it's too much of an issue, but if you have evidence to the contrary, I'd love to hear it.

That being said, you can do things to make it harder for people to figure out what your code is doing; but a semi-skilled programmer would be able to decompile anything made in a publicly available engine, even using something like Unity or Unreal. But it's not something to worry about for 95% of people.

Hope this helps you!

Re: .rpyc files and obfuscation

Posted: Mon Jun 17, 2013 2:12 am
by Ryue
Wolf wrote:
trueheartsdestiny wrote:Thank you for all of the responses! They were very helpful.

Is there a code that would also prevent image files from showing up in the game folder as well? Does this affect the size of the packaged game? It does seem to, but I don't want to leap to any conclusions.
build.classify("**.jpg", None)
build.classify("**.png", None)
.....

Thus for each filetype (aka file ending) you want to be obfuscated you need to include one such line.
But be sure to test the distribution afterwards......some of the methods for accessing files won't work any longer (although that problem is restricted to a handful of commands that probably most ppl won't use anyways, but I wanted to mention it in case you stumble upon a problem there). With testing it you can see if it all functions
as intended (normally like I said it should be no problem as only a few very specific commands are affected).
Just had to look twice :/ meant:
build.classify("**.jpg", "archive")
build.classify("**.png", "archive")

that way they are in the archive