Lost RPY files? Restore them from RPYC!

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
iichan_lolbot
Veteran
Posts: 206
Joined: Tue Dec 30, 2008 9:18 am
Projects: iichan erogame
Contact:

Lost RPY files? Restore them from RPYC!

#1 Post by iichan_lolbot »

Well, I've just finished a project that took about a month of late-evening-afterwork-development.

Original idea was to run an existing game with additional RPY file, which contain code to extract some information from RenPy runtime to make it easier to restore lost script manually.
When I realized, that I can easily decompile all non-python strings, I started to think about extracting some simple python statements.

The problem was that: there was no python script source code in runtime, I didn't want user to change anything in RenPy and also at first I didn't even knew that sources are really stored in RPYC files.

After developing a Python 2.5 bytecode decompiler (that was really fun and great experience, guys! Totally worth it!) I realized, that 2.3 and 2.6 dialicts have some differences and finally I gave up. I decided to give user an instruction how to make source code accesible in runtime, so decompiled files could be even more similar to original ones.

So, here it is. I'll be happy to hear any responses or ideas.

P.S. Special for PyTom, sorry for exposing Eileen's underwear. This picture meaning is that script shows what's *inside* RenPy game, no offence to you.

P.P.S. Work was partly inspired by this old personal message:
deinarious wrote:I'm sorry, but I no longer have the source to said games. I lost them a year or so ago when I had to reinstall Windows.
Attachments
Poster for anonymous boards. PNG+ZIP 2in1 file.
Poster for anonymous boards. PNG+ZIP 2in1 file.

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Lost RPY files? Restore them from RPYC!

#2 Post by PyTom »

I've removed the code attachment for the time being, to give creators time to weigh in on this development, before the script goes overly public.

My own feeling is that, while Ren'Py is licensed in a way that allows something like this to be created, it's also something that we don't really want out there where anyone can get it. A tool that allows one to extract game source has both good possibilities - helping people recover games and allowing for translations - and bad ones, like enabling copyright infringement.

I'd just like to let the community talk about this before everyone has this tool.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: Lost RPY files? Restore them from RPYC!

#3 Post by jack_norton »

Well, I just sent you an email about that. I can see only ONE possible use for this, and it's not really legal...it can only damage people and benefit nobody. If such script become public I'd have to stop using Ren'Py to make all future games for sure.
follow me on Image Image Image
computer games

User avatar
papillon
Arbiter of the Internets
Posts: 4107
Joined: Tue Aug 26, 2003 4:37 am
Completed: lots; see website!
Projects: something mysterious involving yuri, usually
Organization: Hanako Games
Tumblr: hanakogames
Contact:

Re: Lost RPY files? Restore them from RPYC!

#4 Post by papillon »

Such tools have been made public for other game engines in the past and they usually don't cause as much trouble as you'd think. It's more common to have a few sneering folk poke around inside your game and scoff that they could do better than to have them actually nick the code and reuse it (it's not that easy to make sense of or repurpose other people's programming that wasn't designed to be easily portable!) or to edit the game a little and try to resell it. The latter happens most often with people who can't program at all but can only edit enough to get to static resources (like graphics) and alter them to put their names on things.

Given Jack's current DRM system as I understand it, it would affect him a lot more than most other people.

OTOH I know such tools do already exist to at least some extent, I've seen reports on certain forums of people having a look inside certain RenPy games.

I would personally prefer such things not to be publicised here, but I don't think of it as the end of the world.

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: Lost RPY files? Restore them from RPYC!

#5 Post by jack_norton »

Well it would be enough that python blocks can't be decompiled, as for image/text I wouldn't mind.
follow me on Image Image Image
computer games

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

Re: Lost RPY files? Restore them from RPYC!

#6 Post by DaFool »

Main reason why I'm into open development and not so secretive about projects anymore. The earlier you post about something you're working on, the more it will be credited to you, and will make for effective evidence in any App store like wholesale copying infringement cases.

User avatar
backansi
Veteran
Posts: 224
Joined: Sun May 31, 2009 7:15 am
Location: Korea, Republic of
Contact:

Re: Lost RPY files? Restore them from RPYC!

#7 Post by backansi »

Confused. Was the tool attached by iichan_lolbot something like script extractor?
As a developer getting start to make a commercial game with RenPy, I feel sudden decrease of will on my project at first when I found this post.
I've seen ,of course, script extractor programs while playing many of games and I know it wouldn't be so much harm to developers but I have a feeling in my guts that I don't like it and I don't think I'm the only one who thinks like that. :wink:

Visual novel / text adventure games are easy to make, so it means if someone who have bad purposes can copy script of these games, they can do bad things more easier than when they cannot.
There's law for protecting copyrights but I don't think it would have an effect on amateur world, though the bad person will get moral judgements.

