Looking for a different way to distribute games

Okay, let’s get something straight here. Packpanda and packp3d are out of the question. Each of those packaging systems have several drawbacks that I am simply fed up with.

I want to know how Toontown servers package their games. I asked a Toontown Rewritten developer, and all I got was: “We use an advanced version of Panda3D and Python to build a well-encrypted exe. That’s pretty much all there is to it.” I’m quite confident the version of Panda they are talking about is 1.9.0, which I already have. Building an installer is not a problem for me; what I really want to know is how they encrypt their source code. Like I said, I do not want to use packp3d to compile, as only half of the command-line flags work, and it is EXTREMELY easy to decompile. Is there any alternative way to create a well-protected file out of my source code?

Any help is appreciated.

I don’t know what you’re talking about. It’s not possible to extract the source code from a .p3d file, or from an .exe compiled by pdeploy.

The only alternative that I’ve seen some people use is pfreeze, which turns Python bytecode into compilable C code. However, the actual bytecode will still be just as extractable as with pdeploy or py2exe or any other method, even if you were to cryptographically encrypt it - which sounds nuts at the face of it, and wouldn’t help at all except add a tiny layer of obscurity.

What are you talking about? Just call multify -xf on the p3d file and then boom, there’s all your pyc files. While the exe created with pdeploy is pretty safe, I was more talking about the p3d file itself. You can’t supply any cursor or icon whatsoever on the application, which is the reason I asked this question in the first place. I even tried loading in the cursor and icon as temporary files from the user’s Temp directory, and they still can’t be loaded to a p3d file:

import tempfile
import shutil
import atexit
import os

def setCursorandIcon():
	tempdir = tempfile.mkdtemp()
	atexit.register(shutil.rmtree, tempdir)
	vfs = VirtualFileSystem.getGlobalPtr()

	searchPath = DSearchPath()
	if __debug__:
		searchPath.appendDirectory(Filename('resources/phase_3/etc'))
	searchPath.appendDirectory(Filename('phase_3/etc'))

	for filename in ['toonmono.cur', 'icon.ico']:
		p3filename = Filename(filename)
		found = vfs.resolveFilename(p3filename, searchPath)
		if not found:
			return

		with open(os.path.join(tempdir, filename), 'wb') as f:
			f.write(vfs.readFile(p3filename, False))

	wp.setCursorFilename(Filename.fromOsSpecific(os.path.join(tempdir, 'toonmono.cur')))
	wp.setIconFilename(Filename.fromOsSpecific(os.path.join(tempdir, 'icon.ico')))

setCursorandIcon()

This function works normally during python runtime.

I guess my main problem isn’t necessarily protecting the source code, but more so adding more benefits that a p3d file doesn’t allow. There’s nothing more frustrating than not having a toonmono.cur on a Toontown-based game (TT players know what I mean). And even on a more broad perspective, it’s also really frustrating to still have the Panda icon in the taskbar when playing the game.

If you call multify -xf on your .p3d file, you get .pyo files, containing compiled bytecode. This isn’t source code.

If you use pdeploy on the .p3d, which is the recommended way to distribute games, you can supply a custom icon file for the application to use.

If the .cur doesn’t show up properly in the .p3d runtime, you should file a bug on launchpad and attach a sample test case.

Oops, I guess I didn’t realize that they were pyo instead of pyc.

When I said that you can’t supply an icon for the game, I was talking about the p3d file, not the exe from pdeploy. I know how to set an icon for pdeploy, but that only sets the desktop icon, not the actual game icon when you’re running it. pdeploy cannot make any changes to a p3d file once it’s already been compiled.

I will also consider filing a bug for the cursor on launchpad, thank you.