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

[pygame] raycasting engine performances (numpy array)



Hi.

I have recently started to write a ray casting engine with Pygame and i'm at the very early stage of the engine but i already have performance issues. I use the surfarray module to do all the drawing (actually, i only want to draw lines) but i have issues about performances. When i come closer to a wall (when the lines i draw become bigger), it starts to be a bit laggy. So i think it's all about the draw_verline function that just iters vertically in the array and set the pixels, i dunno if i can do more "optimized" as a drawing line function...
Here is the code so far : http://pastebin.com/GzZ3dEu8

If i totally remove the surfarray implementation i go with simple surfaces and using the draw.line function, is super fluent and there is no lag even if the line are big. But i can't stuck with drawing line this way because it will cause problems when i will try to implement textured walls.

If anyone has an idea. Thanks in advance : )