And besides that, it could be unwated tool to developers who want to show a game story through their games only and I think their wish should be protected.

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

Re: Lost RPY files? Restore them from RPYC!

#8 Post by DaFool »

Yeah, for a visual novel, once you extract the pictures, the music, AND the text, you've pretty much gotten the whole game. Only beneficial for translators and fan-patchers. And there are no Ren'Py games yet people are dying to have translated which they can't just talk to the creators directly.

Although that's a really high level of skill demonstrated there by iichan_lolbot -- whom I think is somewhat a commercial developer as well -- it's a shame there's a conflict of interest here.

With Ren'Py 6.13.9 coming out, it pretty much behooves us to release the Android version at the same time as the desktop version. I don't want any Apple App-store nightmare scenarios of some hack company uploading a mobile version of the game and steal the release window before the original creators get a chance to do so.

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Lost RPY files? Restore them from RPYC!

#9 Post by Jake »

jack_norton wrote:I can see only ONE possible use for this, and it's not really legal...it can only damage people and benefit nobody.
Celso, Celso... there's one possible use stated in the subject line of the thread; I'm pretty sure that retrieving lost script files from old projects isn't illegal now, and it certainly helps people and doesn't damage anyone! Being so melodramatic only makes you look daft.

On top of retrieving the scripts for old projects, learning from other people's coding approaches is also perfectly legal to the best of my understanding. Several countries' copyright laws even have specific provision allowing copyrighted material to be used for educational purposes! It certainly benefits people, for that matter - a large proportion of today's programmers started out looking at other people's code to see how it worked, how to structure their programs, and so on.


Since it's already trivial to use Ren'Py functions to extract the images, movies, sounds and other resources from an RPA, and any half-decent programmer could already replicate the gameplay in any Ren'Py game I've seen, I presume you're talking about removing the DRM - which is a very specific and not at all general problem, since I don't know of any other Ren'Py game developers using DRM. And frankly, you have been warned before that DRM is ultimately futile. If nobody has produced a crack for your games' DRM already, it's not because your DRM is so awesome, it's because nobody thought it was worth their time. If they don't think it's worth their time now, it's not going to necessarily suddenly become worth their time after this decompiler is more widely available. Your average novice is still going to be completely lost even with your source code, and even the best programmers working for big software houses can't realistically hope to put off determined and knowledgeable people.
jack_norton wrote:If such script become public I'd have to stop using Ren'Py to make all future games for sure.
Oh? And where are you going to go? You could code in C or C++, I suppose, but not only does that mean you'll have to do a hell of a lot more work to write your game, but also C and C++ decompilers have been around for longer than Ren'Py itself has. You could write in a higher-level language like Java or C#, maybe use a library like LWJGL or an engine like Unity that runs on one of those languages, except... both languages support reflection/introspection out of the box that allows such decompilation. I would even hazard a guess that there does not exist a single widely-used language or platform which doesn't have this kind of decompilation tool available to it in one form or another.

The fundamental reality - the bottom line - is that people's computers have to be able to interpret your game's program or script command by command, line by line in order to run the software. This means that all the commands have to be stored in the downloadable executable that you sell to your customers. Since all the data is in there, it's only a matter of time and motivation for someone to write a tool which extracts said data in some way other than just executing the program. It will always be possible, it's only not been seen for Ren'Py so far because the few people in the EVN community with sufficient programming skill and knowledge haven't been bothered to write the code to extract it until now. As support for a programming platform grows, the likelihood that a tool like this will arrive approaches certainty. I think it's safe to say that you will never, ever find a platform for game development which isn't ultimately possible to decompile like this, one way or another - you can run from minority platform to minority platform as soon as such a tool becomes available for each one if you like, but that will just mean that you have to learn a new set of quirks, deal with a new set of people and worry about poor support or flexibility at each point along the way.




I code in C#/.NET professionally, and have done for several years; there is a tool available - 'Reflector', formerly by a guy named Lutz Roeder (Microsoft employee) and now supported by RedGate (relatively respected tools company) - which provides perfect, compilable source code for any compiled .NET assembly. IIRC, it's been around about a decade... but in that decade, developers around the world have continued to make money selling .NET applications. In fact, people still use C# to code Unity games!

