[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Re : [pygame] raycasting engine performances (numpy array)
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Re : [pygame] raycasting engine performances (numpy array)
- From: "nathan.open@xxxxxxxxx" <nathan.open@xxxxxxxxx>
- Date: Fri, 27 Apr 2012 10:41:32 +0200
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 27 Apr 2012 04:41:46 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:to:from:subject:date:mime-version:content-type; bh=YZIMuL8k5Ivd6e1A/BPe3ELI2aBRbDWREGx79P6V1mU=; b=Ey7uWXbjivmCEmIZL4RHyu9j4MTLf9YhqwLqO3381ZORE507LgUwOmNTTab1AJ0QRD U/MMoh3d3pcMZp+3UVmRgwvSP6Lspkb6l8/VPNoGLuZiiannFWnhibvbRHt9LXgPGhvz 2URNN5omDn2GUrEUeiJPFK7BqKAitS6SF/01tSgLmKhTPGQzlkK7gZw8+FYVW1YOJ1FW 9tDYqSrQ1sIWudwHHQZ/he6f3DyZ0znZSMYHZNQ4jedt01j7k1A7WzNpKN8ZN9P3/gcy aO6Rm8chhB4rQddFIb4KiFUfA6l9+WwSeIXA5JPbzWtWMo38GUB9WPqNJ8G6kTbQUgje nrKg==
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
In fact it s not for professional stuff or whatever but i am à huuuuge fan of python and of old school techniques such as raycasting. I have already wrote a wolfenstein clone in c using le libx. Textures and some.effects were implemented without any lag ( i can give the code if anyone is interested). So now i'd like to write à more advanced wolf/doom like using an OO approach. So i though Python of course cause it's soon sexy blablabla but maybe not adapted.
So now my question is, can i write the game logic entirely in python and write the rendering part in C with OpenGL calls?
Thank you in advance!
----- Reply message -----
De : "Weeble" <clockworksaint@xxxxxxxxx>
PourÂ: <pygame-users@xxxxxxxx>
Objet : [pygame] raycasting engine performances (numpy array)
Date : ven., avr. 27, 2012 08:36
On Thu, Apr 26, 2012 at 1:49 PM, Nathan Biagini <nathan.open@xxxxxxxxx> wrote:
> i dunno if i can do more "optimized" as a drawing line function...
I see a moderate speed-up when replacing:
asf[x][y] = 255
with:
asf[x,y] = 255
Which avoids doing two layers of Python indexing for each pixel.
Still, it doesn't make it fast enough to be smooth. I see a much
bigger speed-up if I replace that loop with:
asf[x,start:end] = 255
This shifts the whole loop into C code with no Python interpreter to
slow it down. The only problem is figuring out how to express the
texturing as something numpy can do do efficiently. I think it may
well be possible, but I'm not enough of a numpy expert to know off the
top of my head.
I totally agree with Greg: only do this if it's for your own education
and amusement. Raycasting on the CPU is always going to be way slower
than a GPU can do, even if you can get the Python interpreter out of
all the slow bits (whether that's by way of numpy, PyPy or just plain
writing some C).