Archive for the 'python' Category

Python on Leopard

Saturday, October 27th, 2007

After my DeveloperTools installation from the Leopard setup DVD i had a look around at the tools.

First let me say that the new tools are all great. Especially Instruments is quite useful. Being a Python guy i remembered something about a new version of PyObjC coming bundled with the DeveloperTools. In fact it should be version 2.0. So i created a new python-project in XCode and it seemed to work fine - but i was using the old PyObC version i had installed before on my Python 2.4. I tweaked a few paths back then to get rid of the 2.3 version of python which was delivered with Tiger. I somehow expected 2.5 with PyObjC 2.0 to be installed and setup by the DeveloperTool’s installation.

In fact it’s all there in all it’s greatness. First make sure you didn’t override some paths/symlinks or whatever. Starting python from the console should start the Version 2.5.1. It’s home is in /System/Library/Frameworks/Python.framework/Versions/2.5/ and it comes with a bunch of packages

  • PyRSS2Gen - 1.0.0
  • Twisted Xish - 0.4.0
  • Twisted - 2.4.0
  • altgraph - 0.6.8.dev
  • bdist-mpkg - 0.4.3.dev
  • bonjour-py - 0.2
  • modulegraph - 0.7.2.dev
  • numpy - 1.0.1
  • py2app - 0.4.1.dev
  • pyOpenSSL - 0.6
  • pyobjc-core - 2.0
  • pyobjc-framework-AddressBook - 2.0
  • pyobjc-framework-AppleScriptKit - 2.0
  • pyobjc-framework-Automator - 2.0
  • pyobjc-framework-CalendarStore - 2.0
  • pyobjc-framework-Cocoa - 2.0
  • pyobjc-framework-Collaboration - 2.0
  • pyobjc-framework-CoreData - 2.0
  • pyobjc-framework-CoreText - 2.0
  • pyobjc-framework-DictionaryServices - 2.0
  • pyobjc-framework-ExceptionHandling - 2.0
  • pyobjc-framework-FSEvents - 2.0
  • pyobjc-framework-InputMethodKit - 2.0
  • pyobjc-framework-InstallerPlugins - 2.0
  • pyobjc-framework-InstantMessage - 2.0
  • pyobjc-framework-InterfaceBuilderKit - 2.0
  • pyobjc-framework-LatentSemanticMapping - 2.0
  • pyobjc-framework-LaunchServices - 2.0
  • pyobjc-framework-Message - 2.0
  • pyobjc-framework-PreferencePanes - 2.0
  • pyobjc-framework-PubSub - 2.0
  • pyobjc-framework-QTKit - 2.0
  • pyobjc-framework-Quartz - 2.0
  • pyobjc-framework-ScreenSaver - 2.0
  • pyobjc-framework-ScriptingBridge - 2.0
  • pyobjc-framework-SearchKit - 2.0
  • pyobjc-framework-SyncServices - 2.0
  • pyobjc-framework-SystemConfiguration - 2.0
  • pyobjc-framework-WebKit - 2.0
  • pyobjc-framework-XgridFoundation - 2.0
  • pyobjc-xcode - 2.0
  • python-dateutil - 1.2
  • setuptools - 0.6c7
  • wxPython-common - 2.8.4.0
  • wxaddons - 2.8.4.0
  • xattr - 0.5
  • zope.interface - 3.3.0

I generated this List with Yolk and modified it a little to exclude packages i installed already and added a few that yolk seemed to have missed.

First off i find it remarkable that wx is included. I don’t know the reason for this. I use wx so this is great for people like me. Secondly py2app was kind of obvious (XCode bundles python projects up in the build phase to produce a stand-alone app) but i was really surprised to find twisted in there.

I got my hopes high when i heard about Apple being officially more supportive towards dynamic languages like Ruby, Python and Perl and i am not disappointed - and yes ruby on rails is there for those interested.

The integration in XCode and it’s tools seems to be nice but i didn’t have enough time to dig into it.

Gaming project in python II

Thursday, April 27th, 2006

Since the last announcement on the game in python some work was done on it. My graphics-guy produced the first models in Blender which we imported successfully into Ogre.

My first goal was to get the tool-chain in-place. Currently all we need is Blender, any python IDE (i stabilized on using Eclipse with the pydev plugin - great stuff, esp. the debugger), a graphics program. That’s about it. We will probably need a few more tools:

  • an easy to use model viewer for the artist. I dug up a few quite usable model viewers but i think i need a model viewer more specific to the needs of the game. Later on we will use node references in the models (null objects, e.g.) to save space and so.
  • An easy way to deploy it in several forms
    • source (duh)
    • win32 executable. Did that a thousand time and already know how to do that
    • apple executable. I know how to do that but i have no idea how difficult it will be with the newly introduced ppc/intel issues
    • linux executable. A no-brainer with cx_freeze or something similar.
  • Since the game will be data-driven we need an editor sooner or later. I thought about creating my own toolchain in pure python starting from within Blender to standalone tools that should be as general-purpose as possible. I have a nice GUI in Blender, that basically reimplements a full blender gui for general use

