Sweet Sweet Progress

June 13, 2011

Splendid progress going on. Quick post as to not break my workflow. Collisions are now finished. The handlers were pretty easy to set up since Chipmunk takes care of a lot of stuff for you. I extended the shape class to simply have an extra “life” float that I can deduct from and when it reaches 0, the planet is destroyed. Later I could even do cool stuff like calculate damage based on the force exerted in contact. For now each shot or contact with another planet deducts a set amount of life so each planet can take about three hits. The hardest part was figuring out how to clean out all three parts of each planetoid: the sprite, body and shape. My subclass Planetoid worked great since I wrote my own dealloc method that took care of everything for me on every call (however for collisions I had to do it manually since they only return the shape. Note to self for future reference, shapes store their related object and sprite mainly negating the benefit of Planetoid).

I’m now working on level generation using a .plist since it seems the simplest to implement. Its a small XML based text file bundled with the app and in it I’m storing two arrays: “High Scores” and “Levels.” “Levels” contains sub-arrays filled with yet further sub-arrays of planets and their properties. And “High Scores” contains, you guessed it, the high scores feature which I am as of yet to implement. However, I’m already calculating the total number of shots fired and the number of planets is evident. I’ll probably work out some sort of scoring function as a product of the two variables. I think I good scoring function is as follows (where ‘n’ is the number of planets in the level and ‘m’ is the number of shots fired over the course).

  • 100% : m <= n + 2
  • 0% : m > 3n

I think its safe to assume that on most levels, if you do it right, you should be able to get all planets down in about one shot per planet give or take two shots. Likewise if you hit each planet three times to destroy it that’s the worst solution. One edge case scenario I haven’t yet considered is what happens if a planet gets knocked into a high or highly eccentric orbit such that it’s never on screen? I assume this should count as a planet destroyed but its a hard edge-case to check for.

I’ve had some drawing issues since I’m currently drawing the bullet path using OpenGL directly. I’d like to be able to have this path be low opacity but changing the alpha blending function then messes with the sprite 2D texturing causing them to become boxes. For now I’m going to try adjusting the colors to look like they’re blending or I might try spawning sprites instead of drawing, however I feel like that would be way to costly.

Gameplay-wise I’ve been thinking I’ll shift the entire puzzle part over and away from the firing spot to make it a bit more challenging. Plus I think a neat future ability would be to warp to the other side of the solar system for left/right handed people or to get a well aligned shot off. Now that I’m coming to the end, at least for now, of the game mechanic implementation I’d like to enumerate some future features that probably won’t make it into my turned in version:

  1. Multiple weapons (laser, shotgun, explosives, etc.)
  2. Control over scene view (magnification, panning, etc.)
  3. Shrapnel on planet destruction (not in Sun)
  4. Dynamic damage based on impact strength and other forces (bullet speed -> using gravity to increase damage!)
  5. Game Center High Scores
  6. Animated sprites (explosions, sun flares, meteors, etc.)

I’m still hoping I’ll have enough time to add some basic sounds and such. It really depends on how long the asset creation and then implementation takes. I really want to do some basic sprite animation using the cocos2 actions which are a breeze but will take a good chunk of time. Plus I still need to code in the whole post-level score screen dialogue and a tutorial of some description. Once I have my .plist integration working I’m going to try getting in on the device and seeing how smoothly it runs before getting into further level and asset creation. If only I’d worked this hard the entire time!!! Thank god I didn’t try and finish during the year however, would’ve been a nightmare.

PS: I hope Joe or Norm is reading this. I’m moving to NYC on the 17th but my apartment doesn’t have internet set up so it’ll be at least a few days before I can start really working again which is why I want to be more or less done by then. I’m hoping to have internet there by the end of that following week but between that, setting up in a new place and my independent credit (god help me) I’m not sure what will happen. My hope is to at least get it into a few friends hands and get some feedback/questionnaires out for the data portion of the project. I’m mainly worried about the independent credit since I really need to do it on my PC and without internet I’m afraid of the intractable problems I might run into. Wish me luck!

One Response to Sweet Sweet Progress

  1. Krupen says:

    Good luck! You can do it… you’re so close to the end!

Leave a Reply

Your email address will not be published. Required fields are marked *