Panda python code issue


Hello Guys I’m very new to panda3d but I started to learn python and it’s ok for now but I have problem
is there a way that I can comiple my panda3d python code
if there is not then it would be terrible because my code would be reaveled for everyone I hope there is a solution and thank you in advance


I think the two easiest ways to accomplish what you’re looking for are:

  • Use the compiled .pyc files Python generates when it runs a Python script and distribute those in place of your .py files
  • Use Panda’s built-in tools that basically automate the first option for you

That being said, I think you shouldn’t use Panda until you’ve learned Python to the point where you’re comfortable with it - it will save you a lot of time and trouble in the long and short run.


Small addition: afaik pyc files are version-specific (you can’t use pyc files built by Python 2.x with a Python 2.y interpreter, with x != y), so DangerOnTheRanger’s second suggestion is way better.


guys thank you for help but I don’t understand is panda supporting something that can protect your code privacy ?


pyc files are compiled files, you asked for compiled files in the OP, and both solutions rely on pyc files. Ok, pyc files are weak (from an obfuscation point of view), anyway your code can be attacked by reverse-engineering whether it is a pyc file or an executable file, … Executables produced by Panda’s deployment tools are executables which contain pyc files, and you could obfuscate them. Anyway your code could be still attacked, there aren’t client-side solutions. The only solution is to store important code on server-side. The pragmatic approach is to not waste time in protecting code (face the problem only if this is crucial).


long story short: no. the second you ship your game, you lose control over your code. there is absolutely no way around it. it is, physically, flat out impossible.

if someone want’s to mess with your code, he/she will do so, no exceptions.

wasting time to get around laws of physics is not recommended. if you use pyc files and panda’s packing system that should hide your code from most unskilled and curious eyes. but that wont prevent serious hacking.

if you have a multiplayer game there are a few simple rules:
1.) never trust a client
2.) never ever trust a client
3.) try to make sure that a messed up client wont hurt other people’s gameplay experience.

for single player games, just don’t care.


There is absolutely no need to be shy about code. If it works, it’s good! You’d wonder how people sometimes change their mind from “bad code” to “good code” once they actually use the program.

If you speak about hiding as in obfuscating in context of copying games in binary form, then there is no real solution and you shouldn’t really care until you earn serious money with your game. Milion-heavy publishers try making their games copy-safe and spend much money and time for that - the result is a new one-week-challange for a cracker and a new entry on file sharing sites.

Most projects die not because of opponents copying code, but because of not finishing anything. And one reason people don’t come up with anything is caring about things like this instead of concentrating on what’s important.