Since i decided on a multiplayer game i had some thoughts about how to structure the whole thing. There will be a server and a client. Each component will have several threads: One networking thread that does all the network stuff (twisted can do that for me pretty easily), one game-logic thread. The client will have the additional presentation layer which in itself uses a couple of more threads (music e.g. is in it’s own thread). To get it all playing together nicely will be interesting. My first goal is then to create a 3d chat client-server architecture. Two clients can connect to the server and chat using the 3d presentation layer. Additionally they are notified of incoming messages with sounds.

While coming up with that plan i realized one thing i am missing the most currently: A GUI! Since that will be a vital part in the game i want the gui to be as configurable as possible from within python. For several reasons i do not want to use the CEGUI which is so popular in the ogre community. I will probably try to port ocempgui to the pyogre/pygame combination and see if that works. I had a good look at the ocempgui and liked what i saw. Probably i will rip out a few things but most of it well engineered, esp. the event system. For some reason i would really like to have gui elements being 3d objects in themselves not mere overlays. This would make a lot of sense for a few elements i identified, esp. a time-line like bar at the bottom that will display daytime, weather, month…

Another thing i wanted to have a look into is marry the ogre scenegraph with openal to get sorround sound. This is definitely a nice-to-have and nothing else. If i can’t pull it in a safe way that needs only little maintenance i will ommit it.

The first screenshot from within the engine. Not a lot to see so far but it was already quite rewarding to play arounf wit 3d and python. Game0002.png

CMS presentation 2

Tuesday, February 28th, 2006

Well, i think it went quite fine so far (considering that there were nearly 30 people sitting around me at the start, my god) though i quickly noticed i couldn’t stop talking about pyhton and zope. They inquired me about solutions for versioning, undoable stuff, integrated user authorization, workflows and, and, and. I was originally quite open about what to propose and you may have already guessed it - we ended up talking about ZOPE. One of the final question was if it’s possible to talk to LDAP as a user auth source. Well, yes! Hell yes!

Anyway, another thing i realized is that i know my way around in the zope world and flirted with other frameworks but i should really get some stuff done with them and get my hands dirty.

So i pledge to myself to code a minimal application in every popular python framework (except Zope 2.x which i know quite well)

I also stumble upon more and more new python packages that i never heard of before. Each one reads better than the other. I wonder why there are suddenly such a lot of web related packages/frameworks popping up? Well, part of the answer is certainly Ruby On Rails and honestly i think it’s one of the best things to happen to python on the web.

Things to look at as well:

Since they want to operate on a lot of binary data as well maybe i should throw cx_bsdiff into the discussion as well (versioning a 460MB movie several time hurts a lot)

Ah…hehe - it was also a big showoff for my shiny new MacBook Pro. I didnt brag to start with or anything. Martin just asked me if i got my new MacBook with me. After my confirmative answer he shouted around “Anyone wanna see an intel based mac notebook?” lol

Gaming project in python

Sunday, February 26th, 2006

Recently i started a gaming project with my flatmate. I do the coding part and he does the design part. Game design is done by both.

The idea is to get a feel for what it takes to make a game.

After reading nearly all Post Mortems on gamasutra i have the impression that creating games can create a whole list of issues, especially in bigger projects but also on smaller projects. I am curious how our little project turns out.

We did not yet decide on a name or even a codename for that matter. So far i can only state the following:

  • The game will be open sourced (probable not as viral as GPL, maybe CC)
  • I will use python, pygame, pyogre and maybe twisted if we decide on multiplayer
  • I will create a developer diary so i can track later on what happened and maybe write an article about it
  • The game will be in 3D (as you may have guessed from the pyogre part)
  • It will be about trading in a fantasy world (the whole game concept is already much more detailed but that should give you a hint on the direction)

I suspect the project will need at least 6 months to be in a presentable state. We will try to keep the game concept modular so that we can start small without selling our vision on future ideas. Certain restrictions certainly are wise as well. We will not incorporate an action component. The game will give as much time for your decisions as you want at any point. This certainly indicates that it will be a turn based game. We will not target for economic realism as well as graphical realism. A working economical system certainly is necessary to keep the game balanced but realism is not our goal.

So far we are in the phase of building the infrastructure for that (wiki, svn/cvs, a sort of buildbot or at least scripts to easily freeze the python sources into a binary). since we do a 3D game we will use Blender for modelling and probably also as a small game level designer (dived deeply into the blender python and it is very nice).

…to be continued