Thu, May. 24th, 2007, 02:45 pm
KDE Commit

In order to get my photos from the Editors gig I went to in Camden last night onto Last.fm I had to sign up for a Flickr account. I've been annoyed at my own home grown gallery script for a while, so I thought why not see if Flickr is usable to store all my photos.

My photo album program, KPhotoAlbum, has a Flickr export plugin but I discovered that it mangled the tags. If you tag a photo with a single multi-word tag in KPhotoAlbum it appears as multiple single word tags on Flickr. A quick download of the svn, create a small 10 line patch, test it, place it on KDE's bug tracker and less than five minutes later it gets applied to their subversion repository. Open source software at it's best :-)

In other, Last.fm related news, I'm through to the second round of jobs interviews there. Keep your fingers crossed.

Sun, Apr. 2nd, 2006, 12:20 am
PyWeek is over!

I've submitted the final version of my game, I've squashed all the bugs I could find and added as many features as I could.

The game can be downloaded here.

So, what can my game do?

  • You can build a network of steam pipes with various pipe sections using and easy point and click interface.
  • The steam 'flows' through the system in a seemingly realistic fashion, although I did just make it up!
  • You can guide the steam through additive squares that change the composition of the steam.
  • You can monitor the stream through a series of easy to read gauges and dials.
  • It has a menu system and pause functionality.
  • While playing the game you can consult helpful tooltips for, um, help.

I'm pretty pleased with the way my code turned out. Towards the end it turn into a hack-and-slash affair with new features being bashed in with a big messy hammer, but at least at the start it was clean.

I've learnt quite a lot about how to structure a game. I really should have focused a bit more on getting a decent state machine for the menu system.

I had to cut back my grand initial vision to something a bit more manageable. Here are a few things that didn't make the cut...

  • Penalties for over pressurising pipes and a visual indication of when you do so.
  • Rather than gauges I had wanted to see the steam in the pipes and thus see what the pressure was. This went pretty early on...
  • Levels. I initially wanted to do 50 or more, now there are only 20.
  • High scores. If you want to know what your best score is, you'll need a pencil and paper!

PyWeek has been a lot of fun, although I don't think I could have kept going for more than a week! I don't what I'll be doing when the next one rolls around, but hopefully I'll give it a go again.

Thanks to Rich, Neil, Jack and Tom - I think I fixed all the bugs you found and added all the suggested features. Cheers for the help guys!

Sat, Apr. 1st, 2006, 03:15 pm
PyWeek Day Six (in progress)

I've had quite a successful morning of programming, the game is now playable as a game and everything apparently works!

Consequently I've uploaded the current version so if people could download it and try it out that would be marvellous. Get it here. It only requires Python and PyGame.

The biggest missing element is the instructions, which I guess will make playing the game quite hard - but click some buttons and see what happens.

If you manage to crash the game please post the traceback message and say what you did!

Next job - write the instructions, then create a whole pile more levels.

Fri, Mar. 31st, 2006, 11:40 pm
PyWeek Day Five

So, the penultimate day of coding is finished. I'm not really where I'd want to be - it's still not in state where you can play it as a game.

Today's work consisted of drawing the remaining graphics, finalising the menu system and in game controls and completing the scoring system.

I'm going to get up fairly early tomorrow and hopefully begin coding around 10am. The contest is scheduled to end at 1am the following day so I should be able to get plenty done.

Tomorrow morning I'm going to finish the code for the remaining two game pieces. I'm also going to write the level intro/outro screens that will allow the game to be play properly.

In the afternoon I shall implement the high score table, write the in game instructions and design the twenty five to fifty levels I think I'll need. In the evening I shall test like there is no tomorrow. I'll also write the documentation, clean up the code, package it and submit!

Now I'm off for some much need sleep in preparation for tomorrow's coding marathon! It's just like being an undergraduate again with an assessment due :-)

Thu, Mar. 30th, 2006, 11:49 pm
PyWeek Day Four

As I predicted yesterday there wasn't nearly as much progress today as there has been in previous days. Still, the wasn't a complete loss and this is some stuff to report.

