Posts

Showing posts from 2008

pygame ported to pyS60 for nokia phones.

Pygame on nokia phones with pys60!

Details here:
http://discussion.forum.nokia.com/forum/showthread.php?p=516861

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.

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

Image
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 cheap…

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.

Dino Vs Pirate ship

Image
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.

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.


Features
--------
* New FRect class for high precision rectangle handling using floating point
values.
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 sdlg…

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

Image
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.

art is boring

Image

My pyweek postmortem. Making a game in a week.

Image
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…

pygame.test -- moving testing forward.

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

Why?
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 eas…

The Lonesome West

Image
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.

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 objectsimage saving fixesgreatly expanded testsPixelarray, 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.

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)


www.ludumdare.com - the super awesome website, refresh hourly
irc://irc.afternet.org/ludumdare #ludumdare - the compo IRC channel, waste your time here
http://www.ludumdare.com/compo/ - the compo blog, be sure to sign up here
http://www.ludumdare.com/wiki/ - the compo wiki, submit themes & read rules here
http://www.ludumdare.com/planet/ - the compo planet, read about ou…

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):
self.storage = FileStorage.FileStorage(path)
self.db = DB(self.storage)
self.connection = self.db.open()
self.dbroot = self.connection.root()

def close(self):
self.connection.close()
self.db.close()
self.storage.close()



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 += "…

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.

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

Image
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 d…

Arts grants Australia

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

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.

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 http://pypi.python.org/pypi/zc.buildoutMake a new directory for your project, then copy the bootstrap/bootstrap.py file out of the zc.buildout source into your new project directorycreate a "buildout.cfg" file to go with the bootstrap.py file. Here is a simple one for your package called "YOURPACKAGENAME":
[buildout]
parts = test py
develop = .

[test]
recipe = zc.recipe.testrunner
eggs = YOURPACKAGENAME
Run "python bootstrap.py" in your empty project directory(with the buildout.cfg file in there).  This will get buildout locally into your sandbox…

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).

Nir…

"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?

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.

Ludumdare 48h game development competition this weekend.

Image
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.

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: http://code.google.com/p/django-sqlalchemy/ seems to be a work-in-progress "project to create SQLAlchemy mapping of Django models onto a SQLAlchemy backend".

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 list…

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.

oops.

Well anyway. Have a nice day. http://pygame.org/whatsnew.shtml
http://pygame.org/


* 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 do…

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
False


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.


cu.

Great from scratch blender animation tutorial

Image
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

Using pygame without a windowing system.

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

http://pygame.org/wiki/HeadlessNoWindowsNeeded


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.




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.

pygame dev updates. 620 projects on pygame.org.

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, build_deps.py. 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 config.py script is run from the Msys console. Make sure the Python directory is in the Msys PATH. Finally setup.py 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 py…

hOur Factory - Melbourne Australia.

Image
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 …