13 April 2006

I'm so easily distracted (new benchmarks)

I was supposed to finish the collision and action systems tonight... And what do I do? I just had to implement a feature that wasn't even in my original list of features for the framework: dynamic lighting. So, now you'll be able to create light sources, and they can move and smoothly alter their color/brightness (via Actions of course).



Here are some benchmarks with moving Sprites (using simple newtonian physics) and dynamic light sources.

sprites: 1000 3000 10000
------------------------------------
10 lights 85fps 85fps ~35fps
30 lights 85fps ~59fps ~18fps
100 lights ~64fps ~21fps ~6fps

As you can see, there's still some room for optimization, but implementing different levels of lighting detail should help a bit in situations typical to games. Currently, each light source affects every corner of every sprite, so that's four calculations for every sprite for every light source. Small sprites don't really need this, so they can be optimized by calculating a single light value for the center of the sprite and using it for the whole image.

On the other hand, having 100+ dynamic light sources might not be the most typical scenario...

02 April 2006

PyWeek Finished

I finally got a good night's sleep last night, but I'm still exhausted. The whole Saturday was nothing but coding and play testing. There is still a lot of room for improvement and we didn't have time to add sounds and music this time, but I'm overally quite happy with what we came up with in a week, considering we only had time to work on the entry during evenings.

If you want to try our game (titled "Steam Run"), you can download the Windows installer here, or the Python source code here (requires Python 2.4, Pygame and PyOpenGL).