(For what it's worth, said tool was used on a nearly daily basis at my previous employer, and to the best of my knowledge not a single use of it was illegal.)







My opinion is that there's little actual harm, overall, to such a tool existing. Despite what Celso would like us to think, there are many actual, practical, and legally- and morally-acceptable reasons that people may want such a tool. As the original poster suggested, many people do actually lose the source code to their own projects and have only the compiled versions available; programmers who want to learn will sometimes find the ability to look at other people's code useful for the learning process. If anyone ever releases a useful library for Ren'Py in compiled form only, and neglects to mention caveats of use or valid inputs in their documentation, being able to see the source makes it more possible for people to use those libraries. It is just a tool - and like a hammer can be used for knocking in nails or murdering people, it can be used for good and bad purposes. I suspect that anyone who suggested that we ban hammers would be roundly ignored!

The bad side universally assumes bad actors - that is, people who are intentionally doing things that they know are wrong. For them to flourish, you also need people to accept their behaviour - if someone makes a game which is obviously a ripoff of another game just with replaced graphics or whatever, I have little doubt that most people will call them out on it and shun them, for example.

The more practical argument, of course, is that you can't stop it existing. The guy has already written it, and could distribute it wherever he likes, however he likes; PyTom doesn't control the whole Internet, so even if he chooses to censor it here, it will quite plausibly still be available elsewhere... and worse still, the more-naïve developers who inhabit this forum won't know about it and will continue to falsely believe their compiled games to be impenetrable. Arguably for this reason alone it's worse to censor it here than to allow it to be posted and discussed openly. Any other guy could come along and do the same work and make a similar tool at any moment, and if Ren'Py continues to grow in popularity, they certainly will.
Server error: user 'Jake' not found

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: Lost RPY files? Restore them from RPYC!

#10 Post by jack_norton »

Well the main problem for me is that would make my new online activation system easily "crackable" by people with zero coding knowledge. Despite what people think, unless you make World Of Goo, having a simple but effective DRM can increase your income by a lot. Probably, I'm the only person using Renpy that would be damaged by this, however Pytom already suggested me some other way to protect the games.

Still I don't completely agree with your philosophy - if someone want to share the code, to help others, I think it should be HIS choice, and not a "forced" one like this. Let's say I pay $10.000 a coder to make me a super complex life simulation with isometric map and walking sprites, well documented and easily moddable. Then I want it to be available to everyone for free on lemmasoft? It's my my choice, fine! But if I pay and others can use the code for free, it's not really correct I think, don't you agree? or you think every person on earth should have the right to access the source code of other people? ;)
(apart for the fact that nobody would have anything to learn from my code!)

One thing is saying that there are some people that will be able to decompile a game no matter what, another is provide a tool that can easily and quickly extract the sources like that. Last time I checked, the source code of Skyrim wasn't in public domain :lol:
follow me on Image Image Image
computer games

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Lost RPY files? Restore them from RPYC!

#11 Post by PyTom »

Jake wrote:If nobody has produced a crack for your games' DRM already, it's not because your DRM is so awesome, it's because nobody thought it was worth their time. If they don't think it's worth their time now, it's not going to necessarily suddenly become worth their time after this decompiler is more widely available.
Yes and no. Whether something is worth your time or not is - to a large degree - dependent on how much time it will take. Say I make $15/hour, and the game costs $15. It's in my interest to develop a crack if doing so will take less than one hour. (There's probably some assumption about time being fungible in there.) So in that case, the availability of a decompiler makes it far more likely that someone will find it worthwhile to decompile a game.

My sense is that at least some of the commercial creators are operating at the margins, where a few sales can have an affect on their lifestyle.
jack_norton wrote:Well, I just sent you an email about that. I can see only ONE possible use for this, and it's not really legal...it can only damage people and benefit nobody. If such script become public I'd have to stop using Ren'Py to make all future games for sure.
And, of course, this is also wrong. There are plenty of legal and moral (if not exactly legal) uses for a script like this. For example, making a game run on hardware that the current version does not support. That's illegal, as the law goes - but I don't have a problem with it. Reading the code of a game isn't illegal at all, if I understand the law correctly. (IANAL)

Even the moral aspect of this cuts both ways. It seems like a lot of this activity is inspired by the desire to make derivative works of Katawa Shoujo - even though the creators have pretty explicitly indicated that they don't want such works.

Ren'Py decompilers have existed for a while now - IIRC, I saw one a week or so after KS came out. So I don't think the world is going to end because of this.

It's a cat-and-mouse game. I can try to come up with new techniques to stop decompilation (or code injection), and sufficiently motivated people can work around those techniques. As Jake points out, this is true of any engine. And I'm not sure I will bother - it's more work for me, and I'm not sure it will help very much.

I do think it's important we have this conversation now, before a decompiler becomes widely available, so people can understand it in proper context. (Not a great thing, but probably not the end of the world, either.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Lost RPY files? Restore them from RPYC!

#12 Post by Jake »

