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

Re: [pygame] raycasting engine performances (numpy array)



Nathan Biagini wrote:
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...

Anything that loops over pixels individually in Python is
never going to be fast.

You could try using one of the scaling functions in
pygame.transform to draw a vertical slice of the texture all
at once. But it's still not going to be blazingly fast.

What's the purpose of this? If it's an exercise in learning
how to do raycasting, that's fine. But if you're just trying
to make a 3D game, OpenGL would be a better way to go in the
long run. Traditional Doom-style raycasting is really an
obsolete technique -- modern 3D hardware can do texture
mapping and hidden surface removal much more efficiently than
anything you could implement on the CPU.

--
Greg