Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect Game Resources #19790

Closed
domske opened this issue Jun 26, 2018 · 45 comments
Closed

Protect Game Resources #19790

domske opened this issue Jun 26, 2018 · 45 comments
Labels

Comments

@domske
Copy link

domske commented Jun 26, 2018

Godot version:
3.0.4

OS/device including version:
Windows 10
Perhaps all supported platforms.

Issue description:
Protect the source code and resources of the game.
Currently it's easy to "decompile" / extract all resources including scripts.
Update: GD-Scripts are binary in pck-file. But the scenes are stored in plain text and editable.

Steps to reproduce:
e.g. Export as Windows Desktop (exe). Tested with the classic Godot (not mono)
You'll get following files:

  • YourGame.exe
  • YourGame.pck (package of all resources. Not encrypted.)

The same issue may affect all other platforms. Including Android and iOS. All assets and scripts are visible to anyone with a little knowledge of files.

@kyledayton
Copy link

kyledayton commented Jun 26, 2018

I know you can encrypt the script bytecode by compiling godot from source with the SCRIPT_AES256_ENCRYPTION_KEY environment variable set during compilation, but I don't think this encrypts the assets:

if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):

@vnen
Copy link
Member

vnen commented Jun 27, 2018

Related to #8614.

@vnen
Copy link
Member

vnen commented Jun 27, 2018

BTW, I'm not sure why this is much of a problem. It's not exactly easy to extract a PCK if the person in question is not aware of Godot. And a dedicated person would be able to extract them no matter what you do..

@LikeLakers2
Copy link
Contributor

LikeLakers2 commented Jun 27, 2018

And even if you are able to extract them, all the scripts are (at least by default) compiled, and any scene files are converted to .scn which itself is binary.

Not only that, I'm not sure why it matters that people can access the files. Anyone who wants to cheat will cheat, and anyone who wants to mod a game will mod. After they download the game, that copy is theirs to screw around with, and generally do whatever with (within the bounds of fair use, of course). When they do that, it's their own fault if the game screws up, or if they get banned from that game (if online) for cheating -- not the dev's fault.

@domske
Copy link
Author

domske commented Jun 27, 2018

Relax 😄 What's up guys? Just reported the fact that the pck file displays the source code as plain text and the most resources are extractable. For example with the Dragon Unpacker Hyper Ripper.
For me it's not a problem. Currently I'm switching to another engine. This is not the single reason.
But whatever ... this does not change the fact that the developers sources are insecure. For an open source project, it's ok. But not for proprietary projects.
I do not understand some amusing reactions about this issue. You can view the file with a hex-editor like HxD and scroll the file or search for source code. And some binary or textures (e.g. png).
In my opinion it's not the worst idea to protect this data. It's not a trivial issue, I know. But for commercial projects this could be a KO issue. The exported project is just a runner for the sources package.

Have a nice day. :)

@LikeLakers2
Copy link
Contributor

the pck file displays the source code as plain text

I just checked. Exported .tscn (scene) files are indeed plain text, but .gd (GDscript) files are converted to binary. Sure you can read how a scene is constructed, but to read the source code you'd have to decompile it -- which is a pain to do and most people don't seem to want to go through that.

most resources are extractable. For example with the Dragon Unpacker Hyper Ripper.

Resources exported by Unreal Engine, Game Maker Studio, and Unity are also all extractable. Also, just tried this Hyper Ripper myself, wasn't able to extract any scene or source code files. I could extract my application's icon (the only graphic I had in my project) however -- but people have been extracting sprites, models, textures, and sounds from games for years.

The exported project is just a runner for the sources package.

So are Game Maker Studio projects. I believe Unreal Engine works the same too? Unsure about Unity.

@domske
Copy link
Author

domske commented Jun 27, 2018

Ok, you're right. My fault. The .gd scripts are not stored in plain text. Sorry.
But in my opinion there are too much plain text in this file. And the assets too.
btw. the Hyper Ripper only extract known formats like png. It can't extract Godot formats like scenes or scripts.

I checked this again. In my case I have a script with a lot of exports to adjust parameters of a node.
It looked like script sources. 😄 Now I see it's the scene indeed.
But I be able to change some parameters, store the file (pck) and see the results. It works. You can change anything in the scene including parameters provided from scripts.
Ok, you can say, I don't care what people do with my software. Change the sources whatever. They could use a Trainer (cheating). It's not completely wrong. In multiplayer games, the developer must never trust the client. Whatever ...