The biggest change is that the game now features a working menu system, and a state machine for moving between the menu, level intro, playing the level and the level outro. The menu is very simplistic and features no animation at all yet. If I get time I think I'll make the buttons highlight when you go over them.

Although the menu mentions high scores they still need adding. I intend to have an online top 100, but I'm not sure if I'll have time for that.

On the game side I changed the smoke colour to differentiate it from the steam. I also added a new piece for the player to use, a compressor. This works like a pump and forces steam from one area to another even if the pressure gradient is the reverse of that. The limiter only stops steam 'flowing' in the opposite direction, the compressor actually continues to move what steam there is on the lower pressure side to the high pressure side. I need to make the compressor cost points when you have it running and to allow the user to switch it on and off.

Tomorrow it is important I get the rest of the game pieces completed so I can concentrate on designing more levels, balancing the game out and generally giving it a polish on Saturday. I also need allow the user to adjust already placed items, and to blow them up. Finally I need to change the system such that when you have an incomplete network it vents steam out of the hole. Currently the pressure just builds up it acts as if the end is sealed.

I'm quite pleased with how easy it was to add a new game piece, I think I've done a good job of designing the structure of my program. I downloaded one of the other games today and all the code was in a single, huge file. Mine is split into 23 files, that biggest of which is just 120 lines long and I've used classes and inheritance to good effect. At one stage I even had multiple inheritance, but I've since removed that. Unfortunately the games are not judged at all on their code, I'm much more likely to the win a beautiful code contest than I am a beautiful graphics one :-)

Wed, Mar. 29th, 2006, 10:53 pm
PyWeek Day Three

Today saw my entry start to take shape as an actual game. I've got a definite list of jobs that need doing so now I just need to go through them one by one, tick them off, and I'll be done.


My first job was to replace the awful graphics I had for the boiler and the 'machine'. With those redrawn the board starts to look a bit nicer, but I think I'll need to replace the plain grey background before I submit.


I changed the gauges that measure the pressure in the pipes from a simple red bar to a proper pressure gauge which as well as tell you the pressure will also indicate the composition of the steam. I haven't yet implemented the board elements that will add the additives to the steam so this stays as 100% plain steam, but it should work fine.


Adding support for the different types of steam was the third time I'd rewritten the majority of the steam handling code. Perhaps not the most efficient way of doing things but at least it's nailed down now. I don't forsee having to doing anything other than tinker with if from now on.


When I changed the graphic for the boiler I added a chimney pipe. The obvious thing to do was to make it smoke. A quick 40 line particle system later and the boiler now smokes with the amount varying depending on how hard you're working the boiler. I also made the pressure release value steam when it is venting excess pressure. This definitely makes things look a bit more exciting and dynamic, but I'm a bit worried about how much it'll effect the framerate. It's a bit hard to tell at the moment as I'm compiling KDE 3.5.2 in the background...


Anyway, the smoke can be seen clearly in the following screenshot...



On the game front I implemented a level format in XML so the game will now load the levels and set up the board according to the level it's on. I just to get it to detect when you've won the level and move onto the next.


I've made the score system go up and down depending on how much you're using the boiler and how much steam you're getting to the machine at the correct pressure. It'll need some tinkering but currently you score around 9,000 points for completing level 1. This seems about right to me, but obviously I'll need to make this scale up as you work through the levels.


Tomorrows main tasks are to add the level introduction/ending screens and to finish adding the remaining pipe types. I don't think I'll get time to do any more than that as I've promised someone I'll go and play Badminton. Still, not including tomorrow I reckon I'll be able to put in another 15 or so hours which is enough time to achieve a fair bit... will it be enough though?

Tue, Mar. 28th, 2006, 11:39 pm
PyWeek Day Two

Today seemed to be a much slower day. It's probably because instead of writing code from scratch I was tinkering with existing code. That's always tougher for me to do.

