Monday, December 15, 2008

pygame ported to pyS60 for nokia phones.

Pygame on nokia phones with pys60!

Details here:

The port is very fresh(by GameDude from Finland), so there's a few incomplete parts, but enough things to have fun with.

Nokia should be congratulated for supporting python on their phones(the most popular phones in the world). Unlike apple, which does not allow python on their iphone.

Saturday, December 13, 2008

pygame.midi -- midi in, and midi out.

I started adding more midi support to pygame.

Pygame can already play midi files, however it can not get midi input, or send midi output to devices.

Nicholas played around with some midi stuff in our eye stabs computer game... where it turned notes from a real guitar using pitch detection into midi events. This experiment used portmidi, and it seems to work ok in a cross platform manner.

I hooked up my USB midi controller, and am able to get midi events!

I've also added some code which converts the midi events into pygame events, and posts them to the normal pygame event queue. This simplifies things for people already used to handling events with pygame (like mouse, keyboard, and joystick events).

I can also get it to write to midi outputs, but haven't really got a use for that yet. However I would like to hook it up to my casio keyboard to get some retro sounds out of it... but I have no midi output converter anymore. It is possible to get USB->midi converters fairly cheaply these days.

Anyway... it should be possible to write a joystick->midi program, a web cam->midi, and all sorts of other fun things with this. There's lots of music devices out there that talk midi, so this should be quite fun!

Hopefully it'll make it into the next release of pygame -- pygame 1.9, and of course into pygame reloaded (think py3k for pygame).

Monday, December 01, 2008

backup tools - clonezilla

For a full system image backup tool, clonezilla is really nice.

You can boot off a CD or a usb stick and clone partitions or disks over the network to some network drives. The iso CD image is about a 90MB download. You can backup to ftp, smb, ssh, or local usb attached drives.

It doesn't backup the whole size of the image, only the space you have used on your disk. So if you have a 600GB drive, and only use 40GB it'll only backup the 40GB. It can even compress the saved images with various forms of compression(gzip, bz2, lzo etc).

The only downside is that you need to take your machine offline to do so.

However to save a lot of time restoring your OS(s) in the future, it's a really good tool.

It's based on linux, and is free to use/modify. It works on apple hardware, but only has experimental support for backing up OSX partitions... but I think it works with full disk images. It works fine for windows, and linux partitions of course.

Sunday, November 23, 2008

Dino Vs Pirate ship

Dino Vs Pirate ship is a short film about a pirate ship and a dinosaur. There is also a series of blog posts about how it was edited, narrated, and put to music.

Tuesday, November 18, 2008

pygame reloaded

So Marcus has been working away in the background refactoring/rewriting pygame. Hopefully his work will become part of pygame 2.0... but in the mean time we hope to do another set of 1.x pygame releases.

The main pieces I see for another pygame release are the evolution of the testing frame work into a library, examples as a library, the camera module, and many other changes are coming to pygame... including pygame coming to another implementation of python... tinypy!

Below are Marcus's notes about the pygame reloaded release.

* New FRect class for high precision rectangle handling using floating point
FRect and Rect share the same properties and functions and can be converted
into the other rectangle type without any problems.
* New PixelFormat class that wraps up SDL_PixelFormat.
* New CDTrack class that keeps information about CD tracks.
* New physics module integrated. Zhang Fan's GSoC work on an easy to use
physics simulation is now available.
* New sdlgfx module, which wraps up the SDL_gfx library and adds features
such as fast zoom and drawing primitives or FPS management.
* Improved C API.
* Improved SDL sound and channel handling. Though not perfect, they are more
robust now.
* Completely rewritten build system, allowing a fine grained build
configuration for nearly any purpose.
* Completely rewritten documentation system.
* Installation is compatible towards pygame - it goes into a new
namespace and module hierarchy, so having pygame and pygame2 installed
won't hurt your pygame 1.x applications.

Besides those great things about which we all can get excited, there are
some downsides to it - otherwise it would not be pygame.

* Module, class and package layout changed.
* Completely different API in nearly all places for both, Python and C.
* No ABI or API compatibility towards pygame 1.x (and it is not planned!)
* Feature compatibility towards pygame 1.x only in limited areas.
* Overhauled test system.

* Early development stage. Expect weird things to happen when you use it.
* Not many examples and tests yet.
* API likely to change before an official release is made.
* MacOS support not available yet.
* physics module not working yet.
* Many other issues to be revealed.

Sunday, October 19, 2008

Web designer available. Degree in fine art, 10 years experience designing websites.

Dane Ash is a website designer I have worked with for a while, who is now looking for work again. Below are some of his images.

If you like the looks, book this designer.

Saturday, October 11, 2008

art is boring

Friday, September 19, 2008

My pyweek postmortem. Making a game in a week.