I have a bad feeling about these public sources in the package file. The editiable scenes in exported projects. It's like ini-files or settings you never provided.
I just wanted to report this issue after viewed the file and found some plain text ressources like the scenes and other resources like meshes (e.g. PoolVector3Array) and other assets.
I think it's ok for amateur projects. Maybe for a tiny indie-game too. And AAA-Studios maybe never use Godot. Unfortunately. But in my opinion it's not a bad idea to protect as much as possible. Why to provide editable sources? I think this is a topic for proprietary / commercial projects.
As wrote, there is too much plain text in this package for me.

You can close this issue if you want. Or focus to the open scenes and resources. And protect it by obfuscating, hashes or an encryption. Just to reduce the hackers. Nothing is safe. That's right. But is this a reason to give up? The gaming industry should remove DRM and other protecting software, because people will hack this. Right? 😄

Update:
Just a demonstration (animated gif). Maybe not the best example. But you can see what I mean.
export
btw: How to hide the CMD window on published games?

Thanks for your time. :)

@reduz
Copy link
Member

reduz commented Jun 28, 2018 via email

@vnen
Copy link
Member

vnen commented Jun 28, 2018

If you're worried about piracy, this kind of obfuscation won't help you. You'd need some actual DRM protection, which Godot won't provide (since there are many ways to do it, and it's not a vital thing). So you need a third-party tool for this.

If you're worried about copyright, the law enforcement might be a better bet than trying to obfuscate the assets in your game.

It's not a matter of open/closed project. Any dedicated person will be able to extract the assets and change the base game. Some companies use this to their advantage (see Counter-Strike and Team Fortress for example). The mod scene is quite big and many players might buy your game just to apply the mods.

Suppose we provide support for encrypting the assets. The key must be stored in the executable, since they need to be unencrypted to be used by the game. Considering that Godot is open source, anyone can check out what is the encryption algorithm and where such key is stored. With that information wouldn't be so hard to break through the encryption anyway. You could change the Godot source to modify the algorithm/key location (but then, you already can change the source to add this).

I agree with binary conversion (and that was always in the plan) since it makes everything faster to load. But in terms of protection there's not that much gain, only a false sense of security. Obfuscation is not really security.

I think this is an overreaction and other engines might not offer that much protection you're thinking they do.

@domske
Copy link
Author

domske commented Jun 28, 2018

That's absolutely correct. But this is not exactly my intention. I just don't like editable plain text in built applications. For example the scenes. As shown on the gif of my previous post.
It's not alone a security or privacy question. It's more about preventability. How obfuscation keeps some of the people away.
But as reduz wrote, 3.1 will bring some changes? Is this documented? Any links? Thanks.

If I am still alone with this opinion, it is regrettable. But maybe I'm not able to articulate correctly in english. I see many confused- and laugh- emoji without a text message about the reason. That's pity.
Godot is a great game engine. I still think that this is a important issue.
I've created this ticket with good intention to improve this software. I never thought that this topic met with so much opposition. I'm a bit disappointed. 😄 It's ok, I'm alone with this opinion.
But this issue and conversation helped me alot for my decisions. Thanks for it.

@OvermindDL1
Copy link

@domske I don't think that it is that it is not wanted, but rather that this is as impossible topic. If the resources have to be used, textures unpacked into memory, models transferred to the GPU, etc... etc... then there are always ways to get at the information since it is already local. The top end DRMs for games run the entire things in virtual machines with layers upon layers of obfuscation and slowdown and they still get broken. It is an impossible thing if the resources are needed to be used at all.

@domske
Copy link
Author

domske commented Jun 28, 2018

I know. This is a never ending story. A cold war between a publisher and pirates. 😄 But a necessity.
Whatever.. This is too much. I never wanted such highly (impossible) security. Just a prevention of publishing editable plaintext that could be prevented. Just step by step. For the first step focus the scenes and the fact that everyone can edit it in a simplest way. It's not my intention to prevent all modifications or asset extractions by hackers. Because this is impossible. But you can reduce the amount of them. For example publishing a game in javascript in best clean code with comments vs obfuscated code. That the only reason to obfuscate javascript. To reduce the potentially pirates. The same with the Godot pck-file. The guys who reads the file and found nothing than ugly binary code will close the file again in a disappointed way. Of course, a small percentage will continue and see it as a challenge. 😸

@volzhs
Copy link
Contributor

volzhs commented Jun 29, 2018

I understood what @domske said.
we can't protect our project perfectly but want to prevent to hack in 2 minutes without special knowledge.
I think that's a reasonable request. 😃

@vnen
Copy link
Member

vnen commented Jun 29, 2018

That the only reason to obfuscate javascript. To reduce the potentially pirates.

Not really. "Uglifying" the code is used to make it more compact, reducing download time / bandwidth usage. It's not very hard to undo it (just put in a code formatter, like the browser console provides).

How to hide the CMD window on published games?

It is not shown if you exported without debug.

we can't protect our project perfectly but want to prevent to hack in 2 minutes without special knowledge.
I think that's a reasonable request.

Sure, and using binary resources would be enough for that. I don't know why @domske has such a pessimistic view considering that's already established that this will be done.

@domske
Copy link
Author

domske commented Jun 29, 2018

@volzhs Thanks, you understood me. 😃

@vnen Of course "minifying" is for download and bandwidth optimization. But also for obfuscating. That's why the word "uglifying" is also used for this. There are different modes to do this. A strong mode removes variable names and comments, etc.
You mean that there is no difference between clean-code and uglified code for hackers? In both cases the amount of hackers is equal? Regardless of formatters, uglified code does not only remove all comments, spaces and the pretty format. It also replaces variable names and in best case it ofuscate the context.
This code is definitely less attractive to hackers. It tooks longer and need more reverse engineering. And sometimes a reason to give up. What's why uglifying exists, too. Not only for download reason.
It's about hacking in 2 minutes without special knowledge and effort.

Do not see this in an extreme contrast. "Secured": YES or NO. It's more about "Secured:" NO, ABIT, BETTER, ALMOST, RESERVED. And the pck-file has the state ABIT and the goal is BETTER. 😄
Just improve it step by step. At first focus the open scenes in the pck-file.
There are many opportunities to do this. I can't say that's the best solution. I just don't like editable plain-text in published binary files like the pck-file.
It's a bad attitude to just leave it open just because you think it's going to be hacked anyway. If so, we could just build a runner for the project sources and publish this to the customers. No offense.

I have no pessimistic view on this. I don't know the changes of Godot in the future. I only reported the actual state. That we all can consider about this issue. If this is already established, that's great.
I don't care about to close this ticket for the reason: "we will work on it, but not especially on this issue. It will implemented successively." Fine :) My intention was just to draw attention to this. And discuss options. I understand that the highest priority of this open source project is the usage itself. Like features, performance, etc. Without consider the usage of published games. But this is a bit ignorant.
As already wrote, if this is already established that this will be done, you can ignore this issue and / or close it.

@vnen
Copy link
Member

vnen commented Jun 30, 2018

I'm closing this since DRM won't be added and conversion to binary is already tracked by #12452.

@domske
Copy link
Author

domske commented Jun 30, 2018

I don’t know how we pointed to DRM. 😄 Maybe my fault. This wasn't the topic. Ok, I missed this ticket #12452. It's related to this issue, that’s correct. What a misunderstanding of my ticket. ^^ Ok, not for all. Whatever ... I‘m look forward to version 3.1.

@ArdaE
Copy link
Contributor

ArdaE commented Sep 10, 2018

I agree with @domske on this one. I've run some tests, and:

  • Making my local variables' names longer made the exported .gdc files larger
  • Adding more comments made the exported .gdc files larger

These are both very surprising. I don't understand why local variable names (variables that are defined within the body of a function) affect the size of exported .gdc files. Comments affecting the size of exported .gdc files is even more mind boggling. I'll get back to these, but first:

A hacker will hack, yes. I used to hack games when I was 14, to make heroes invincible, levels impossible to fail, etc. But the code I hacked was never in plain sight in front of me; the variable names were never visible, and I never saw the name of a single function. All that was visible to me was machine code -- disassembled assembly code to be precise -- with addresses for variables. So, I wouldn't have been able to extract any of that code and repurpose it without spending more time than it's worth (not that I would have regardless, but there are lots of people in the world who would). Even if some of you disagree, I see a lot of value in having the same level of "protection by obfuscation" in the commercial products that I create. In other words, I don't want my algorithms to be visible in their original form after Godot loads them into memory. Some of you say converting to binary is enough for that, but I disagree. Even if it Godot weren't open source (which makes the dissection of any generated binaries much easier), my 14 year old self would have been able to see all that content using a basic debugger. I sure won't be releasing any commercial software that allows easy access to my class, function, and variable names, let alone my comments. And I also respectfully disagree with the "law enforcement might be a better bet" comment. What indie developer has the time or resources to sue someone across the world? Would you even have the time to dissect competitors' code to see if they stole from you? Even if you were to win a lawsuit, what do you think are your chances to successfully collect the money for the damages from an individual on the other side of the world? Prevention is your best bet.

This is not about whether someone can hack and modify your code. It's about protecting your algorithms and intellectual property, such that the time and effort required to reverse engineer would be so high that the people with that skill wouldn't waste their time trying to understand your obfuscated code. In other words, make it difficult enough so that the people who have the skill would find it easier to build their own thing than to steal yours, and the ones without the skill would be limited to minor hacks. Such minor hacks are fun for the kids who can do them anyway, and have no financial harm to the developer as long as they don't distribute a version of your code that bypasses its copy-protection mechanisms. And pushing competitors to come up with their own algorithms is better for everyone, including users; more ideas and more innovation results in more interesting products.

Acknowledging the problem is the first step. Once the problem is acknowledged:

  1. The solution for comments should be simple. They simply should not be in an exported binary.

  2. The solution for local variable names should be simple too. Unless Godot allows dynamic lookup of them, they simply shouldn't be in an exported binary either. If Godot does allow dynamic lookup of local variables, then they can be treated under the same umbrella as other identifiers that I'll cover in item 3 below .

  3. The solution for dynamically accessible identifiers such as nodes, functions, and member variables isn't simple at all, and cannot be done without limiting some of the dynamic features of gdscript. For example, the fact that you can form a string at runtime (e.g. by concatenating two others) and look up a node instance via the string you've just created means that Godot cannot simply obfuscate node names without breaking that dynamic feature (I believe similar dynamic lookup features exist for functions and member variables too, so the same applies to them). However, smart solutions can easily be created that both obfuscate and are able to handle such cases. For example, identifiers could be obfuscated by default, on export, but with the ability to bypass the obfuscator for specific identifiers when desired (e.g. those that start with a specific, reserved prefix).

The solutions can be discussed, but the first step is to acknowledge the problem with a more open mind, without dismissing the problem and deferring it to law enforcement.

P.S. As a bonus, obfuscating identifier names should also help improve performance. For identifiers that don't need to be looked up by dynamically created strings (i.e. most identifiers), making their names as short as possible should speed up any code that does look up things by name (i.e. gdscript and Godot in general).

@Zireael07
Copy link
Contributor

In GDScript, everything is dynamic, so 2 doesn't apply.

@ArdaE
Copy link
Contributor

ArdaE commented Sep 11, 2018

Good news; I did another test this morning, and it seems the size increase due to comments is just a bug. From what I can see, comments are always converted to the same binary content; when I change the content of the comments without changing their size, the created .gdc file remains the same, which means the information within the comments is lost. So scrap item 1 from my list for the purposes of this discussion, as it needs to be a different issue entry on its own.

Item 3 remains.

@girng
Copy link

girng commented Jan 2, 2019

@domske

Relax 😄 What's up guys? Just reported the fact that the pck file displays the source code as plain text and the most resources are extractable. For example with the Dragon Unpacker Hyper Ripper.
For me it's not a problem. Currently I'm switching to another engine. This is not the single reason.
But whatever ... this does not change the fact that the developers sources are insecure. For an open source project, it's ok. But not for proprietary projects.
I do not understand some amusing reactions about this issue. You can view the file with a hex-editor like HxD and scroll the file or search for source code. And some binary or textures (e.g. png).
In my opinion it's not the worst idea to protect this data. It's not a trivial issue, I know. But for commercial projects this could be a KO issue. The exported project is just a runner for the sources package.

Have a nice day. :)