I redesigned my pipe sections and in the process I switched from GIMP to KolorPaint which is a much simpler editor and more suited to my task. I've now drawn all the pipes I think I'll need for the final game. In my first post I mentioned I couldn't see how people could work in a team on a short challenge such as this, but I have to admit that having an artist would really help. My programmer art sucks and no matter how good my game is it'll look terrible :-(

Moving on from the looks, I made a few alterations to the game mechanics today. I decided to move away from the traditional Pipe Dreams method of forcing the user's hand when placing pipes by giving them only one pipe type at a time to choose from. I've decided that the user will have access to the whole range of options but each pipe will have a cost that will be deducted from their score if they use it.

Currently the user has the following pipe types to choose from:

  • Straight pipes: This is just a simple, straight pipe.
  • Corner pipes: These pipes let the steam turn a corner!
  • Thin pipes: This pipe is like the straight pipes, only they're thinner so the pressure in the pipe is increased. This forces the steam to move quicker but also the pressure changes are more extreme.
  • Reservoirs: These are fat sections of pipes that store a lot of steam. This reduces the pressure and evens out any pressure changes.
  • Pressure release valve: This section of pipe will start venting excess steam if the pressure gets too high. This value will become variable but is currently fixed.
  • One-way pipe: This pipe prevents steam from 'flowing' in the wrong direction if the pressure gradient changes.

I can already see how some of the pipes can be used in combination. For example a one-way pipe just before a reservoir means that the steam will keep flowing in the right direction even if the boiler gets shut off. Well, for a while longer at least :-) Also a pressure release valve placed just before the goal is handy in keeping pressure below the maximum as going above this will be heavily penalised. The pressure release valves will have to be expensive as this makes things a bit too easy, and running the boiler will cost you as well so running it too much and just venting the excess steam will lower your score.

There are still some other pipes types that need adding, such as an on/off value and crossing pipes. I also need to work on some splitter so the user can send steam in different directions. I'll need to start work tomorrow on the additives that the player will be required to pass the steam through before they'll score any points.

I still have a lot to do, and not much time left to do it in. I get the feeling that I'll be getting up early and spending the whole of Saturday working on bringing my game up to scratch. It's a shame that the competition didn't start 24 hours later - I wouldn't change my weekend away with my girlfriend for the world, but dang, having the whole of Sunday to work on the game would have been useful!

Mon, Mar. 27th, 2006, 11:49 pm
Day One work for PyWeek

I finally managed to get started on my entry. Work has progress pretty well in the four and a half hours I've managed to put in today.

So far you can pick up and drop pieces on to the game board. You can also start the boiler and increase the pressure of the steam. The steam flows through the pipes based on the pressure in each pipe. When the steam reaches the green box it is counted in a simple scoring system.

The graphs on each of the pipes indicates the current pressure in that pipe. Ideally I'll replace the graphs with actual blobs of steam, but I'm not sure if I'll have the time for that.

Balancing the physics of the flow of the steam could prove tricky. While I'm at work tomorrow I need to think about whether this really is the best way to simulate the flow of steam, and to think about the additional elements that I want, beyond pipes.

Overall, not a bad start.

Mon, Mar. 27th, 2006, 10:46 am
More than 24 hours behind already...

I spent the weekend in London which meant that I've only just found out the theme for the challenge. I'm now at work and it'll be at least 6 more hours before I can get home to start work on an entry to PyWeek. :-(

Fortunately the chosen theme was by far my favourite option so I've already got a well thought out plan for the game which should give me a good start.

My tactic seems to be quite different to most people - I'm going for a simple game. It's only 2d (a recreation of a classic game but with a twist) and no AI or other hard stuff to code. I'm hoping that the extra polish I'll be able to give my game will give me the edge over these fancy-pants 3D, multi-person team games.

I couldn't imagine trying to work in a team with people I've never worked with before, over the Internet, and under such a strict time constraint. Still, if that's the way people want to work then good luck to them! I'm happy by myself :-)

Targets for today:

  • Write design document.
  • Create initial graphics.
  • Get game framework running.
Available time: 5 hours.

Tue, Feb. 28th, 2006, 04:58 pm
Hello, world!

It's not often you have to write 1232 lines of code in order to print "Hello World!", but now my Python-based interpreter for the YHC bytecode can display those famous programming words...

Wed, Feb. 15th, 2006, 12:14 pm
Server troubles

