skellington 2011

Hi,

here is the start of a skellington for pyweek 2011.  Can someone review, fork it, then make an official one?


https://bitbucket.org/illume/skellington2011/wiki/Home

hg clone https://bitbucket.org/illume/skellington2011
cd skellington2011
create_files.py --shortname=gamename cd gamename


-------

Creates a directory of files for your game.

Can upload game to pypi (python package index), pyweek. Can create binaries for windows, linux, and osx. Also supports pygame subset for android.

create_files.py --help

the simplest is to do: 

create_files.py --shortname=gamename
This will create a folder called gamename with everyting set up.

(log in to comment)

Comments

Awesome! I'm working on making it the "official" one :-)
I've done some polishing: see https://bitbucket.org/r1chardj0n3s/skellington2011
And that's been put in place as the new skellington 2.0 on the site all "official" like.
Cool! This should help us be able to focus more on the game and less on the overhead of distribution. :-)
I'd appreciate it if people could grab the latest Skellington and give it a whirl before the challenge starts :-)

  • the vim modeline includes "noet" which enforces hard tabs. Furthermore, the files already have space-based tabs. This is a sin. You're enforcing mixed tabs and spaces!
  • get rid of the vim modelines completely. those are totally arbitrary settings that not everyone wants. plus, not everyone uses Vim.
  • I would delete the following files for simplicity's sake:
    • configure, Makefile (it's just going to be confusing. A person does ls and then wonders whether to run_game.py or configure; make; make install)
    • CHANGES.txt (we can use our source control log for that)
    • main.py (why is this AND run_game.py necessary?)
  • I did -l BSD and it didn't put the BSD license in LICENSE.txt, and in setup.py it says my chosen license is GPL.
  • what's the deal with icon.png? what happens if I replace it with a real icon? does it get submitted to pyweek? does it serve any purpose at all?
  • I haven't tested pyweek_upload.py for obvious reasons. I hope you have!
  • python setup.py py2exe doesn't work: error: invalid command 'py2exe'
  • python setup.py py2app breaks with: error: argv-emulation is not supported for 64-bit executables

I LOL'd at How to Play the Game. "Press the left mouse button to fire the ducks." :-)
Thanks for the feedback.
  • I've removed the vim modelines
  • I'll leave in the configure, Makefile and other files as they're important to various use-cases beyond the simple "python run_game.py"
  • I've fixed the license substitution
  • I'm afraid I'm not sure how the icons are supposed to work. I believe for py2exe to use the icon it needs to be a Windows format thing. Same for OS X. Just not sure, I'm afraid.
  • pyweek_upload should be OK ;-)
  • I guess you don't have py2exe installed?
  • I have no idea what's going on with py2app I'm afraid
Thanks again! I've released Skellington 2.1.
Maybe you could integrate the run_game scripts from pyknic-skellington?

Or just add a option to run the game with -O flag.

http://www.pyweek.org/d/3668/#comment-8369

Thanks.
whoops! That was silly of me to say py2exe doesn't work. I don't know why I didn't realize that I didn't have py2exe installed. Thanks for working on this stuff.
Using this is not compulsory, right? If it is, I'm going to have pages of comments, because it's almost diametrically opposite in many places to what I would consider good coding guidelines.

Providing it's only a suggested layout for those who need it, the only moderately problematic thing is that I have to create an empty skeleton directory to get at the "upload to pyweek website" file, which is the only part that seems required (you have to get the directory name right, etc). If that could be in the top-level directory, or available separately, that would be awesome.
No, you're not required to use it.

You can upload files to the site without the uploader. You can also get the uploader separately (it's listed in the Help page).

The Skellington was created because some of us were tired of downloading 50 games which had 50 different file layouts, missing READMEs and methods of running the game which required, in some cases, experimentation to figure out. And a bunch of them didn't even create a subdirectory when unpacking. A lot of people also have trouble figuring out how to get py2exe and py2app working. And then more recently there's been questions about installable games. All of these are supported by this version of the Skellington, relieving some of that pressure.

A bunch of PyWeek old-timers have their own skeleton projects that they use instead and that's fine too.

I am curious to know what it is that you believe goes against good coding guidelines.
Oh, DR0ID I didn't address your comment, sorry.

Hmm, the .pyw file does appear to have been dropped. Whoops.

I'm not so sure about the -O / losing the pyglet error checking. I think that could end up being a recipe for trouble (leaving an OpenGL error unchecked could lead to a system crash so disabling them should be done well down the track).
I agree with superjoe's comments. My LICENSE.txt didn't get generated properly either, and the icon.png doesn't seem to be referred to, although there is icon.ico in the setup script (2.1 version). I think the older skeleton had a better layout and there are several new files I don't want, so I've deleted and renamed some things in my copy.

Richard, maybe we should have some guidelines on the rules page for those that don't use the skellington? I.e. at a minimum there must be run_game.py and a readme with info about dependencies and stuff. Normally most people use it but sometimes there are some games that are packaged differently.
Ah yes, the LICENSE.txt isn't populated - the short license you supply just goes in the setup.py.

And yeah, there's more stuff in there than in the old one, but I assume that they're there to support the py2exe/py2app/cx_freeze/easy_install extensions. The removal of the "lib" directory is definitely a good move. I've got one additional tweak to try out though - renaming main.py to __main__.py allowing "python -m gamename".

The Help page has some hopefully clear advice regarding what to submit for those not using the Skellington.
OK, 2.3 has been released with these changes:
  • rename the game lib main.py to __main__.py to enable "python -m" support
  • add the old Skellington's data.py to the game lib
  • remove unused icon.png
  • have LICENCE.txt get the short licence
  • remove unused top-level main.py
That's it. I need some breakfast :-)
How do you run the game?  When I try running run_game.py I get the following error:

Traceback (most recent call last):
  File "run_game.py", line 1, in <module>
    import yourgameshortname.__main__
ImportError: No module named yourgameshortname.__main__
Do I need to edit something?
Does anyone use py2exe in combination with pygame.
We had the problem that the data.getfilepath didn't work right in the exe case.
The problem is that the data directory isn't integrated into library.zip but in case of executing the exe file the data is searched in ..../library.zip/data/<file>

We fixed it quickly by searching for library.zip in the path and remove it from path.
That works but we are not very happy with this solution.

Does anyone have a better idea?
I solve this problem by using pyglet.resource and looking in both ../data and ./data:

# add data folder to pyglet resource path
_this_py = os.path.abspath(os.path.dirname(__file__))
_data_dir = os.path.normpath(os.path.join(_this_py, '..', 'data'))
pyglet.resource.path = [_data_dir, 'data']
pyglet.resource.reindex()

# monkey patch pyglet to fix a resource loading bug
slash_paths = filter(lambda x: x.startswith('/'), pyglet.resource._default_loader._index.keys())
for path in slash_paths:
    pyglet.resource._default_loader._index[path[1:]] = pyglet.resource._default_loader._index[path]