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

Re: [pygame] 3D SHMUP



On 9/17/07, Ethan Glasser-Camp <glasse@xxxxxxxxxx> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ian Mallett wrote:
> I've recently been concerned that this will be
> painfully slow.  Is there a fast way to do it, without using an
> outdated module?

Hi,

I wrote a 2d collision detection engine for a game I was working on.
It was based around a geometric approach (i.e.: there's a rectangle
here, a circle here, etc., as opposed to a voxel-based engine, which
seems more like what you're doing). It was too slow, so I rewrote it
using some weird Numeric tricks. It's in the Pygame wiki but I sort of
regret putting it there -- it's incomplete and still pretty slow. If I
knew how to delete pages from the wiki I would do that. :)

On the Cookbook there's "SmallerRectForSpriteCollision"?  It seems pretty simple (not that that's a bad thing).  It doesn't seem to be the right sort of collision detection though...  In the PyOpenGL game I'm planning on using my method for, you're an airplane, flying over a complex 3D landscape.  each tiny section of the landscape has a height, stored in a 2D array.  If the airplane's height is less then the landscape's height at the appropriate point, KABOOM, or "Houston, we have landed.".  I've had so many issues with getting certain payloads on the airplane to function, however, that I've given up the project for the time being.  Anyway, my Map Editor program needs to be fixed first. 

Writing a collision detection engine is hard to get fast and hard to
get right. I won't say it's no fun, but if you're interested in
writing a game which needs a collision detection engine, I recommend
ODE with the PyODE bindings. If you're interested in writing a
collision engine, Python probably isn't the language of choice.

But I love Python...
I do collision detection on a program-by-program basis.  Writing a comprehensive engine seems overkill in most cases, and hard to make.  Like you said, there's PyOde, which I haven't tried.

Ethan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG7z68hRlgoLPrRPwRAhEQAKCKnTeeKlIiIGv1qp0Wxnru/DpWsACfV9Ay
x5eWxcDf5ciQn+WR8aih3a8=
=RXF9
-----END PGP SIGNATURE-----

Ian