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

Re: [pygame] 3D SHMUP



Ian Mallett wrote:
An object's position is rounded off to the nearest
point, and the point's height is compared with the object's height.
>
Is there a fast way to do it, without using an outdated module?

If you're just accessing a single element of the array, there
shouldn't be any speed problems with any version of Numeric
or numpy. The speed will be limited by the surrounding Python
code that decides what element to look at. What you use for
the array will hardly make a difference at all -- even a
pure Python list of lists would be just about as fast.

The speed issues with Numeric/numpy only come into play when
you're doing operations on whole arrays, such as adding all
the corresponding elements of two arrays together. If you
have a lot of objects to test against the terrain, it's
likely you could find some way of using Numeric or numpy
to test them all in one go. Done correctly, it would be
*much* faster than looping over all the objects in Python.
The speed difference between Numeric and numpy would be
tiny by comparison.

--
Greg