…and sorry for not posting anything in the last few weeks. Instead, I am going to make few blog posts this week.
So, straight to the topic. I have received a nice summer trainee position from my university. I will be working on something called Cyber Foraging (you can check more about this by googling). I will get back to this later, once I have started the work and studied this area more. My job is to program something using Python. I have done few projects with python, but not for almost a year, so I decided it is time to recap some of my skills (and learn more, of course!). Those of you who are not familiar with Python I recommend you reading the website and getting to know the language. It is fast, efficient and powerful (although the whitespace system sometimes gives some headaches).
As I have probably mentioned before I am very much interested in game programming, but haven’t had much luck with it (I have tried to start with a WAY TOO HARD approach). I have had some hard time getting Ogre3D to work with c++ ( I really don’t know why it doesn’t work correctly plus I haven’t had much time). Well, Now with my new Python interest, I found out that ogre has also python version of it. I was able to get this Python-Ogre running. YAY! However, making 3D games takes a lot of time, which I don’t have too much, I decided that I need something a little bit less complicated. What I found out was this: PyGame.
Huh? PyGame? What’s that?
“PyGame is a Python extension library that wraps SDL library and it’s helpers” SDL (short for Simple DirectMedia Layer) is cross-platform multimedia library that provides a low level access to audio, keyboard, mouse, joystic and 3D hardware. SDL is written in C, but with the PyGame it will work with Python language as well. PyGame is actually really easy to program and even a programmer with not much programming experience can pretty quickly start coding nice 2D games. Why 2D? Simply put, 3D games require a lot more time, even more experience and more graphical skills than a 2D game (at least usually). A nice introduction to PyGame can be read from here.
How to get started?
1. Download Python. I am using version 2.6.5 which is currently the newest (of the 2. series). A note here. Python has also 3.version, but the syntax is different from the more widely used 2. version. It also has more third party software available than 3. version.
2. Download PyGame. Here it is important that you download the same version as your Python is.
3. If you don’t want to use IDLE (the editor that comes with the Python). The problem with IDLE is, that it has no code-completion or other “little-more-sophisticated” functions. However, you can finely debug and program with IDLE. I recommed installing Eclipse (the classic version is good one) and the Python add-on for Eclipse.
The PyGame website actually has pretty good collection of Tutorials. I really recommend checking them out! I myself started going through them last week and I have a
lready programmed some nice and simple games (for example the classic Worm game). From my experience I recommend at least the following tutorials by Lorenzo E Danielsson. Also another one worth checking out can be found from Eli Bendersky’s website.
Here is a screenshot of a simple worm game I created accoring to Lorenzo’s tutorials
The links I have supplied in this blog entry:
Lappeenranta University of Technology – http://www.lut.fi
Cyber Foraging by Google search – http://www.google.fi/search?hl=fi&q=cyberforaging&btnG=Haku&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=
Python – http://www.python.org/
Ogre3D – http://www.ogre3d.org/
Python-Ogre – http://www.python-ogre.org/
PyGame – http://www.pygame.org/
SDL – http://www.libsdl.org/
PyGame Introduction – http://www.pygame.org/docs/tut/intro/intro.html
Download Python – http://www.python.org/download/
Download PyGame – http://www.pygame.org/download.shtml
Download Eclipse – http://www.eclipse.org/downloads/
Python add-on for eclipse – http://pydev.org/
PyGame Tutorials – http://www.pygame.org/wiki/tutorials
Lorenzo’s Worm game tutorial – http://en.wordpress.com/tag/pygame-tutorial/
Eli Bendersky’s PyGame tutorials – http://eli.thegreenplace.net/category/programming/python/pygame-tutorial/