Alright, so I feel a little bad asking this question for a few reasons. For one, Blender is itself an open source community thing, so building a closed source game makes me feel a pinch guilty (except that I and others plan on putting insane amounts of work into this project). That, and I’m sure this has been asked before, but my last hour of googling hasn’t yielded any definitive answers.
So, can I get all my python modules (and possibly external .blends if it doesn’t screw with LibLoad) bundled into my main .blend in the final .exe? I know it’s technically impossible to prevent people from decompiling source and tampering with code, but I’d like to deter it as much as possible. Are goal is to hopefully Steam Greenlight and Kickstart our project once we get to a good point. We’re aiming to make a small competitive multiplayer game and have a good start (working server and all that), but we want to make sure any half learned python programmer can’t get in and wreck the client, or cheat out their ears.
Please advise. Thanks.
PS I’m willing to hear ALL options, even it it’s insane. I’d rather not hear “it’s impossible” unless it’s truly, truly impossible.
Again, sorry if this has been asked already, and for being a closed source jerk.
Blender I a completely free program, including being open source, and a beautiful Terms and Agreements. You are allowed to make any commercial product you want without even having to credit Blender. Of course, it’s open source, so people will always be able to decompile it.
Most people want to protect their code, but this seems illogical to me.
Code is, unlike models and art, relatively self-protected. If it’s good code, users who deem it worth “stealing” will be unable to utilise it effectively. The developers who are capable of doing this will usually roll their own for implementation, curiosity of simplicities’ sake. (Usually good developers also have a sense of pride in their own work). Models can just be taken and copied- they’re very modular, and self contained.
In addition to this, code is usually not lengthy enough to make it worth stealing. My multiplayer system is about 7000 lines of code long, and that’s for a framework. Smaller modules tend to be in the order of a few hundred lines at most, which can be written quite quickly when you get going.
Regarding cheating, this is really something you should implement server side, if you’re concerned. The philosophy assumed by most seasoned network programmers is that the client is always trying to cheat. The less data and control you give them, the smaller their margin for doing so becomes. If you’re accepting positions from the client, there’s a relatively large gap that can be filled by an accomplished programmer. As well as this, you need to consider if cheating is really something your game will face, and if so, cross that bridge closer to the time.
You can place Python code in textblocks which will be kept inside the blend file. Be aware this results in a flat structure (no packages).
If you use LibLink you should be able to load the textblocks when any loaded object refers to the textblock (via Python controller Script mode). This method works with linking. I never tried with LibLoad, but I do not see a reason, why it should not work with it as well.
If you are worried about stealing code … there is no protection. But you can make it harder, with the textblocks, or by delivering the .pyc files only. None of that is a real protection for advanced users. But I agree with Agoose77 - if someone knows how to get it - he already knows how to write his own version of code.
If you are worried about authenticity … you can implement checksums, signatures or even deliver the (important) python code via network. This way there is more protection that the code executed is unmodified. Indeed you need some “un-trusted” loader to receive and install the Python code. Even here you can work with signatures.
Regarding closed source … please read the sticky licence thread … you will see that a bundled application file does not allow closed source it will be GPL.
I concur, that you can’t fully protect your scripts. If you’re making an online game your cheat-detection is usually one or both of a client-watchdog and evaluating player actions server-side. Some great examples include World of Warcraft’s sniffer (I don’t recall the name of it off-hand) and their server-side evaluations. If you could provide various things you’d like to prevent players from cheating at, I could maybe help you decide how to best prevent cheating.
Thanks for your replies everyone. It is all very helpful. Most of what we have planned has been mentioned here, so I’ll just assume we’re on the right track. The only reason I wanted to close source it was to prevent cheating, but you guys make some good case arguments here.
I’ll keep this in mind and when we come across specific things I’ll bug ya. Thanks.