i just tested this actually. i opened my .pck file in visual studio code, and it had over 100k lines, but i searched for a variable that i had in my script, and the entire script was in there lol

maybe once this is merged, and you choose compiled under the script tab, this issue and #24716 will be fixed?

@ArdaE
Copy link
Contributor

ArdaE commented Jan 3, 2019

Game asset sites also require their assets to be sufficiently protected when incorporated into an app. So we are legally required to provide reasonable protection of any purchased assets we use.

I still don't understand why this is issue is closed, and disagree with the cheered obfuscation is not protection, etc. comments above. By the same logic, do you not put locks on your house doors because people who are willing enough will find a way in anyway? I don't know about you, but I like to lock my doors, and I am legally required to do so for the assets I use.

In summary:

  • Assets need to be reasonably protected
  • Scripts need to be obfuscated (see item 3 in my earlier list above)

@Calinou
Copy link
Member

Calinou commented Jan 3, 2019

By the same logic, do you not put locks on your house doors because people who are willing enough will find a way in anyway? I don't know about you, but I like to lock my doors, and I am legally required to do so for the assets I use.

I don't think the comparison with locks makes sense, as locks are not necessarily unfair. You could see it as a parallel to encrypting your own files for privacy's sake.

@Sslaxx
Copy link

Sslaxx commented Jan 4, 2019

