Thursday, December 9, 2010

Asteroids and SAT

Well, it's been about a week since I last posted something so I wanted to get a new entry out to let people know I'm still actively working on the engine.  As those who follow my posts may know, I've been working on getting a real narrow-phase collision system into The Render Engine for a while now.  Tutorial 11, in v2.0, is a simple example of using SAT.  However, I wanted to really push the extreme and get a good test for the new SAT convex collider, collision hulls, and fix up a lot of part of the engine.  This stuff is all new, but it's finally to a point where I can show it off:

Asteroids with SAT

The full game isn't working, there are bugs, but at least the attract screen is showing promise.  All of the asteroids are using the convex collider component and collision hulls.  The link above has debug mode enabled so you can see the debug helpers in action as well.  You can see the blue outline of the convex hulls (which are automatically calculated from points of the shape).  It doesn't run super fast, but removing the "?debug=true" from the link will run it without the helpers and provide a speed increase.  This runs fastest in Chrome and Firefox 4, at the moment.  Also, you should know that asteroids don't start checking collisions until they've been "alive" for at least two seconds (it's not a bug).

What this also points out is that I need to get the work that I've been doing with dirty rectangles working.  The framerate is dependent on how quickly a browser can redraw the entire frame, which isn't the best way to do things.  I should be able to push a lot more collisions on that screen, but at the moment it's shaky.  Additionally, the particles are really slowing things down because there are so many of them.  This is just a good point when it comes to using all of the effects in the engine - don't do it unless you're okay with a low framerate.  The Asteroids Evolved demo is intended to be a demo, not an example of a full game... Maybe in the future it will run a lot better and I can polish into a real game, but for now it's a tech demo and nothing more.

No comments:

Post a Comment