jack_norton wrote:Well the main problem for me is that would make my new online activation system easily "crackable" by people with zero coding knowledge.
Unless your online-activation system has a variable set "BYPASS_DRM = False" at the top of each code file, I think you'll find that it'll still require a fair bit of coding knowledge to bypass! The vast majority of people will look at the source code for your games and shrug and give up, seriously. On top of this they have to understand how to re-package the game into a runnable form, which isn't immediately obvious either, and would require extra not-immediately-obvious work to extract all of the resources and reassemble them in the correct places.

Sure, it lowers the bar, but there's still a bar... and the people who have the knowledge and skill to pass it still have to think it's worth their time.

The important part, though, is that the release of this kind of tool is more or less inevitable for any kind of compiled language, even if just as an academic exercise to the programmer to see if he can make it. The source code for Ren'Py is entirely open, which means that someone who wants to know how .rpyc files are put together only has to go and look at the Ren'Py code to find out. That this guy has done it proves that it's possible, so even if you convince this guy to delete his project, another one will crop up sooner or later. There are a couple of places on the 'net that you can find code which claims to decompile .rpyc files already, unrelated to this guy.
jack_norton wrote: Still I don't completely agree with your philosophy - if someone want to share the code, to help others, I think it should be HIS choice, and not a "forced" one like this.
...
But if I pay and others can use the code for free, it's not really correct I think, don't you agree? or you think every person on earth should have the right to access the source code of other people? ;)
As I said - copyright law in several countries already makes provision for people to commit acts which would otherwise be illegal if they're for educational purposes. In the general case, it's not what I think - it's what the people who make our laws and the judges that decide cases think. I'm not saying that I think it's universally a good thing for people to go around decompiling every program that they come across, but in a lot of cases I don't think it's a bad thing either. Tell me, what's the absolute difference between someone who can read the executable file opening the .exe of a compiled C game that you distribute in a hex editor and following it through to see how stuff is done (unlikely, but technically possible), someone opening a .rpyc file in a hex editor and following it through, and someone decompiling the .rpyc file into a more-readable form and following it through to see how stuff is done?


And you're possibly also missing an important point - it doesn't mean people can use the code for free, because your code is still protected by copyright. Someone who decompiles your program to find out how it works learns the techniques, but can't literally lift and recompile your code and redistribute it without infringing your copyright; to do it legally, he would need to license it from you. He can't even publish the source code in text form legally - he can just read it.

Of course, without such a tool as the one we're discussing available, you'd have no way of finding out whether people had taken your code and re-compiled it into their game or whether they'd just written a similar system from scratch - you can also use such a tool to look at other people's games if you suspect they've stolen your code and prove it!
Server error: user 'Jake' not found

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Lost RPY files? Restore them from RPYC!

#13 Post by PyTom »

Jake wrote:And you're possibly also missing an important point - it doesn't mean people can use the code for free, because your code is still protected by copyright. Someone who decompiles your program to find out how it works learns the techniques, but can't literally lift and recompile your code and redistribute it without infringing your copyright; to do it legally, he would need to license it from you. He can't even publish the source code in text form legally - he can just read it.
Copyright is pretty meaningless here.

The only way to enforce it is through a private lawsuit, and I don't think anyone involved in VN making has the free cash for that sort of thing. (Well, there are things like a DMCA takedown and so on - but those are easy for someone to call your bluff on.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: Lost RPY files? Restore them from RPYC!

#14 Post by jack_norton »

PyTom wrote:The only way to enforce it is through a private lawsuit, and I don't think anyone involved in VN making has the free cash for that sort of thing. (Well, there are things like a DMCA takedown and so on - but those are easy for someone to call your bluff on.)
Nah you don't need that, if you can prove that someone stole your code/assets, and is trying to resell a rip-off, you simply contact their vendor and they'll immediately shut down. It has happened already in the past several times, and every time was enough an email to the vendor (BMT, Plimus, Paypal, etc) with the complaint and the game was blocked from sale very quickly. They were blantant ripoff so easy to see they stole art/music (which is incidentally also a reason I always want to have my own art in my games, and not royalty free stuff).
Jake wrote:you can also use such a tool to look at other people's games if you suspect they've stolen your code and prove it!
Yes I missed this possibility indeed :) makes what I said above easier to prove.
follow me on Image Image Image
computer games

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

Re: Lost RPY files? Restore them from RPYC!

#15 Post by DaFool »

Don't really care about people potentially poking into the game (acknowledging its superior craftmanship!) or even not paying for it (at least they're playing it!)

These are what I'm afraid of if it's as easy to decompile:

http://ironhidegames.com/post.php?id=38

http://pyrogoth.deviantart.com/journal/ ... -281433325

http://forums.penny-arcade.com/discussi ... -your-help

http://www.rockpapershotgun.com/2011/01 ... -dungeons/

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]