[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] C/C++ and Python



On Sat, Apr 18, 2009 at 11:55 AM, Zack Schilling <zack.schilling@xxxxxxxxx> wrote:
I use Numpy to control particles drawn with OpenGL. Since PyOpenGL can take a Numpy array of coordinates and render it as shapes or points, all the actual work is done outside Python. I can make bursts or streams of thousands and thousands of particles, each with its own position, color, lifespan, velocity, and acceleration, then render the effect inside of a  game running at 60 FPS without a problem.

-Zack
In addition to using libraries that are written in C, you can take advantage of other parts of the computer to process code faster.  For particles, I personally use the GPU, which can easily render over a million particles at a decent clip.  You might be able to get increased speed by using multiple threads, though I have my doubts.  I think the best solution is to write good code in the first place and leave the rest.