Adventures in growing ... and cython

So today I avoided the issue of gameplay by experimenting more with how the path appears on screen to the player ... how it grows.

I now have a rather pleasing (in my opinion) growth animation for the path and the branches off the path.

Try it out if you like: stalk-4.zip 

(marked as a final upload just in case I don't get a chance to make another)


I ran into a problem where enough branches being grown drops the frame from a steady 60FPS to around 30FPS (on my MacBook). Not so pleasing.


I've optimised a few things with cython. The result is that I can now happily re-generate the path curves and vertices every frame and the FPS doesn't dip below 60.

Neat.

Along with my own curve code I've implemented cython versions of the euclid module's Vector2 and Matrix3 (since my curve code uses those implementations for parameters and determining normals and the like).

richard on 2010/04/02 11:57 of To-to-ro


Comments: (log in to comment)

I might try optimising my Vec2 class with Cython since everyone's now doing it.
I cannot control anything !
Is it a game ????
really looking forward to learning from this code at some point, thanks richard!
No, it's not a game yet. You can control movement along the path a little, that's all.
soon after starting to move, it crashes:

......

  File "...\gamelib\tree.py", line 417, in update
    p.update(dt)
  File "...\gamelib\tree.py", line 315, in fade_out
    self.vertex_list1.colors[3:len(l)*4:4] = l
TypeError: sequence index must be integer, not 'slice'

I run python 2.5, without cython
It works for me when I disable the cython bits.

Hmm, maybe a Python 2.6 thing (perhaps a bug fixed in ctypes)?

I'll recommend that players have Python 2.6