How can I completely rename the engine and source files?

I am working on my own version of the engine and I would like to give it a different name. I want to, basically, replace every reference to the word ‘panda’ with the name of my engine, obviously doing this manually would be extremely tedious and time consuming, so is there any other reasonable way to do it. I was thinking of writing a python script that replaces every occurrence of the word ‘panda’ in the filename, and inside the actual source code of that file, it would do this for every file in the directory. Would this approach work or not?

Any help would be much appreciated. Thanks!

I would expect if you could replace every instance in a case-sensitive manner it would work. No need to write a script, there are many code/text editors that can do a search and replace in all files in a directory structure. Panda also names some modules and files as p3 or p3d.
Now I’d like to offer a very good reason not to do this. It will be very difficult for you to merge any new additions to Panda into your own version of the engine should you ever want to do that. If you just want to hide what engine you are using from the end-user, you would be much better off just changing a few things like the names given to directories and executables in the resulting engine built from source.

Could you please explain, why would it be difficult. Also, is there any way to change the file extension of .p3 and .p3d files.


Say you replace “panda” with “cheese”. You also rename the file from “pandaAnimation” to “cheeseAnimation”. Now you grab an updated version of the panda code. When you try to merge them the filenames no longer match so any merge program will not be able to know which file is which. You have to manually pair each file from potentially hundreds of files that have been changed. In a particular updated file with only one small change, the word panda might have been there 50 times. You now have 51 conflicts between the two files that need to be resolved. If you REALLY want to do this, I would recommend building your game first and rename the engine as a very last step before you ship it.

There is no established way to remove references to Panda or Panda3D. We do not endorse doing so, but you’re free to create your own regular expressions to set up the replacement in the source code. Do you also want to remove references to DTOOL, DIRECT and PANDA, which are names of sub-libraries within Panda3D?

To what end, might I inquire? Do you want to make it impossible to tell that it contains components of Panda3D, or simply hide the more obvious references like the names of libraries? How far do you want to go - do you want all in-memory and in-executable strings to be free of the words “panda3d” and “p3d”?

teedee is right, however, in that it becomes difficult to merge changes back into the Panda source or merge in updates from Panda. It depends on how far you want to go with this; the name of a C++ class like PandaSystem would only be visible by someone with a hex editor or a debugging tool or something like that.

You can change the extension of .p3d files without consequences, except that they will no longer automatically open in a browser or when double-clicking them. You may also want to take out the header, which on the first line contains a hashbang and a reference to the Panda3D executable for Unix-based systems, followed by a newline character, preceding the actual multifile data. When extracting a .p3d using multify you will see a file called p3d_info.xml, which is expected to exist by the Panda3D runtime, so that will be more difficult to remove without modifying the Panda3D source code.

Keep in mind that you are legally required to include the full copyright notice in all redistributions of Panda3D, even modified versions thereof, although it doesn’t contain the word Panda3D but it does contain CMU’s name.

Thanks for the lengthy reply.

Basically, I just wanted to create my own engine based on Panda3D, so I didn’t want it to be called Panda3D. Take a look at the Dunia engine, it is based on Cryengine but only about 3% of the source code is the same, and obviously the name is different; well that is what I wanted to do. I would still include all the required licenses, so it doesn’t look like I just ‘stole’ the engine. Initially I wanted to change everything, replace the references to ‘panda’, change file extensions (eg, .p3d), etc. but from your reply it seems like this is much more difficult than I thought. I may end up sticking with the name ‘Panda3D’ just to make my life easy. After all the name isn’t that bad. Any head ups, on what to do?

I think Disney went to some length to remove the obvious references to Panda3D when packaging their games. Most notably, they had their own distribution of the runtime, and so the script to generate the plug-in installer has options to change the name and URL. They also build the core libraries differently.

I’d suggest that you limit yourself to the options you can change when building Panda3D, instead of running regular expressions to change the names in the source code. This still gives you the freedom to reorganise and rename the libraries in a way that better suits your engine, and it makes perfect sense to change the way that applications are packaged and bundled and changing the .p3d extension appropriately to reflect that, similar to how Disney has done it. It may make sense to update some of the documentation strings where it would otherwise perhaps cause confusion for people who are using your engine.

I don’t think you risk appearing to have ‘stolen’ the engine if you make sure to include the licenses and mention that it uses technology from the Panda3D engine, or at least specifically mention components thereof. It’s going to be likely that someone finds out where some of the code comes from, even if you hide the names, and if it then appears that you went to great length to blot out every occurrence of the name “Panda3D”, I think it is far more likely that it’ll be seen as some sort of scam to steal the engine, and you might get backlash akin to the kind that 3DMagix got from the Blender community.

If you compile Panda3D statically you can hide Panda3D usage quit well, that’s what Toontown Rewritten and Toontown House do, where I’m the one that took care of this for the last. Basicly, all we use at TTH are a few files: the static exe, a file containing (encrypted) Python code and multifiles. All those could be embedded into the exe. Besides those, a few more DLLs (msvcrt, openal, cg, etc)

That’s exactly what I want to do. Do you have any idea on how to rename the file extnesions (.p3, .p3d) and still get the engine to recognize them. I’ve been studying the source for quite some time, and can’t seem to find anything. Thanks.

What do you mean by “get the engine to recognise them”? I don’t think Panda considers anything special about the extension. You can still run them with panda3d.exe if you rename them, or package them with pdeploy.

I may have been a bit unclear, and I see where your confusion comes from. Whenever you have a .p3d file it automatically gets the Panda3D icon, and Windows uses the panda executable to launch this file. However when you change the file extension, it is no longer considered a Panda3D file. I want to overcome this problem.

Ah. This is done purely by the runtime installer, by registry entries to HKEY_CLASSES_ROOT.
Look in this file:

The particular line you’re looking for:

${registerExtension} "$INSTDIR\${PANDA3DW}" ".p3d" "Panda3D applet"

The icon comes from the icon of p3dactivex.ocx and panda3d.exe/panda3dw.exe. These icons are attached to the executable when building, you simply have to replace the .ico file in the right location when building the Panda3D runtime.

That is exactly what I wanted. Thanks for all the help!