Re: [Super-tux-devel] Gameloop Rewrite Status
Brought to you by:
wkendrick
From: Bill K. <nb...@so...> - 2004-01-02 21:04:38
|
On Fri, Jan 02, 2004 at 06:04:51PM -0500, Tobias Gl=E4=DFer wrote: >=20 > One possibility is to check if the "rectangle" of an object hits the > "rectangle" of another object, like we currently do, but I don't like > this method, because it isn't very precise. On the other hand it's > relativly fast. I almost always stick to 'bounding box' (what you described above) because it's fast, simple to program, and for most fast action games it's "close enough." The trick is to give the player a slight advantage. (e.g., their bullet can hit just outside the enemy's x,y/w,h range, but the enemy's bullet actually has to be a little INSIDE the player's rectangle, otherwise it's ignored) Super Tux is a fast action game, but can go slowly (e.g., the player can walk around a little to try to make a precise hit, or just be standing there when a bad guy aimlessly bumps into Tux), so it MIGHT be worth doing more precise collision detection. I think, though, that so far the bounding box method has done well in Super Tux, so I would much rather we worry about adding gameplay elements (more enemies, more kinds of objects to deal with, and more levels and level art). If we REALLY need to fix the mechanics, we can do it later. :^) The biggest complaint in the 3 years since I first released Super Tux was that there was only one level and few enemies. :^) Not that Tux didn't collide with laptops 'precisely' ;^) -bill! PS - FYI, I recently had to do line-intersection for collision detection = for a vector-drawn game I'm prototyping for my new job... :^) I first do bounding-box to decide whether I need to BOTHER with the slow line-related math, of course. Keep this trick in mind!! |