• Zeth will be attending PyCon UK on the 12th to 14th September 2008.

5 Homebrew Python Games

2 September 2007

What is PyGame?

The Open Graphics Library (OpenGL) is used to make 2D and 3D graphics, it is the main competition to Microsoft's 'Direct' library. On top of this you can run the Simple DirectMedia Layer (SDL), this provides access to OpenGL and to the sound, keyboard, mouse and so on.

On top of this you can run Pygame, which is a library of Python modules that you can use to write graphical computer games in Python. This is where the fun begins. As well as providing the library, the Pygame website hosts games made by Pygame hobbyists, many of these games are made during one week game writing contents called 'Pyweek'.

I thought I would look at some of the games made with Pygame. No order or planning went into the selection of these, these are literally the first five games that I game across. As normal, click on the screenshots to enlarge.

PyTanks (unknown licence)

The first game, PyTanks by Joel Stenkvist, is a Scorched Earth-style artillery game (you younger people will know the game 'Worms' with its amusing sound effects). The idea is that you get all your friends around, take a tank each and blow each other up, all good clean fun!

`.. image:: http://commandline.org.uk/images/posts/pygame/pygame-tank.png

System Message: WARNING/2 (<string>, line 25); backlink

Inline interpreted text or phrase reference start-string without end-string.
alt:Tank game

System Message: WARNING/2 (<string>, line 27)

Definition list ends without a blank line; unexpected unindent.

`_

System Message: WARNING/2 (<string>, line 27); backlink

Inline interpreted text or phrase reference start-string without end-string.

Endgame: Singularity (Open Source - GPL)

The next game was my favourite, `Endgame: Singularity`_ by 'Evil Mr Henry', is a strategy game where you play an Artificially intelligent program that is accidentally created on a University computer. You have to hide from the suspicious and hostile human race by obtaining as much computer power as possible, you can hack PCs or order custom clusters, build a race of robot helpers and even create server rooms in space. I do not want to give away much more as it spoils the fun.

`.. image:: http://commandline.org.uk/images/posts/pygame/pygame-endgame- singularity.png

System Message: WARNING/2 (<string>, line 41); backlink

Inline interpreted text or phrase reference start-string without end-string.

System Message: ERROR/3 (<string>, line 43)

Unexpected indentation.
alt:AI Game

System Message: WARNING/2 (<string>, line 44)

Block quote ends without a blank line; unexpected unindent.

`_

System Message: WARNING/2 (<string>, line 44); backlink

Inline interpreted text or phrase reference start-string without end-string.

I really enjoyed playing the game through, but once you get the idea then the human race is not much trouble. What would really extend the game further would be a multiplayer mode, several AIs competing for resources and giving away the enemy AIs' positions to the humans would be really cool. I will certainly keep an eye on future development to see how he takes this game forward.


Galcon (Shareware i.e.Try before you buy)

Galcon by Phil Hassey is a nice little game where you have to send all your space ships between planets in order to control the galaxy.

`.. image:: http://commandline.org.uk/images/posts/pygame/pygame-galcon.png

System Message: WARNING/2 (<string>, line 60); backlink

Inline interpreted text or phrase reference start-string without end-string.
alt:Galcon screenshot

System Message: WARNING/2 (<string>, line 62)

Definition list ends without a blank line; unexpected unindent.

`_

System Message: WARNING/2 (<string>, line 62); backlink

Inline interpreted text or phrase reference start-string without end-string.

Like many homebrew games, it is a bit too easy and simplistic once you have mastered the initial step, but otherwise it is fast moving, responds well and looks good.


GalaxyMage (Open Source - GPL)

Somewhat more ambitious is GalaxyMage. GalaxyMage is a turn based fantasy role playing game, that looks and feels like the tabletop war games that I played in my early teens, although the advantage of the computer game version is that it does not take half a day to lay out all the troops! If you have played these table top games then you will know the format already, each of your little men has a basic turn which consists of move then attack/spell.

`.. image:: http://commandline.org.uk/images/posts/pygame/pygame- galaxymage.png

System Message: WARNING/2 (<string>, line 79); backlink

Inline interpreted text or phrase reference start-string without end-string.

System Message: ERROR/3 (<string>, line 81)

Unexpected indentation.
alt:Fantasy Game

System Message: WARNING/2 (<string>, line 82)

Block quote ends without a blank line; unexpected unindent.

`_

System Message: WARNING/2 (<string>, line 82); backlink

Inline interpreted text or phrase reference start-string without end-string.

GalaxyMage supports both single player and multi-player modes, and with a little bit more development could be a real goer, I can imagine a scene forming around it with different groups making different units, terrains and scenarios.


Colonel Wiljafjord and the Tarbukas Tyranny (Licence unknown)

