clintbellanger/flare-engine — pull request #140 by stefanbeller (2012-10-06 11:44:19+00:00)
Title: Refactor powers and hazards to use animation class.

Images and animations eat up lots of RAM while playing a flare game. The images on the harddrive are compressed with the png file format, so they are rather small. But when playing the game, the images are held uncompressed in the RAM. Each pixel in an image eats up 4 bytes of RAM. Even the transparent pixels!

Recent measurements (in flare-game) indicate that still 80 to 90 percent of the total used RAM are used for keeping images around.

So cutting down RAM usage (which increases performance, specially loading and ability for older hardware) is best started on cutting down image size.
As hero sprites and enemies are made small by the spritepacking, a huge impact comes from powers and hazards.

So I started refactoring the powers and hazards to use the animation class, which can be spritepacked afterwards.

The changes in the engine require the config files to be changed as well.
Please have a look at the changes I did to the flare-game configs found at
https://github.com/stefanbeller/flare-game/commit/98f013cce4ecccab21c192eabf3d9611675fd590

Do the changes make sense as seen from outside? So would a modder think that the changes are reasonable or just messing up the config files? Did I miss some attributes which should be rather in the animation definitions or still kept in the powers definition?

The config provided in that commit works with the implementation provided in this pull request.