On Mon, 29 Nov 1999, Andrew Wilson wrote:
> > Remember, don't bother with checking a bounding box first. If there is
> >enough CPU to do a full collision detect sometimes, then there is enough
> >CPU to do it every time :-) Unless you have a way to steal CPU cycles from
> >somewhere else when you need them.
>
> Gotta disagree here - a frame rate skip for the fraction of a second
> when a bullet is right near your ship is much more desirable than a constant
> framerate skip. Most of the time, if the bullet is that close, it's gonna hit
> you anyway, and the hiccup won't even be noticed.
>
> If you *can* get the CPU to do full collision detection, more power to
> you. But it's a pretty standard game programming practice to use bounding
> boxes to eliminate collision checks wherever possible, to improve framerate.
Perhaps you could sacrifice accuracy rather than framerate in the worst-case
situation (eg, all the asteriods and shots are in the same 2" of the
screen). Simply keep a counter for the number of full collisions you have
run that frame. If it gets to some arbitrary constant (say, 10) then simply
skip the full collision routine and use the bounding box as the final word.
You lose accuracy, but if things are so crazy that you're doing that many
full checks then it may not matter. You will probably want to make an
exception for the player ship - full collision should probably always be
done for it. (Or you could just check it against everything else *first*,
and then worry about shots and asteriods hitting each other, with the option
to skip over the last few if cycles are running low.)
Adam
Received on Mon Nov 29 14:50:03 1999
This archive was generated by hypermail 2.1.8 : Fri Aug 01 2003 - 00:32:31 EDT