The last game, Colonel Wiljafjord and the Tarbukas Tyranny, again by Phil Hassey, is a graphical adventure/puzzle game in the style of Day of the Tentacle or Monkey Island. It only seems to have one level at the moment (it was a PyWeek entry), but it is really nicely drawn and narrated. It shows what could be archived with PyGame in this genre.

`.. image:: http://commandline.org.uk/images/posts/pygame/pygame-colonel- wijafjord.png

System Message: WARNING/2 (<string>, line 99); backlink

Inline interpreted text or phrase reference start-string without end-string.

System Message: ERROR/3 (<string>, line 101)

Unexpected indentation.
alt:Puzzle Game

System Message: WARNING/2 (<string>, line 102)

Block quote ends without a blank line; unexpected unindent.

`_

System Message: WARNING/2 (<string>, line 102); backlink

Inline interpreted text or phrase reference start-string without end-string.

`.. image:: http://commandline.org.uk/images/posts/pygame/pygame-colonel- wijafjord2.png

System Message: WARNING/2 (<string>, line 106); backlink

Inline interpreted text or phrase reference start-string without end-string.

System Message: ERROR/3 (<string>, line 108)

Unexpected indentation.
alt:Another shot of the Puzzle Game

System Message: WARNING/2 (<string>, line 109)

Block quote ends without a blank line; unexpected unindent.

`_

System Message: WARNING/2 (<string>, line 109); backlink

Inline interpreted text or phrase reference start-string without end-string.

So they were the games that I played, if you try out any cool ones then let me know in the comments. Happy playing.

Docutils System Messages

System Message: ERROR/3 (<string>, line 33); backlink

Unknown target name: "endgame: singularity".

1 bug says...

Nice computer game. But I really can't figure how to not get exposed. Mind tipping me?

Posted at 1:08 p.m. on September 2, 2007


2 Joe Strout says...

Thanks for the review. But can you fix all those system errors and warnings interrupting all the posts? They make it a bit hard to read...

Posted at 1:32 p.m. on November 27, 2008


What do you have to say?

Show Editing Help


PyCon UK

About

Hello, my name is Zeth, I'll be your host here.

Command Line Warriors is about taking control of your own technology, it looks at our experiences of computing; especially using GNU/Linux, the Python programming language, the command-line and issues such as techno-ethics, best practices and whatever is cool now. If you take control of your technology then you are a Warrior too!

This site is your site too which means that you can contribute and get involved. You can leave comments using the facility provided. For me, the comments and discussions are by far the best part of the site. So please do have your say!

Latest Discussions

Tringi

December 1, 2008
Hi, I am far from your league, but instead of [20. Nd5], why not just play Qd8? :-) Wouldn't it be only Qd8 Qd8 then, or am I missing something?
Ruy Lopez, Berlin defence, open variation part three

Tringi

November 30, 2008
...oh, I meant "Qe8 Qe8" in my previous post, sry ;-)
Ruy Lopez, Berlin defence, open variation part three

Cruze

November 29, 2008
Buy discount professional health products online.
Include ODF support in the Linux Standard Base?

Mike

November 29, 2008
>The most useful xmlstarlet tool for me has been the XML validator, >which tests whether your documents are well formed or not. You >use the tool as follows: >xmlstarlet val ...
My God, it's Full of XML

Giacomo

November 29, 2008
Er, "elif test `ls "$with_xqilla"/libxqilla*.so 2>/dev/null | wc -l` -gt 0 ; then" should now be "elif test `ls "$with_xqilla"/libxqilla.so* 2>/dev/null | wc -l` -gt 0 ; then", as the ...
Native XML storage with Berkeley DB XML - part one

Felipe Coury

November 23, 2008
What do I have to say? Only this: "THANK YOU"! Awesome!
SFTP in Python: Really Simple SSH

fmv

November 19, 2008
just a real db SAMPLE please
Native XML storage with Berkeley DB XML - part one

Very helpful

November 12, 2008
but i need more help. I'm have to execute the sudo command after I log in. What do I need to do to enter the password after the sudo command ...
SFTP in Python: Really Simple SSH

blz

November 12, 2008
I buy 99% of PEP8, except: I don't like the line spacing rules... I can't read the code when it's too close together - it looks congested and I can't ...
Twelve commandments for Beautiful Python code

Zeth

November 11, 2008
Hi Ioxs, I said above *"I will give an example of a standard directive, then an example of a third-party directive"*, so the image directive is the example of a ...
An Introduction to ReStructuredText

loxs

November 9, 2008
Hello, Are you sure about the sourcecode directive, because I didn't manage to make it work. And it doesn't work with the online renderers too.
An Introduction to ReStructuredText