Wondering why this has been closed. As far as I understand it, #24582 only partially fixes this issue by only encrypting scripts. Scenes and assets are still not encrypted - this is not strictly a matter of DRM, as @ArdaE has pointed out this could prevent the use of a good number of assets (even some otherwise freely available ones) with Godot. This isn't DRM; merely allowing Godot to extend legally-required (minimum) protections when necessary.

If people want to use an actual DRM scheme ala Denuvo, then the onus of implementation (and licensing etc) is on them.

@raymoo
Copy link
Contributor

raymoo commented Jan 9, 2019

What is your definition of DRM? I think a common one is "technical measures to prevent unauthorized or undesired use of some work". Under that definition, what you describe is DRM, since it is a technical measure (encryption) to prevent the independent use of game assets.

@ArdaE
Copy link
Contributor

ArdaE commented Jan 9, 2019

@raymoo, note @Sslaxx's use of "strictly" and "actual" to qualify his uses of the word DRM. "Digital Rights Management", is a measure to manage your "rights" -- as the name suggests -- to content you've purchased. In its common use (and the only type I've seen), it applies directly to content you've purchased (a song, a game, etc.) by attempting to prevent you from redistributing it while allowing you to use it freely (how well it achieves that is questionable, as the attempt to prevent redistribution usually interferes with your legal use rights, but that's the topic of another discussion). Now, when you purchase a game, you don't purchase the rights to the assets within the game; you purchase some rights/license to the game. I wouldn't use the word DRM, in its strict form, to refer to the protection of assets within a game, because you have no "rights" to those assets; the game does. You only have a right to play the game. So in my opinion, and in the common use of the DRM technology, there's nothing to manage for DRM when you have no "right" to start with (as far as embedded assets are concerned).

One way to protect resources you have no right to is to modify them in irreversible ways that still allow a game to use them while making their extraction in their original form impossible or very difficult. I wouldn't define that as DRM. If it were, merely compiling a C++ program would have to also be defined as DRM.

We can go down this rabbit hole and discuss until the end of the world what DRM is, and I'm sure you can come up with a hundred different creative ways to rebuke what I just wrote, but I don't see how any of that is beneficial to this discussion. Whatever the accepted meaning of DRM (or our understanding of it as individuals) is, the issue remains.

@bruvzg
Copy link
Member

bruvzg commented Jan 9, 2019

What is your definition of DRM?

You can protect assets by encrypting .pck file content. Partially done in #24582, and it's completely reasonable to extend encryption to scenes/resources and imported assets. This part should be implemented in engine.

And you can protect encryption key stored inside exported executable (by default it's quite easy to extract it) using "actual DRM ala Denuvo". This part should be left for third-party tools.

@raymoo
Copy link
Contributor

raymoo commented Jan 14, 2019

It's definitely not the main purpose of this discussion, but it appears like sslaxx is arguing that because it wouldn't actually. be DRM, it's not as bad. I was trying to refute that particular (implicit) point. I might have been wrong about that implication.

For my definition, I just used that which the GPLv3 is based on (technical measures to prevent use unwanted by the copyright holders or authors). I can make one based on expanding DRM as an abbreviation too, though (like you did). The rights it refers to are the copyright holders' "rights", not the users. This is how I usually see the term described by others (including pro-DRM people). In that case restrictions on the use of a game is DRM because it is managing the LICENSOR's "rights", not the licensee's. In the case of licensed assets, it is the "rights" of the copyright holders of the assets.

@MikeLorenz
Copy link

FWIW, I agree 100% with ArdaE: assets need to be reasonably protected & scripts need to be obfuscated. I've been evaluating Godot, and this is a deal-killer for me personally. I am only writing this because business owners (like restaurants, for example) rarely get feedback that tells them why people are not coming. They'll get negative feedback from existing customers, but they never find out why people don't come in the first place.

One thing that is often mentioned about Godot is that it doesn't have as 'sexy' a gallery of Godot games that some other engines have. I'm not going to say it's all because of obfuscation, but serious game developers and artists -- the kind who create games that make great videos -- do care about it.

I hate to write a negative comment, because there is really a lot to praise about Godot. I would love to use it. But if "locking my front door" is next to impossible, I simply can't.

@bruvzg
Copy link
Member

bruvzg commented Mar 12, 2019

I've been evaluating Godot, and this is a deal-killer for me personally.

Do other game engines have any built-it "assets protection"? Nop, Unity and Unreal forums are full of the similar "Protect game resources" topics, with the exactly same answer: "it's pointless". (And asset stores are full of third-party snake-oil tools).

@walknotes
Copy link

If you're worried about piracy, this kind of obfuscation won't help you. You'd need some actual DRM protection, which Godot won't provide (since there are many ways to do it, and it's not a vital thing). So you need a third-party tool for this.

If you're worried about copyright, the law enforcement might be a better bet than trying to obfuscate the assets in your game.

It's not a matter of open/closed project. Any dedicated person will be able to extract the assets and change the base game. Some companies use this to their advantage (see Counter-Strike and Team Fortress for example). The mod scene is quite big and many players might buy your game just to apply the mods.

Suppose we provide support for encrypting the assets. The key must be stored in the executable, since they need to be unencrypted to be used by the game. Considering that Godot is open source, anyone can check out what is the encryption algorithm and where such key is stored. With that information wouldn't be so hard to break through the encryption anyway. You could change the Godot source to modify the algorithm/key location (but then, you already can change the source to add this).

I agree with binary conversion (and that was always in the plan) since it makes everything faster to load. But in terms of protection there's not that much gain, only a false sense of security. Obfuscation is not really security.

I think this is an overreaction and other engines might not offer that much protection you're thinking they do.

it's not about CAN or CANNOT, it's about how much steallers have to pay.

easy or hard is different to different person, "not much encrypt" to you, but a lot of learning time and knowledge (or money) have to pay, for thieves. You don't feel it's hard because you already have that knowledge, after years of learning. another easy to crack step of encryption, means 90% fewer thieves have that ability.

in some country like China, laws not work for ordinary people. almost all company and the whole government are waiting to steal from all over the world. steallings like tradings, even the richest government want to steal your project, if it cost more than payback, they won't do it.

so it's not about CAN or CANNOT, every lock CAN be broken, but every house have it. Laws can't replace Locks.

@LikeLakers2
Copy link
Contributor

LikeLakers2 commented Jun 8, 2020

You seem keen to tell us that a lock would be effective. Tell us, then: How would we implement such a lock?

If we implement it into the engine, then people can examine the source code (which is far easier than you're making it out to be for anyone who's even slightly determined) and figure out how we store the key, how to access it, and what encryption method(s) we use. You might call it hard to crack, but I guarantee you that if we were to implement it into the engine proper, it wouldn't take long before someone copies the decryption code from the engine and uses it for a "Godot game decrypter"... making the lock effectively useless.

You are much better off learning C++ and implementing your own asset protection system, than us doing the work for you. Then, they would have to figure it out from scratch because the code wouldn't be public.

@dbrova15
Copy link

In my country there is a saying "Locks from kind people". Any lock can be broken, it's a matter of time, but every house has a lock. The fact is that the better the lock, the longer it takes to break it, and the time and effort may not pay off. Therefore, thieves are more likely to steal things from poor houses with bad locks than from rich houses with good locks.

If you implement the ability to encrypt all files as scripts are encrypted now, users will be grateful. And in general, if this is a project and with the source code someone can make such a plug-in for Godot and all that remains is to implement it into the project. I would, but unfortunately I don't know C ++.

@LikeLakers2
Copy link
Contributor

LikeLakers2 commented Jul 27, 2020

@dbrova15

The fact is that the better the lock, the longer it takes to break it, and the time and effort may not pay off.

This may hold true in the real world, where you don't see the locks and tumblers within a real lock, making it hard to know how to lock-pick -- but Godot is open-source. That doesn't work here.

That's a problem, because it's the equivalent of a lock being transparent -- if you can see how far you need to push each pin up, you don't need to worry about whether you've pushed a pin too far up or not. You know the key to that door now -- you can just create your own copy of the key.

See, Godot being open-source means that if Godot were to include some sort of resource protection, it would need to have that code included with the engine's source code. The source code being openly available (you don't even need to login to GitHub to download a copy), means that anybody could search the code-base for the part that encrypts/decrypts resources, and reverse engineer it. Then they can use that knowledge to build a program that will automatically search out the encryption key -- and use that to decrypt the resources.

All that might sound hard, but I'll be honest: It's really not. It's really, genuinely, not that hard. Honestly, it's harder coming up with how those locks would work, than it is to break the locks. And even if it were hard to break the locks, all it takes is one person offering that decryption program to the world -- now everyone could buy a machine (or build their own) that looks through those transparent locks, and spits out a key that can be used to open that lock.

I'm not trying to say that we aren't sympathetic to developers wanting to protect their game's resources -- we are! But we can't include resource protection within the engine, unless game developers are okay with the drawback that someone could access the game's resources anyways... and I think that drawback effectively negates including resource protection in the first place.

@bruvzg
Copy link
Member

bruvzg commented Jul 27, 2020

@dbrova15

See #38308 for the full PCK encryption implementation.

@MichiruNakam
Copy link

I think this issue goes beyond security, it is also about keeping original source code as secret.
An example of what I mean is this: I can drink a Coca-cola and it will taste exactly like the original formula (running compiled game), I can even see ingredients in its label (reading the "decompiled" code), but my tongue cannot "decompile" proportions and recipe. They are kept as secret (original source code) and no matter what, the only way I could get that information is by Cocacola company releasing it.

Having comments removed from the compiled code do basically nothing to protect original source code. Well-written source codes are designed to be as readable as possible by programmers, this mean having a good architectural design of classes, variables and methods, and of course, names of those things, because they need to be declarative enough. A well-written source code will be substantially easier to read and understand even without comments provided you have the original variables, classes and method names.

Source codes have intangible value for companies. Released commercial games source codes are extremely rare, because almost always they are kept as secret. So actually releasing a compiled game where its code is basically the source code without comments, is almost the same as releasing the source code, with the barrier of the decompiling task.

The main problem with godot, and I think its the main reason on why main Godot engine developers refuses to implement some kind of obfuscation, is because all variables and methods can be referenced with strings, and that feature surely breaks with a compiler that mangles function and variables names.

@RIKDXHQ11
Copy link

BTW, I'm not sure why this is much of a problem. It's not exactly easy to extract a PCK if the person in question is not aware of Godot. And a dedicated person would be able to extract them no matter what you do..

I am very disappointed with your answers. This is a very irresponsible behavior. You believe that there will be thieves invading your home, so it doesn't matter if there is no lock, because locks cannot prevent others from invading.
Because if a thief does this, there is naturally a law that will sanction the thief, so it is only necessary to simply close the door.
What I want to say is that open source is not always a good thing, it will let everyone see the bottom of the code, but we individual developers do not necessarily need these things, because the bottom source code is not what I pursue. Optimizing the engine is your job, and developers should focus on developing and designing games. Because we don't have that much time to modify the underlying code and test it. Because it wastes three months or even a year.
I have returned to C++, DX11, and bullet, and have used the compilation method to create games, because your engine is very unsafe, and it cannot allow me to devote myself to making games.
Even if you think that C++compiled games can be decompiled, even if you think that confused code can be seen by professional people about its functionality and design, it's better than completely exposing yourself.
In addition, what we need is not DRM, but rather not allowing bad people to easily obtain the source code and modify it to make money by re creating new games, which is an insult to the original author. They robbed the author of his wisdom. If GODOT cannot be protected, why should I use it? If I were to create an engine, I would never open its source code.

@Zireael07
Copy link
Contributor

Zireael07 commented Mar 28, 2023

It's not exactly "easy" to obtain source code because PCK contrary to what you seem to think does NOT contain pure source code (at least not in 3.x).

If you state that Godot can not be protected, well, the same applies to UE4 and Unity... therefore no engine is "responsible" or "safe" to you

@RIKDXHQ11
Copy link

It's not exactly "easy" to obtain source code because PCK contrary to what you seem to think does NOT contain pure source code (at least not in 3.x).

If you state that Godot can not be protected, well, the same applies to UE4 and Unity... therefore no engine is "responsible" or "safe" to you

Why do you mention unity and ue, which are related to this matter?
And Unity has always made efforts to avoid extraction, but you should know that while using scripts is convenient because you don't need to compile your code over and over again, "interpretive" games are the least secure. No matter how hard you try to guard against all this.
I don't think it can be compared to Godot, which does nothing at all.
If you think that Unity is also bad, so it's entirely possible for Godot not to add anti-theft measures, and this theory of who is worse is untenable. Bad places should not be learned from others, otherwise Godot has no advantage. Free+open source is no longer an advantage.
I never said I would use them to make games in the future. I always said I would use my own engine, so if Godot fails to meet people's expectations, it's natural to be abandoned. No one would risk using a very unsafe engine just to speed up game development.
This also includes RPG Maker and Pixel Game Maker MVs, which I have purchased, but I never use to develop games. There is also a game built by GM8.0. I once extracted it and placed the modified file in the original directory. It actually ran successfully! This is terrible.
Ue4 and godot are the same open source engines, and I won't use tools that tell bad guys about the internal structure of locks in their homes.
I have wasted a year researching the use of Godot. Currently, I only use it to write or test some game features. If I want to actually create or release a game, it will not be adopted at all.

@Zireael07
Copy link
Contributor

which does nothing at all.

As I said, it's not the case, at least in Godot 3 pck does not store plaintext scripts

@RIKDXHQ11
Copy link

which does nothing at all.

As I said, it's not the case, at least in Godot 3 pck does not store plaintext scripts

I don't use 3.0, I use 4.0, and all I'm talking about is 4.0. And if 4.0 doesn't provide any protection and only 3.0 doesn't display clear text scripts, do you mean to let everyone abandon advanced features and return to 3.0? Isn't that a step backwards in history? Why can't 4.0 use the same approach as 3.0? As I said, it is clear that GODOT does not care about these content, and 3.0 is also easy to extract content because it is open source. There are no exceptions.

@bruvzg
Copy link
Member

bruvzg commented Mar 29, 2023

3.x bytecode is not protection in any form, it is a one-to-one representation of the script that is easily converted back to the source code in one click. Protection features remain similar: 3.x had encryption support for scripts only, 4.0 have support for full PCK encryption - see https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_with_script_encryption_key.html, (in case of Android, enable APK expansion to use it).

@Zireael07
Copy link
Contributor

@bruvzg I know bytecode can be easily converted back, but it's not plaintext source as such, which is what the person seems to have implied

@LikeLakers2
Copy link
Contributor

LikeLakers2 commented Mar 29, 2023

@RIKDXHQ11

If I were to create an engine, I would never open its source code.

Closed-source is not much better, because then you're relying on security through obscurity - a technique that is far less protective than it may seem.

To explain, let's return to your analogy about having locks on one's home: Closed-source would be the equivalent of having a new key shape for your lock. It does not necessarily change the lock's resistance to picking, though! Perhaps some key-way shapes are harder to pick open than others - but all it takes is one person with enough spare time to develop an appropriate tool once, and suddenly everyone can pick it.

In the same token, you simply cannot expect that closed source = completely secure. The experts who make encryption/hashing algorithms know this, which is why they actually focus on making it hard to break even if you know the recipe. It's why some password managers (for example, KeePass) are open-source - you should be able to trust that your passwords are safe even if the attacker knows exactly what algorithm is used to protect it. It's why we have folks who actively attack the big encryption algorithms, to try to figure out their weaknesses, so that we can make even better algorithms in the future.

Assuming that closed-source is a one-size-fits-all solution to making your game assets secure, is the same as assuming that adding 1 to every byte in a Google Document constitutes encryption. Sure, they'd have to know what you're doing to the document in order to revert it (you're adding 1), but that doesn't make it secure.

@YuriSizov
Copy link
Contributor

Thanks everyone for sharing your opinions. There is no point in discussing the merits of open source for a game engine, because that's not something that will ever change for Godot. Having source available does, of course, allow for an easy introspection of the codebase, but indeed closed source projects are being decompiled and reverse engineered all the time, it's not exactly a hard endeavor. So we don't see it as a weakness of the project.

As for source availability of your game and its assets, Godot implements encryption that you can enable and use. But remember, that you are making a project that is supposed to run on the end user's device. By definition it will be unpacked and decrypted before the execution, in the environment fully controlled by somebody else. So any form of protection has a very limited effect here.

Still, if there are some actionable ideas, proposals are welcome. Feel free to share and discuss suggestions there.

@godotengine godotengine locked and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests