Sponsored By

Newsletter #77 - Destroying Aliens

Third SHMUP demo, forum account registration reopened, making destroying aliens fun, orientation interpolation, sketches, and community video.

Michael Grand, Blogger

March 4, 2011

4 Min Read




News

The third demo of our test project (a vertical scrolling SHMUP) has been released.  For details, click here.

Forum account registration has been reopened.
http://www.ifthensoftware.net/forums/index.php?showtopic=2201


From the Programmer
Written by Invisible

We have postponed the heightmap tool which I discussed in the previous newsletter issue.  This is good news for me, since I can work on the fun stuff (destroying alien ships) and I don't need to worry about the problems with the tool yet.  Our artist doesn't need to work on backgrounds right now, so this shouldn't hurt that side of development.

So yes, I worked on making it so that you can destroy alien ships.  I personally think that it turned out quite nicely, and have been found to sit and constantly kill aliens just for the fun of it.  Feedback is part of the reason why they are fun to kill.  When your projectiles hit the alien, it jerks back from the impact and the projectile seems to encounter the alien and explosively disperse into and around it.  When the alien reaches about 30% of its health, there is an explosion inside of it which causes visible damage.  And there is a final explosion when the alien is destroyed.  More can be done of course, most notably the addition of sound effects, but it works well so far.

I ran into a couple problems while making it possible to destroy alien ships.  The first one I remember involved a lot of debugging and turned out to be a somewhat embarrassing oversight.  Your ship's projectiles would appear inside of the alien ship for an instant before colliding with it.  The alien's collision area is large enough to prevent this kind of problem, so that wasn't the issue.  The next thing I investigated was the depth of the projectile with respect to the alien ship; maybe Direct3D was translating it a bit further than I was expecting due to depth?  This was an issue with other things, but it apparently wasn't causing the present problem since the projectiles were given the same exact depth as the aliens and they still penetrated too far.  I eventually thought to check if collision detection was being performed after movement, and found that it wasn't.  Because of this, the projectile was allowed to penetrate the alien ship for a single state (one or two frames) before it was finally detected and removed.

The other issue wasn't a bug, but it was a task I hate dealing with: orientation interpolation.  States are interpolated by the renderer in order to ensure that there is no "jitter".  The "jitter" is caused by an accumulated extra amount of time when updating at a fixed time-step; you eventually create multiple frames at once, and the screen appears to "jit" because of this.  Interpolation is easy, but you run into trouble when you try and do it with Euler angles.  One of the issues is that you could spin around multiple times before reaching what it thinks is the correct destination angle.  Another issue is that the interpolation code may interpolate in the wrong direction.  Fortunately, 3D Math Primer for Graphics and Game Development has a section dealing with this issue, 10.3.4 page 156 which describes a solution.  I recommend reading that section for a proper description, but it boils down to limiting the angles to within 360 degrees (-180 to 180 is what the book uses) and calculating which direction is the shortest path to the destination angle and using that to interpolate.

I am currently tackling the problem of how to control the alien ships.  One idea involves springs, and the other involves a destination position and AI which directs the alien towards that point.  I might discuss this in more detail in the next issue, by which point I should have this solved.


Artist's Easel
Drawn by GreyKnight

iScribble Sketches #35

(Click to enlarge)


(Click to enlarge)



Community Spotlight
Written by jaythemage

Jay has once again made a video featuring the latest demo of Ifthen Software's SHMUP.


If you have anything you would like to say in the next community spotlight article, please post it here.

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like