Monday, October 22, 2007

DS Homebrew

Using the PAlib I have begun work on two medium sized game projects. One was developed for a semester project with two other people, Mike Daly and Rick Naik. The other is not in active development yet. There are several, and will be many more DS homebrews cooked up as time passes, since this medium is versatile and quick to develop for.

Physics Simulation




The first project is to be a 2D physics simulation using primitive shapes, player drawn shapes and sprite objects. It will allow the player to draw primitives (circles, rectangles, and triangles) and place sprite based objects then run the physics simulation to play out endless scenarios. It is somewhat similar to games such as The Incredible Machine, but with the ability to draw your own objects and toy with more realistic physics. The source and build of this can be found here. These can be run using an emulator such as No$GBA, or hardware such as a SuperCard.

To accomplish this, I researched game physics (as it has been several years since I took physics as a class, and cannot effectively read my notes any more) and sorted through 3D implementations to work out how to accomplish the same ideas in 2D. I ended up using some simple velocity calculations from the impact vector (splitting into direct and tangential impacts) and then just cheating for rotation (no rotational inertia). For the collision detection, I am simply using circles to test if there may be a collision, then brutishly checking if any vertex of one shape is inside the other. This is straighforward, as each shape is convex. I'm taking the dot product of each edge on shape A, and testing it against each vertex on shape B, so if any of these values is negative, the shapes are not colliding. This way, a collision is our worst case scenario, which may or may not be the best method, it just seemed simple enough to get me going.



Pirate RPG

Although little progress has been made with this project, there are some interesting plans for it. So far, I have an 8 direction ship sprite sheet, a test tiled map, and a stern image for steering hooked into a simple moving ship thing. So, basically right now you can move the ship, while using the stylus to steer on the bottom screen, and run into the land (basic tile checking for wall detection). Nothing fancy, yet.



Small projects





Just for fun, I wrote an obj parser to render 3D models on the DS using openGL calls. As you may notice, the default shaders are not available through the libraries, so I just made up some crappy colorization to differentiate the geometry. If I hadn't lost the code for this, I would chock up some lambertian or phong, but it was lost in some HD changes. Maybe I'll get around to rewriting it and adding these things.


No comments: