Python and Pygame
by abc · in General Discussion · 03/01/2004 (5:08 pm) · 3 replies
Hello all :) First time posting here, IIRC. I've been making a scrolling 2d game using Pygame. Progress has been smooth(I've gotten over the hurdle of Python being slow for the most part; 20-30 large moving sprites and my aging 1.4ghz Tbird still manages a modest 45 FPS, which I'm locking to 30) but I'm still pondering the issues of usability/portability/hackability.
You see, it's not so much of a problem on Win32. I just run Py2exe, and boom, my code is ready to distribute in the usual Windows ways.
There are supposedly similar options available for Unix-based platforms, but the links to those that I manage to find seem to be down all the time >.>
This would all be good, except that really, while this aids distribution, it doesn't help very much at all to hide the code. I don't care about people looking at the code just for fun, and I'd even let out the source code and be mildly supportive of an "unofficial hack community" if it built support for the game, but a cracker who wanted to could probably find the hooks to a key system with relative ease, even without necessarily knowing much about Python; the inclusion of the interpreter along with the source in one file would throw them off only a short while if any.
So as far as I know, I'm only going to be able to stop cracks by going around cracking and including additional content to download in the full version.
So, what I'm interested in by posting here(I've posted along the same lines elsewhere):
1. Whether this is a huge problem or not. It limits my options, but certainly doesn't make success impossible. And leaving the source open to viewing might encourage a mod community, since I am planning on taking full advantage of some of Python's features to make the creation of levels with custom code easy...
2. Whether you might happen to know a way around this <.< (nobody seems to know of a way)
You see, it's not so much of a problem on Win32. I just run Py2exe, and boom, my code is ready to distribute in the usual Windows ways.
There are supposedly similar options available for Unix-based platforms, but the links to those that I manage to find seem to be down all the time >.>
This would all be good, except that really, while this aids distribution, it doesn't help very much at all to hide the code. I don't care about people looking at the code just for fun, and I'd even let out the source code and be mildly supportive of an "unofficial hack community" if it built support for the game, but a cracker who wanted to could probably find the hooks to a key system with relative ease, even without necessarily knowing much about Python; the inclusion of the interpreter along with the source in one file would throw them off only a short while if any.
So as far as I know, I'm only going to be able to stop cracks by going around cracking and including additional content to download in the full version.
So, what I'm interested in by posting here(I've posted along the same lines elsewhere):
1. Whether this is a huge problem or not. It limits my options, but certainly doesn't make success impossible. And leaving the source open to viewing might encourage a mod community, since I am planning on taking full advantage of some of Python's features to make the creation of levels with custom code easy...
2. Whether you might happen to know a way around this <.< (nobody seems to know of a way)
#2
I never meant my goal to be stopping crackers. I only meant that trying to put someone's reg-key system into the game would be a hollow gesture at best(certainly doable with anything C-based but like I said easily cracked for the reasons above), which I realize would cut me off from any publishers that wanted to avoid an additional download off their server. Making the code more securable in that sense would give me more options.
Py2exe works by basically binding your code and dependencies into the interpreter as a single binary. No fancy tricky stuff going on there. Adding content is a snap: Python can declare new classes dynamically, they can be stored in lists, and functions for storing Python objects(the pickle module) are provided. So all you do is write your code, build the pickle files from it, and then at runtime load the pickles into a list containing game objects, which the map then references numerically.
An additional advantage of this method, as compared with, say, the dll files used by many FPS mods, is that you can mix and match your objects relatively easily, so that if one modder makes some cool new enemies or weapons, everyone else can add them into their maps. It introduces the whole problem of dependencies but I don't think there's ever been a solution for that except duplicating everything with each mod or agreeing on some standard ones.
I don't worry about handing out the source because the source won't contain the meat of the full game; it'll be identical to the free version, except with the "is registered" flag turned on. In selling the game, I'm basically selling a license for using that additional content. If I REALLY wanted to go out on a limb, I believe I could even give it the GPL and still have a commercial enterprise. (can't remember the exact terms of it though, so I might be a bit off in making that distinction - LGPL would definitely put me in the clear though)
Something tells me it would turn away customers if I prominently declared the game to be "Free Software" and then charged for it though ;)
03/02/2004 (7:04 pm)
If it's unstable, SDL probably is too; it's just bindings around those libraries. Which would be....surprising, to say the least. An awful lot of games use it.I never meant my goal to be stopping crackers. I only meant that trying to put someone's reg-key system into the game would be a hollow gesture at best(certainly doable with anything C-based but like I said easily cracked for the reasons above), which I realize would cut me off from any publishers that wanted to avoid an additional download off their server. Making the code more securable in that sense would give me more options.
Py2exe works by basically binding your code and dependencies into the interpreter as a single binary. No fancy tricky stuff going on there. Adding content is a snap: Python can declare new classes dynamically, they can be stored in lists, and functions for storing Python objects(the pickle module) are provided. So all you do is write your code, build the pickle files from it, and then at runtime load the pickles into a list containing game objects, which the map then references numerically.
An additional advantage of this method, as compared with, say, the dll files used by many FPS mods, is that you can mix and match your objects relatively easily, so that if one modder makes some cool new enemies or weapons, everyone else can add them into their maps. It introduces the whole problem of dependencies but I don't think there's ever been a solution for that except duplicating everything with each mod or agreeing on some standard ones.
I don't worry about handing out the source because the source won't contain the meat of the full game; it'll be identical to the free version, except with the "is registered" flag turned on. In selling the game, I'm basically selling a license for using that additional content. If I REALLY wanted to go out on a limb, I believe I could even give it the GPL and still have a commercial enterprise. (can't remember the exact terms of it though, so I might be a bit off in making that distinction - LGPL would definitely put me in the clear though)
Something tells me it would turn away customers if I prominently declared the game to be "Free Software" and then charged for it though ;)
#3
Maybe it's just unstable on Windows XP, I don't know. But I was horribly dissapointed.
03/02/2004 (7:11 pm)
Quote:If it's unstable, SDL probably is too; it's just bindings around those libraries. Which would be....surprising, to say the least. An awful lot of games use it.I downloaded one - it crashed whenever I tried to change the key mappings. I also typed in the "bouncing ball" demo. Somewhere along the line, after it lost focus a couple of times, I got another nasty little crash popup.
Maybe it's just unstable on Windows XP, I don't know. But I was horribly dissapointed.
Torque 3D Owner Jay Barnson
As to stopping the crackers... give it up. The best you can do is keep the honest people honest and prevent "casual" piracy. Not many of those involved enough with the pirate community are likely to be turned into customers even if by some miracle you turned impossible to crack. Focus the time & effort instead on making your customers happy, IMHO.
As to the other details of your implementation... can't say I know enough about py2exe. I'd leave "hooks" for people to add their own content in a second if there's an easy way to do so... but I'm not quite so keen on opening up the whole kimono and giving people all of my source. Maybe I'm just not confident enough. Still, the people actually INTERESTED in the source code enough to plow through it is a relatively small subset of gamers.