Saturday, May 7, 2011

Mid-day update!

*LONG POST WARNING*
When I update this sucker mid-day it means two things:
a) I got stuff done
b) I'm putting off other stuff for the sake of writing this thing!
Funny thing is, I'm putting off writing a paper, by writing a blog.
David and I actually got a lot done this morning, both in terms of theory and practice.  Maybe not a whole lot in practice, but definitely a lot in theory.

In practice we got an new gameplay mechanism implemented with a new image (ooh, right? one new image!) and we saved ourselves oodles of processing power by "recycling" our bullets and our explosion effects which keeps new memory from constantly being allocated and saves us processing power on calls to the Garbage Collector.  Huzzah!  The game gets more-and-more mobile friendly!

Rock out with your... wait...
So even though none of you really want to hear how we did it, I'm going to tell you anyways.  Fundamentally the process is very simple and I'm not sure why we didn't think of it before, but for our bullet and explosion managers we simply set up two lists: A list of "live" bullets and explosions, and a list of "dead" bullets and explosions.  Those objects in the "live" lists are drawn, updated, and check for collisions within their respective managers (which, for whoever might be a coder among you, is it's own singular object) and those in the "dead" list are not, but instead are kept on standby.  When a new bullet or explosion is created the managers first check to see if there are any objects (bullets or explosions) in the standby list.  If there are, then the managers simply re-set the values of the standby bullet/explosion to act as if the object is "new" and re-position it.  If there aren't any in the dead-list, however, then a new object is created and added to the "live" list.

Whenever a "live" bullet/explosion reaches the end of it's lifetime (if it has reached the end of it's animation, or if it is out of the bounds of the game screen) instead of being destroyed by an apparently processor-heavy Garbage Collector call (which would free up some memory) the object is simply handed over to the "dead" list to await its recycling.
Alternatively: TA-DAAAA
Using the Garbage Collection method we would theoretically have more memory to work with when, say, there are no bullets on the screen as opposed to when the bullets are flying all over the place.  But forcing the Garbage Collector to work does kill one's processor, as we've figured out, and under the current scheme we have a grand total of only 15 bullets and 7 explosions (the max figure for both) in memory.  The entire game could just simply re-use the 15 bullets and 7 explosions.  Those are pretty low numbers if I do say so myself, and I can live with having 15 bullets in memory if it means I don't have to destroy and/or allocate any more memory during the course of the game!

You all still with me, or have I lost you?

Still here? Good.
So that was half of the programming aspect.  The other one I won't bother you with the details since it was much more application-based and there's less "theory" to discuss.
It essentially was just being able to slam enemies against the wall in order to kill them.
Enthralling! 
Click for the full screen to see what visual studio looks like? Like, if you want, I mean.  No pressure.
Yeah, it's kinda cool.  Yes, it's a main-ish feature of the game.


But wait, there's more! That's right, NOT DONE!
My Blog is like a picture book, you don't have to read, just look at the pretty pictures and feign comprehension.
 The theory aspect of what David and I discussed at length was almost as good if not better than what we physically achieved.  We discussed scoring options, enemy behavior, level design (Which personally I didn't think would factor much into a game of this type but I was oh so wrong) and implementation of a few key aspects of the game that I will probably try and get working on tonight, if I can get my paper and math done.
(I really, really have to stop putting my paper off)
And my attention span!
 I won't bore you with the details, though! (Or alternatively, I WON'T GIVE YOU OUR SECRETS!)
Besides, I have to go to judo now and get my butt kicked.  And afterwards... lunch!  I'm so hungry!
But know that this game is moving forward.  I will not be stopped by a petty college education! (Joking... joking, don't blow a gasket)

Without further ado, I bid thee fare-well world-wide-web
-Kev
P.S. MORE DOODLES
If your sensing a common trend...

Famous Last... Words?

No comments:

Post a Comment