Sunday, April 10, 2011

Some Optimizations

Alright so, not too much this week. Was really caught up with midterms this past week and studying for the Java certification... along with whatever else happens on weekends when you want your sanity. Anyway. Some good news, I've been trying to apply some of the specific stuff I've been learning that I've gotten from studying for the SCJP and I made a few things more efficient. Theres now an animation lookup table using a HashMap, this speeds things up as all of the objects load from the same pool of animations(that are created at the game's instantiation) rather than creating a new Animation object in memory along with all of the images at run-time. Its a very minor performance hit because of the act of actually looking up the animation references but this only occurs once and eliminating so many objects at runtime definitely outweighs the negatives.

Besides that, another small optimization fix: I've replaced Strings with StringBuilders where it made sense. In Java this helps a lot since regular String objects store all objects in a String pool which is really inefficient in a constantly changing environment like a game or multimedia app.

Unfortunately, I STILL can't compile testable versions. Something about the way Eclipse loads resources from .JAR files. I'm going to try to find a professor who knows; my current programming professor doesn't use eclipse or know much about graphics... ah well. whatever. It will happen really soon. In the meantime, theres a lot that can be done.

No comments:

Post a Comment