Followers

Saturday, December 3, 2011

Week 6

Sot his week we worked pretty hard on damages, reading levels from an XML file, and getting the assets working properly in the renderer.

For damages we found out we could utilize an OnContactListener class to find when the ball has contacted the objects and we take the mass of the object multiply it by the velocity the ball projected it at and we get the kinetic energy transferred, at least that's the rough idea behind the physics of destruction. It also won't be hard to implement a texture swap as the object takes more and more damage and that should be ready to go for the alpha.

Reading XML files was interesting, I believe I did it a long time ago in C# but I couldn't remember ANYTHING about it. It took a while but I found a simple way of reading and parsing it and that's all I really needed. I also implemented a singleton that holds all the level information from the XML file so that it can be read by the physics handler (and then passed off to the renderer) but also the gameLoop will be able to get the number of balls left and adjust them and it'll be easier that way to tell when a level is done, and since there's only one level at a time a singleton is pretty sweet, I just made sure to include a load function that loads a new xml file into the level singleton.

Getting the assets to work properly was a HUGE pain since the axis are different in MAX than in OpenGL and so it was a lot of guess and check. Also I found out that the origin for Box2D is the center of the object. If the model wasn't put exactly there it would be rotating around a different point causing problems. In the end everything is working out to be pretty cool. Here is an example I made using the assets and the xml file:


Looking towards the future, we really need to buckle down and get gameplay taken care of. With damage out of the way, that's one significant part down, but we also need to be able to launch balls at the structures and have win/loss conditions. I think we're working at a pretty good pace though. I believe we should end up with a very polished game at the end of the 16 weeks.