Pyweek, finished recently, and was a real blast... as usual.

Congrats to everyone who took part, pyweek was really fun! I look forward to playing everyones games (I've only got through around ten so far).

'Eye stabs' was our team name.

We didn't post a final entry. Our game isn't really at the stage where we'd like it to be... There's still a number of core features required before it's a 'game'. At the moment, it's kind of a fun intro, and a demo of what the game could be.

For me, recently these competitions have been about experimenting, rather than finishing a game. Getting a buzz off everyone else's energy as they create something in a small amount of time. These competitions are also really good for 'finishing' a game... since they have a finish built in. When the week has ended it's finished.

So we'll make a release some time in the next few weeks. Because we want to show everyone... but not before the basic elements are in place.

""" In the dirty underground music scene often referred to as 'eye stabs', there are lethal gigs in select nightclubs around the world. Musicians play for eyes. A tune is played to the musician, and they must figure out the notes played.

Fuck up the tune, and you are stabbed in the eye! Get the tune right, fortune and respect are yours! Better than the riches and the adoration though -- rich club owners can give you spare eyes... and provide doctors that can give you back eyes you have had stabbed out.

So are you prepared to put your eyes on the line? Can you play well enough to avoid a stab in the eye? Do you trust the sleazy club owners doctors to fix your eye if it does get stabbed? """

q o o p
q o!o p
d o!o b
.' |!!!| `.\
/ !===! \\
| /|!!!|\ ||
\ \!!!!!/ //
) `===' ((
.' !!!!! `..
/ !!!!! \\
| !!!!! ||
| !!!!! ||
| !!!!! ||
\ ======= //
`. ooooo .;'

Think a guitar hero type game, with an insane premise, and instead using a real guitar for playing the notes(instead of a toy guitar). There are also 'sim musician' elements. You need to select which gigs to do, and collect myspace fans. Well that was the idea anyway.

Screen shot of which
notes you need to play
and which notes you played.
It's a musical ear trainer.

things that went well

  • kick arse intro (goes for 60 seconds or so). I would be happy playing it at party.
  • played around with portaudio. Which seems like the best solution for portable audio. I think we might use it in pygame (with likely something like swmixer)
  • learned to use ocempgui (finally).
  • got pitch recognition working for guitar fairly well. Learned about how the algorithm works, and the various limitations.
  • with a little more work, the game could teach people about music. We hoped to make it a useful program, as well as fun. Nicholas has already taken the pitch recognition parts to allow it to talk to other ear training programs.
  • pygame.threads.tmap combined with pygame.fastevents turned out to be a really nice way to do multithreading.
  • authors of libraries we used were very helpful. Especially Nathan(swmixer), and Marcus(ocempgui).
  • cool samples, and music. moxi made some cool music and samples. We only managed to use some of them because of the rush. However we are going to use more later.
  • found 4 new pygame bugs, and about 8 bugs in other python libraries. Even though they wasted time, it was good to find them.

  • Screen shot of intro.

    things that went badly

  • thinking pyweek ended on sunday 5pm, when it ended sunday 10am.
  • dissapearing gfx team member, so I had to work on gfx elements at the last moments, when we realised he wasn't going to contribute.
  • spent most of the time on the intro. Including spending six hours failing to get the video playing with, and instead writing a multithreaded motion jpeg video player.
  • game elements left to the end. We should have polished those parts first. (But had lots of fun with other stuff :)
  • python bloat, and py2exe. Python really has put on the megabytes since python2.3. Took a while getting the size down from an initial 26MB to 6MB. This was important 'cause some of our team were on dialup modems.
  • had technical issues getting the pitch recognition stuff working. That took a while. Was kind of pythons fault really. Including issues with the GIL(pyaudio doesn't release the GIL). Also the non deterministic way in which python does stuff (dicts, garbage collection, finalisers). Calling processes in python is also hard to do multiplatform nicely(even, and especially between different versions of windows).
  • issues with pygame sound loops, and Sound object loading. This wasted a lot of time.
  • You can't win or lose the game. We should have added game elements nearer the start of the week.

  • In the doctors surgery...
    trying to repair your stabbed eyes.

    Tuesday, September 16, 2008

    pygame.test -- moving testing forward.

    We are moving to including the tests with an installed python package... pygame.
    >>> import pygame


    Why include tests in pygame? Rather than only with the build process?

    • More people will run the tests.
    • people can run the tests to see if everything works in their own programs.
    • Can run tests on a persons computer to see if everything in pygame+ your program is working.
    • Which driver/function combination works, or works fastest? Run tests and find out.
    • Testing a py2exe/pyapp generated binary is much easier.
    • Reuse of our testing enhancements for their own tests.
    • Reporting bugs would be easier. Since everyone could run unittests, since they will be installed everywhere pygame is installed.
    • Result submission of unittests easy. This would result in a much larger base of computers running the unittests and submitting problems. This would be opt in of course.
    • Make the testing stuff more a library, than a framework.
    • Allow people submit unittests more easily. Since they won't require a source release of pygame to write unittests. eg people using a windows binary install of pygame, or a ubuntu binary install can run and submit unittests.
    • Make testing easier for people. The easier it is, the more worthwhile testing is.

    A few other things it might do.

    # load your own test into the test runner.
    >>> pygame.test.load("tests/")

    # pass commands to the test runner.
    >>> test_results ="interactive")

    # Submit the test results for review.
    >>> pygame.test.submit_test_results(test_results)

    # submit a test you wrote for review to the pygame developers.
    >>> pygame.test.submit_test("tests/")

    Nicholas and I have been discussing this for a while, and have now moved discussion to the pygame mailing list. However we would appreciate any thoughts from outside of the pygame community too.

    Tuesday, August 26, 2008

    The Lonesome West

    The Lonesome West is a play running from September 3rd - September 21st in Melbourne Australia.

    The Connor brothers fighting.

    "The Connor brothers live modest lives, gleaning joy from simple pleasures: drinking, joking with the foulmouthed Girleen, tormenting Father Welsh, and fighting with each other…constantly and brutally. When, in an attempt to salvage their relationship they confess all to each other, the results are explosive."

    This play has a lot of comedy and violence in it. One of the interesting technical aspects of the Tiny Dynamite production of it, has been coming up with ways to smash dozens of religious figurines, and blowing up an oven every show.

    Foul mouthed Girleen.

    Thursday, July 31, 2008

    Pygame 1.8.1 released!

    Stick a fork in it, it's baked... nice and toasty. Pygame 1.8.1 is now available for download.

    Many bug fixes and improvements, including:

    • BLEND_RGBA_* blitters and blenders to go with the BLEND_RGB_* blend modes.
    • documentation updates (mainly for new sprite classes released in 1.8.0)
    • sound fixes, and streaming some music from file like objects
    • image saving fixes
    • greatly expanded tests
    • Pixelarray, and surfarray updates and fixes.
    • Enhanced Color class, reimplemented in C for speed.
    • New Windows and Mac binary installers.
    See the WHATSNEW for a full list of changes.

    Many thanks to Marcus, Lenard, Brian, Nicholas, Charlie Nolan, Nirav Patel, Forrest Voight, Charlie Nolan, Frankie Robertson, John Krukoff, Lorenz Quack, Nick Irvine, Zhang Fan and everyone else who helped out with this release.

    Monday, July 21, 2008

    Ludumdare 48h game competition -- #12

    Ludumdare 48H is coming - Aug 8 - Aug 10.

    Ludum Dare(ld48) is a regular community driven game development competition. The goal is, given a theme and 48 hours, to develop a game from scratch. Ludum Dare aims to encourage game design experimentation, and provide a platform to develop and practice rapid game prototyping.

    Here’s the time-horizon:
    - July 19 - July 25: You may submit themes to the wiki
    - July 26 - Aug 2: Themes will be edited for awesomeness by the #ludumdare regulars
    - Aug 3 - Aug 8: Various rounds of voting. Check back daily so you don’t miss any!
    - Aug 8 - Aug 10: Ludum Dare #12 !!! (Starting at 8pm PST) - the super awesome website, refresh hourly
    irc:// #ludumdare - the compo IRC channel, waste your time here - the compo blog, be sure to sign up here - the compo wiki, submit themes & read rules here - the compo planet, read about our exciting lives here

    Sunday, July 20, 2008

    zodb + cherrypy python

    Here's a small example of how to use cherrypy and zodb together. It just adds what ever you pass into the /put url as arguments into the db.

    easy_install ZODB3
    easy_install cherrypy

    You can see the website here, once you run the script: http://localhost:8080/

    import cherrypy
    import cgi

    from ZODB import FileStorage, DB
    import transaction

    class MyZODB(object):
    def __init__(self, path): = FileStorage.FileStorage(path)
    self.db = DB(
    self.connection =
    self.dbroot = self.connection.root()

    def close(self):

    def ehtml(s):
    return cgi.escape(s)

    class HelloWorld(object):
    def index(self):
    # list everything passed, and allow adding more.
    r = ""
    for k,v in dbroot.items():
    r += "k:%s: v:%s:<br>" % (ehtml(k), ehtml(v))

    r += "<form action='put' method='post'>"
    r += "<textarea name='stuff'></textarea>"
    r += "<input type='submit' name='submit' value='submit'>"
    r += "</form>"
    return r

    def put(self, **kwargs):
    # store all the args passed into the zodb.
    transaction.commit() = True = True

    if __name__ == "__main__":
    db = MyZODB('./Data.fs')
    dbroot = db.dbroot


    Tuesday, July 15, 2008

    Wordpress 2.6 with post revisions.

    Finally wordpress has revisions on posts.

    Which makes it a lot easier to share writing between people -- since you can save your copy, and the other person can see what you changed.

    Also you can revert to previous revisions of posts you've made.

    Very nice.

    Theme preview, so you can try out themes before others.

    But most importantly they have made images easier to use. 2.5 was seriously 'special' when it came to uploading images. A lot of people couldn't upload images in 2.5 because of they way the interface was not-designed.

    It also has partial support for google gears (to serve some parts from a local cache). Which apparently speeds up loading the admin section.

    Full details of wordpress 2.6 release.

    ps. Also pygame 1.8.1 release candidate 2 was released, with 1.8.1 release planned for this weekend.

    Friday, July 11, 2008

    RFC: Leaky abstractions for HTTP encoding, and a better high level abstraction.

    So I was spinning some webs in late 1884, like many others in this time of industry. Everyone is doing it these days(spinning webs). With the lantern hanging over my carbon fibre 100% macrobiotic desk -- the soft flickering light cast a long shadow through my webs.

    I stared into the webs, and something struck me!! It was a blow to my head brain.

    Most people in 1884 have made the wrong abstraction for HTTP

    At some point most web code decided to use a dictionary for GET and POST variables.

    Like a leaky boat, a leaky abstraction is bareable, but also annoying. I hate leaky boats so mostly get around on horse back or by horse and carriage. I also enjoy a brisk walk through the country side in the morning, and I love to scuttle through dark alleyways at night in the exciting colourful parts of the townships slums.

    [Editors note*1: my friend wants me to try out one of his chain powered Pull Bicycles. I told him he is crazy and that his Pull bicycles will never catch on. Saying that they do look like fun, especially the ones that fly.]

    Now I like hash as much as the next person... but too much hash is not good.

    What abstraction do they use for GET and POST variables?

    Sometimes it is a dictionary with unique decoded keys, single decoded values, with no ordering of the keys.

    Most web codes for languages including python, php, and other vices get http wrong in this regard.

    They often lose these useful properties of the encoding:
  • ordering.
  • duplication.
  • streaming.
  • raw encoding.

  • A generator/iterator of tuples of ((key,value), (raw_key, raw_value)) is the nicest high level abstraction I can think of. You don't lose any of those properties.


    ... **.... .*. . . *##. . ..........


    Sorry for the mess. There was an ink blot in my quill -- so I had to fix it to write more paper words.

    Now with the new abstraction you can build more leaky abstractions on top if you like. WHATEVA. You can use your hash if you like too, but maybe there is a better way than using a dictionary that isn't leaky.

    Using hash is like a bad DOM. You have to use it all before you can get anything out.

    Say I would like to inspect this POST:

    Now by putting everything into your dictionary(hash, or array) you have to read over all of the 69MB of data.

    But what if I just wanted to get the value for the first 'stop_the_war_now_you_bastards' variable? Using an iterator or a generator I wouldn't need to process all of that 69MB of data, and everyone could just live in peace. No one likes to give 69MB to someone if there is no need to send 69MB... it's just a waste of bandwidth on the intarwebs.

    raw encoding is needed sometimes

    The problem is that http encoding is not always correct. Sometimes you need to look at the raw encoded version. Like how sometimes different clients/servers encode/decode '+'. This can cause subtle bugs in some cases (like when you are comparing things). I won't explain further... you'll just have to believe me... like how you believe the news.

    Unfortunately keeping the raw encoding around with the decoded version wastes memory. Wasting memory leaves a yucky taste in my mouth. So laziness comes to the rescue again!!! Lazily decode your variables. Hey, no point decoding that 69MB if you don't need it eh?

    Ordering, and duplication of variables

    You are allowed to put any number of different variables in the same request.

    So this means ?a=3&b=2&a=4 is valid.

    But what does GET['a'] give you in most web codes? Are you getting 3 or 4? This is why you need to figure into your abstraction both ordering and duplication.

    *1 The editor and I are the same person. Did you read the editors note words with the same internal voice as the rest of these words? Is the editors voice a deep manly voice, or perhaps a mousey womans voice? Note that the first chain powered bicycles came out later in 1885, a year after my friend was talking about starting a company up to make them. I think someone heard about his designs one night at the pub. oh well.

    Wednesday, July 09, 2008

    Arts grants Australia

    Hacker artists in Australia looking for arts grants? is a fresh site to find grants... if you're in Australia.

    Tuesday, July 08, 2008

    pygame 1.8.1rc1 released for testing...

    See what's new for the release candidate for what's new in pygame 1.8.1. It's what will most likely be pygame-1.8.1release.

    Mostly it will be a bug fix and polish release, but there's a few new goodies that were sneaked in.

    I think we'll release 1.8.1 next week, unless there's any fixes that need to go in.

    See the recent mailing list post for download links, or subversion/trunk if you would like to test it out.

    Thanks to Marcus, Lenard, Brian, Nicholas, Charlie Nolan, Frankie Robertson, John Krukoff, Lorenz Quack, Nick Irvine, and everyone else who helped out with this release.

    Next up for pygame 1.9.0 will be a lot of changes... a camera module with computer vision algorithms, extensive tests, new drawing code, a physics module, a new movie module, an improved mac osx port amongst other things.

    Protocol Buffers - is it really faster than xml?

    It seems google is claiming their protocol buffers are faster than xml... without any proof.

    Consider AsmXml, which can process xml at over 200MB/s on old machines.

    The protocol buffers from google also generate wrappers for different languages, and other nice things. But for loading structures into and out of memory, xml can be very fast.

    Before claiming things like that, I think proof in the form of benchmarks are needed.

    I don't doubt they thought that xml was slower, since many implementations are slower. Maybe xml is slower, but there is no proof yet. Also I'm sure the other nice features of protocol buffers make them perfectly suited for their task.

    Url encoding could have been used nicely too.

    Saturday, May 31, 2008

    buildout tutorial. buildout howto. buildout review.

    This post is a review, a tutorial, and a howto - for and about buildout - a software development tool for the python language.

    This document aims to answer the question... "buildout? WTF?".

    In short: buildout automates python project building. Buildout does everything needed to get your application in a state for running in its own sandbox.

    Super quick start instructions for using buildout...

  • get the source from
  • Make a new directory for your project, then copy the bootstrap/ file out of the zc.buildout source into your new project directory
  • create a "buildout.cfg" file to go with the file. Here is a simple one for your package called "YOURPACKAGENAME":
  • [buildout]
    parts = test py
    develop = .

    recipe = zc.recipe.testrunner
  • Run "python" in your empty project directory(with the buildout.cfg file in there).  This will get buildout locally into your sandbox ready to use - without touching the rest of your python installation.
  • Now you have a basic setup for "building out" your application.

  • What is buildout?

    "The Buildout project provides support for creating applications, especially Python applications. It provides tools for assembling applications from multiple parts, Python or otherwise. An application may actually contain multiple programs, processes, and configuration settings."

    Why should I care about buildout?

    Automation of building your applications is what buildout is about.

    To be able to build your application easily on multiple machines, you don't want to have to install and setup 38 different programs before you can build it.

    Buildout keeps your project separate from the main python setup.  So it doesn't install things into the main python distribution.  This is good because it keeps separate applications mucking each other up.  It's also good so you don't need to have a root user account to install python modules.

    Buildout can be extended through the use of recipes.  Recipes are like plugins, and they do all sorts of things.  You can see a list of buildout recipes on the python package index (pypi).

    buildout can do lots of other things too - but these are the core concepts.

    Where is buildout? Links to buildout pages.

  • The buildout url:
  • A buildout tutorial which seems better than the official documentation - but hard to find with search engines. It's written as a tutorial to give to people - not really to read online.
  • Plone buildout tutorial. - this one is specific to plone.
  • subversion repository for zc.buildout:
  • Licence: The Zope Public License

  • buildout recipes on pypi

  • Disadvantages to buildout?

    You become dependant on a few things. At least with buildout you become dependant on:
  • zc.buildout
  • setuptools
  • website remaining up... it is fairly often down.
  • distutils - buildout requires a file.

  • Who uses buildout? How stable is it? How portable is it?

    At the moment buildout is mostly used by zope, and other python web applications.

    It's a fairly recent project - first released mid 2006. However it's a 3rd generation buildout system used by the zope corporation - so it's got a bunch of wisdom behind it.

    Buildout seems to be stabilising... that is the amount of changes to it seems to be slowing down. There seems to be about 37 bugs in the buildout bug tracker as of writing(2008-05-01) - with 3 of the bugs marked fixed (at 2008-05-31 and still only 3 of the bugs marked fixed) - and a number of bugs under discussion.

    Documentation isn't the best (which is one reason I'm writing this post) - but there is at least a main manual, and a tutorial.

    There do seem to be quite a few doctest based tests that come with it - which is one form of documentation in itself - but more documentation about zc.buildout - rather than documentation for using zc.buildout. There is about 1400 lines of python in the tests, and about 3000 lines of non-python code in the doctests (usually description about what the tests are doing).

    I'm not sure how portable buildout is. The last release (as of writing 1.0.1 (2008-04-02)), mentions windows fixes, and was the last release for 3 months. I know of people using it on linux(suse, debian), and mac osx based machines.  Update: a note in the comments says it works fine on windows.

    Thursday, May 29, 2008

    gsoc2008 and pygame...

    The Google Summer of Code(gsoc) has started, and students have officially begun their work this week.

    Already design, and code are starting to appear from them.

    Here are the pygame related projects, and their blogs:

    Zhang Fan, "minz", blog:
    physics stuff

    Zhang Fan went through the earth quake in China, but luckily him and his family are ok. Zhang has been studying various physics libraries, algorithms and code. As well he has begun work in a separate branch. So hopefully his work will then be merged in at a later time after his project. You can view his branch here:
    physics branch

    Nicholas Dudfield, "akalias", blog:
    tests for pygame

    Nicholas's test work is going into the pygame trunk, and he has been working on some tools to help generate most of the test bodies. So this way we will be able to see the number of tests needed to implement. As well he began to write some tests for some parts of pygame that need more tests for the pygame 1.8.1 release(coming soon).

    Nirav Patel, "nrp", blog:
    computer vision stuff (through the OLPC project, not mentored through pygame)

    Nirav has been working in his local git repository since he doesn't always have internet access where he is. He's proposed some ideas for how his camera access API would work on the mailing list, and discussion has begun there. He plans to upload his work onto the internet when he has access for people to look at.

    SDL gsoc projects

    Also there are SDL related GSOC projects which will help pygame too (pygame uses SDL)...

    Edgar "bobbens" Simo:
    Bobbens is an undergrad in industrial engineering, and will be working on developing a force feedback API.

    Aaron Wishnick:
    Aaron is an undergrad in mathematics, and will be working on audio resampling and pitch shifting.

    Holmes Futrell:
    Holmes is an undergrad in computer science and mathematics, and will be porting SDL to the iPhone.

    Darren Alton:
    Darren is an undergrad in computer science, and will be porting SDL 1.3 to the Nintendo DS, using the hardware capabilities of the DS to showcase the new features in SDL 1.3.

    Szymon "Wilku" Wilczek:
    Wilku is an undergrad in computer science, and wants to add support for pressure sensitive devices to the SDL API, specifically using the Wacom tablet as an example.

    Thursday, April 24, 2008

    "raise" becomming a function in py3k?

    Over on the voidspace blog, there is a little discussion about raising an exception in a lambda.

    Because raise is a statement, it's kind of a hard thing to do. Raising an exception as an expression that is.

    Which "raises" the question, why isn't raise a function in py3k?

    The two suggestions on how to raise in an expression were these:
    >>> r = lambda: eval(compile("raise RuntimeError", '', 'exec'))
    >>> r()

    >>> ctypes.pythonapi.PyErr_SetObject(*map(ctypes.py_object, (e.__class__, e)))

    Which are kind of both a bit yuk.

    So maybe raise could be a bit more expressive in py3k?

    Wednesday, April 23, 2008

    Bars in Beijing?

    A friend of mine who lives in Beijing has set up a website categorising all the Bars in Beijing.

    It's still a work in progress, but he has listed over 500 bars so far. For a place as big as Beijing, you can imagine that there's going to be a lot of bars. They're categorised by location, and if they are a night club, a bar, or a KTV(karaoke) place etc.

    He still wants to add photos for all of the bars, and just generally make it a nice guide to Beijing bars.

    Tuesday, April 15, 2008

    Ludumdare 48h game development competition this weekend.

    For those that didn't have time for pyweek (like me) - there is the ludumdare game development competition.

    The ludumdare competition is similar to pyweek - it's what inspired pyweek.

    The main differences are it's more "from scratch", it is only one weekend, and you have to do everything yourself - no teams. Also you can use any language - not just python, and everyone can select themes over three voting rounds.

    The main idea is that One has to do all parts of game development - art, coding, sound, music etc, and to concentrate on the design of the game - rather than building engines. So it's a short burst of creativity, and junk food eating - with around 100 other people at the same time making their own games.

    (img by MrFun).

    LD 11 :: Weekend of April 18-20 - Currently doing round 2 of theme voting.

    Tuesday, April 08, 2008

    database ORM adaptors?

    Are there any adaptors for the various python database ORM models?

    For example SQLObject <-> Storm <-> mother ORM <-> django ORM <-> SQLAlchemy <-> GeniusSQL, etc.

    It seems this might be a good way to reuse some models, and code for those models.

    For example, say there was a SQLAlchemy <-> Django ORM adaptor, then pylons, django, and turbogears could more easily inter operate.

    Then if an adaptor for SQLObject <-> SQLAlchemy was made SQLObject could then use the SQLAlchemy <-> django ORM adaptor.

    I guess at this point, sharing at the database level makes more sense.

    update: seems to be a work-in-progress "project to create SQLAlchemy mapping of Django models onto a SQLAlchemy backend".

    Wednesday, April 02, 2008

    Being proactive with bugs - search, not categorise.

    I like to search for bugs, not so much wait for them to be reported in one specific way. Here's a story to illustrate what I mean.

    As part of a new pygame release we've been improving the pygame bug reporting, and fixing system.

    The old(and current) system used the mailing list as a bug reporting system. We still use this system, but have added a few other methods. People simply report bugs and patches to the mailing list. Then developers search through the mailing list, and noted when they were fixed, on the mailing list. Because the pygame mailing list is quite large often a lot of people would view, review and fix the bugs. It also informs people how to report a bug - because people on the mailing list see it happening every now and then.

    Having bugs in the mailing list is nice, because I can type BUG into my mail programs search function to find bugs. Or I can type PATCH to find patches. Or I can have my program filter emails with bug, patch from specific mailing lists to bug, and patch folders. When a bug is fixed, or people want to discuss it, you can just tell them in the email.

    Some times people also email me directly about bugs - which is pretty easy if they don't want to join the mailing list, or put it into a bug tracker. People also leave bug reports in our web based documentation commenting system - and not only documentation bugs.

    However bugs often got reported in all sorts of other weird places. People talk about bugs in OS distribution bugzillas, random blogs, and also random forums. As well as people talk about bugs on irc. There are also SDL specific bugs reported in their bugzilla (pygame depends on the Simple DirectMedia Layer).

    So rather than waiting for people to submit their bugs in a particular way - we now go and search for them too. On the pygame bug page, I have collected together a selection of links to different OS specific bug trackers. So it's easy to see how the OS distribution specific bugs are going. (ps freebsd, and gentoo have been the best updating their packages of pygame to version 1.8 so far).

    Searching for bugs, rather than waiting for people to report them, and categorise them is the way to go. Luckily we have search engines which can search the internet for bugs easily.

    So now, rather than typing BUG into my mail program, I can type it into a general search engine. Since mailing lists, bugzillas, forums, and blogs are all mostly indexed - my searches for bugs and patches work just fine.

    We also have a web based bug tracker - a pygame bugzilla - for those who like to file bugs away in a database. Since some people prefer to submit, and track bugs that way.

    update: This World of Reuse blog post asks if this proactive approach to bugs is scalable for larger more widely used projects like firefox. I commented on the blog how it could be added to any sized project, but the comment is still in the moderation queue. I found the world of reuse blog post with my "pygame bug" searching.

    Saturday, March 29, 2008

    hi, what is it? oh pygame 1.8 is released.

    Dear you,

    I was walking down the street the other day and pygame 1.8 was
    accidentally released.


    Well anyway. Have a nice day.

    * pygame.mask for pixel perfect collision detection
    * pygame.scrap for clipboard support
    * new and improved sprite groups, including layers, automatically
    selecting fastest update mode(full screen or dirty rect updates), and blend modes...
    * blending support for filling and blitting surfaces. ADD, SUB, MULT, DIV etc.
    * saving surfaces as jpeg and png
    * buffer access for Surface and Sound objects
    * numpy, and numeric support for pygame.surfarray and pygame.pixelarray
    * PixelArray, which can be used instead of numpy - without the dependency.
    * smooth scale function written in mmx assembly with C fallback.
    * More functions release the GIL for multithreaded use.
    * lots of speed ups to many functions via better python wrapping.
    * color thresholding, bounding box finding for images, and surface averaging.
    * massive documentation updates (which have been available on the website for a while already).
    * pygame.time.Clock.tick() is more cpu friendly.
    * updates to example programs.
    * new windows, and mac installers.
    * hardware acceleration updates for overlays and opengl.
    * porting work to different platforms.
    * heaps of bug fixes including SRCALPHA blitting fixes, 64bit fixes, sound system fixes.

    Plus there have been lots of changes to SDL itself since the last pygame release.

    * lots of stuff really... but those are some of the nice things. Read the what's new page for full details


    ps. Balloons and robots are cool.
    pps. see readme for credits. Thanks to all the people who helped out :) Time for much beer drinking now I think.

    Monday, March 03, 2008

    py3k Decimal?

    From the Cobra language, comes the idea of using Decimal numbers as the default. It's 2008, so let's use decimals by default!

    This is an error that python has... Add 0.1 together ten times, and you do not get 1.0.

    >>> 1.0 == 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1

    Maybe py3k should use Decimals by default instead? Or is this planned already?

    Python float performance is really bad anyway, so we might as well make it a little more accurate right?

    Floats are such a cause of errors in code, it'd be nice if math was more accurate by default :) It requires a fair bit of knowledge to understand all the quirks of floats, but less to understand the quirks of decimals.


    Friday, February 15, 2008

    Great from scratch blender animation tutorial

    I've gone through this great blender animation tutorial.

    It's really well made, and teaches you blender from the beginning - explaining everything as you go.

    It was a "Blender summer of documentation" project where someone spent a whole month working on it. It was also based on an older tutorial which was itself really good There's a downloadable PDF version (180ish pages) if you prefer to read things that way - otherwise it's broken up into many separate html pages. It's also got .blend files you can download at every step if you wish - so you can skip steps.

    So if you want to go from knowing nothing about blender, to being able to construct and animate a basic 3d character - this is the tutorial for you.

    Introduction to Character Animation - with blender

    Friday, February 08, 2008

    Using pygame without a windowing system.

    This cookbook entry shows how you can use pygame without a windowing system.

    Useful for scripts that run in webservers, or little command line utilities.

    Sometimes you just don't need a GUI. Like maybe you want to do some 2d drawing in your opengl application.

    The cookbook example is just a thumbnail generation example(using pygames fast mmx assembly using smoothscale function) - but you can do lots of other things with pygame too - like drawing lines - or graphing.

    Tuesday, February 05, 2008

    Lamina - using pygame GUIs with opengl.

    David, the author of the upcoming Pitchers Duel baseball game has made a nice little module for pygame and opengl.

    It allows you to use some of the GUI libraries with PGU. In the examples, it uses the excellent PGU, and Ocemp libraries.

    However I think the general method can be applied to other GUIs fairly easily. It does the drawing on off screen surfaces, updating opengl textures as needed.

    It even has a zooming demo... where the gui zooms. I like things that zoom.

    Sunday, February 03, 2008

    pygame dev updates. 620 projects on

    We have a new windows maintainer - Lenard Lindstrom. He's been submitting patches to pygame for a while now, and as agreed to help get pygame 1.8 out the door.

    As part of his work, he has made compiling pygame on windows a lot easier.
    """I automated the dependency build process using a single standalone Python program, All that is needed is to obtain the necessary libraries and MinGW/Msys tools. The builder will first reconfigure MinGW for msvcr71.dll. Then it will build all the libraries and install them into the Msys directory structure. All this can be done from the Windows command prompt. Expect it to take several hours though. Next the Pygame script is run from the Msys console. Make sure the Python directory is in the Msys PATH. Finally can be run from the command prompt to build and install Pygame itself. All the necessary libraries will be copied to the pygame package."""

    Brian Fisher has also joined the pygame dev team to help squash bugs, help people on the mailing list, set up an automated build compile farm, and generally help out on things. Brian also been submitting patches for a while now.

    Marcus has finished his Numpy migration work - by changing the soundarray module so that it can use Numpy or Numeric to generate sounds from python.

    There has also been a few more bits of functionality added around the preparations for release.

    The pixel perfect collision detection uses the Mask data type. However now Mask can now also be used to find bounding rectangles around joined pixels.

    pygame.transform can find edges in an image, get the average surface of many surfaces and also threshold an image by color.

    Only a couple of things remain on the todo list before release now... Mac OSX clipboard support, and the Mac OSX installer. Both are being worked on, and tested. The Mac OSX installer mostly works - however we want to make sure it's perfect before we release it.

    620 projects are listed on the website now. Some very interesting stuff pops up there. Everything from a VNC 2 flash video converter, to soccer games, to games where a big kid bashes up hundreds of little kids, to a graphing program. All sorts of things, mostly done by one person too!

    Tagging was added to the pygame website a number of months ago, and now all of the projects are slowly forming into more groups. Here are some of the more popular tags:
  • platformer
  • arcade
  • 2d
  • action
  • pyweek

    Some tags for individuals who have put up lots of projects.
  • philhassey
  • pymike
  • mallett

    It is still xmas on the website until we get this release out! (Unless we release next xmas, and then it'll have to be xmas on the website for a while longer.)
  • Friday, January 18, 2008

    hOur Factory - Melbourne Australia.

    hOur Factory is a Melbourne arts festival of sorts that I'm involved with.

    Unlike most arts festivals, or parties hOur Factory lets interested people vote, and chose the theme. hOur Factory is an exhibition of arts, a warehouse party, and a film night all held in a big space on March 1st.

    It will have a gallery opening feel, and then move into performances, and music.

    Depending on the theme, I might be working on a project with 28 monitors and a whole lot of webcams. The idea is to form them into a sphere like shape, and have the monitors pointing outwards. So it could act as a spherical mirror of sorts. However the possibilities are quite large. It's going to be made from cheap $5 webcams, and recycled monitors that we hope to get for free (since so many people are throwing out their old CRT monitors).

    I should be using pygame to drive the displays... maybe doing some real time effects on them if there is enough processing power.

    I already have six CRT monitors, but I will be looking to borrow more. I've got a few old PCs that I'll be using with linux to do the processing.

    Once the theme is chosen for hOur Factory, then people will start writing about what their projects are on the hOur Factory website. If you know anyone in Melbourne who might be interested in being involved in an arty project - please let them know about it.