I pay to rent a virtual server from Linode.com to host a couple of websites. The main website is, of course, my IndieGigs.co.uk gig listings website1. Secondary to that I have also written a GreaseMonkey script which displays chart changes on Last.fm. As part of the script I store copies of previous charts for each user of Last.fm and this generates around 15,000 hits a day. The script has been growing more popular over time and it had got to the stage where the load from my script that worked out what chart to return to the user was crashing the server. Clearly this was no good as it rendered my main site unusable. I tried a few band-aid solutions, including caching the correct filename in a memcache server, but nothing seemed to make much of a difference. In the end my script was regularly listing all 115,000 file that were stored in a single directory and this was just too much for it cope with.

Yesterday I rewrote the script to store the charts in a MySQL database. The difference is amazing, the server now uses less memory and everything is running silky smooth... at least for the moment.

1 This is going pretty well, and I'm getting a nice stream of emails from various up and coming bands asking me to list gigs for them.

Tue, Jan. 24th, 2006, 01:16 pm
OpenGL Woes

Today I was demonstrating for CGV and one person had a very strange problem; they couldn't get the colour of text drawn by glutBitmapCharacter to change. It turns out the colour is not set by glColor, it's instead set by the GL_CURRENT_RASTER_COLOR parameter. And how do you set this parameter? By calling glRasterPos which as a side effect takes the current colour set by glColor.

Ummm, intuitive...

Mon, Jul. 11th, 2005, 03:29 pm
Success!

The Python and C++ libraries that I have been writing as part of my PhD work have now reached a stage such that you can send typed values Python -> Python, Python -> C++, C++ -> Python and C++ -> C++. My current test case have a Python dictionary being converted to a std::map. Now I could give a list of caveats as long as much arm, much it sounds much more impressive if I don't :-)

Sun, Jul. 10th, 2005, 02:44 pm
PyLinda

Today I released the fifth version of my python-based distributed computing system - PyLinda. Major changes in this version (0.5) include the ability to tunnel connections between servers over ssh and a command line interface to the server.

This post is mostly for the benefit of Google.

Tue, Jun. 21st, 2005, 02:14 pm
Software Packaging

I've just discovered that PyVault, a provider of RPM packages for Python software, has an RPM for some software that I have written (PyLinda). This is great and I'm very happy to see my software spread around on the internet. What does bug me slightly is the fact that they have gone to the trouble of patching my install script to remove the documentation and examples! That makes it practically useless for someone who doesn't already know what they're doing...

Wed, May. 11th, 2005, 07:50 pm
CGV

For those that enjoy these sorts of things the new CGV assessment was released today. You can download the paper here.

It seems fairly straight forward until you get the bit where it says "5-10 plants should grow around the capsule". Plants? It doesn't even give any hints on what they should look like! I'm glad this one wasn't the one I had to do.

Thu, Feb. 17th, 2005, 11:42 pm
The difference between C and C++...

I mostly code in C++, so when I come to do some C I get all confused. Why doesn't the following compile as C code, but does as C++. It complains about the '=', but C supports default arguments doesn't it?
int inc(int a, int b=1);

int inc(int a, int b) {
    return a + b;
}

Fri, Jan. 14th, 2005, 03:12 pm
Supervisor

I've just had my first meeting with my supervisor for three months, and surprisingly it only took an hour. However I have a huge bucket load of work to be doing now though!

On a semi-related note I got two bug-fix patches to my PyLinda software from a guy in Brazil. He also tried to rewrite some of my functions in an iterative style instead of the recursive way that I've done it. Being the evil package maintainer that I am I've accepted his bug fixes but rejected his other changes. Mwhahaha!

Mon, Jun. 7th, 2004, 10:24 am
This is so true...

Sat, Jun. 5th, 2004, 09:29 pm
Random programming

For no reason, other than I was wondering if I could access the Rhythmbox media library I've created a program to put a chart of my most listened to songs of all time (well, since a month or so ago...) on my webspace, updated daily.

If you're feeling bored you can find it here.

Starting next Saturday it'll even show changes in positions from a week before!

Very soon The Killers will be making an appearance as I got their album this morning, it's brilliant!

20 most recent