Saturday, November 29, 2008

Weekend SVN Logblog (Nov. 29, 2008)

Back from a bit of a hiatus from regular updates. I wrapped up Strange Visit last week and got around to finishing some engine tasks that had been on my plate since October, then took a break from all things develop-y for the week of Thanksgiving. Let's see what I was up to before that...

------------------------------------------------------------------------
r954 | Administrator | 2008-11-17 22:20:42 -0800 (Mon, 17 Nov 2008) | 1 line

Refactored a bit more to commit to a real breadth-first sector traversal. Has same known issues but I feel better about it.
------------------------------------------------------------------------
r953 | Administrator | 2008-11-17 21:58:47 -0800 (Mon, 17 Nov 2008) | 1 line

Changed portaling a bit to build a list of all visible sectors from a sector before rendering them. Now it's a weird cross between depth-first and breadth-first that I'm not quite happy with, but that fixes the bug I found tonight.


Just before finalizing Strange Visit (or actually, while I was playing the first release candidate, I think), I found noticed some weird behavior when looking through certain portals. I stepped into the code and realized that my fix for endless portal recursion from a few weeks ago was now causing some sectors to never be rendered. I started experimenting with ways to fix it and ultimately wound up changing a recursive algorithm to an iterative one (which effectively changes it from a depth-first traversal of the visible portals to a breadth-first traversal--it's all computer science class up ins!). There's still a known issue that could occur in a very contrived case, but I can design around that.

------------------------------------------------------------------------
r957 | Administrator | 2008-11-19 22:58:51 -0800 (Wed, 19 Nov 2008) | 1 line

Added support for attaching ConcreteEntities to each other.
------------------------------------------------------------------------
r956 | Administrator | 2008-11-18 21:13:00 -0800 (Tue, 18 Nov 2008) | 1 line

Added composite collision for doing higher detailed traces and getting region information from entities.


These are two tasks that I'd been thinking about since before starting Strange Visit, and I had been eagerly awaiting the end of that project so I could finally write these. Attachments isn't something I intend to use a whole lot, but there are occasions where it's very useful (like attaching a particle emitter to an object on fire). I had been procrastinating on the implementation for a while because I was concerned about edge cases related to the collision on attached objects, but there ended up being fewer of those cases to deal with than I expected. Given that I have only a couple of expected uses for attachments, it should be fine.

The other task listed there was composite collision bounds for high detail objects. Because they work decently in many cases and because I don't want to introduce another order of complexity by using various kinds of collision geometry, almost every game object in my engine uses ellipsoids for its collision proxy. This works fine for low-detail objects--it doesn't really matter to me if a bottle on a table doesn't have pixel perfect collision. It does matter if the enemy character I'm shooting at doesn't get hit when my reticle was clearly on him. Most modern games solve this problem by using a collision proxy mesh built from connected rigid bodies (oriented bounding boxes) like an artist's mannequin. I prefer to do the Simplest Thing That Could Possibly Work (it's #1 on the list of five core values I defined almost two years ago), or in less lazy terms, find the solution that gives the best return on investment. For the kind of fast-paced shooter I'm making, I don't need that much precision, and it's a lot more work to do. So I settled on simply making a small list of composite ellipsoids centered about the Z-axis. My basic human shape uses a sphere for the torso, a slimmer ellipsoid for the legs, and a small one on top for the head. Pixel-perfect it is not, but it gives me more control than a single shape, lets me use named regions for damage adjustment (like high-valued headshots), and best of all, took about 30 minutes to implement fully. I think I've spent longer writing about it here than it actually took to code. That's a win in my book.

0 Comments:

Post a Comment

<< Home