Friday, April 17, 2009

8 bit PNG sprites, transparency and memory management

So far, I had been using 8 bit PNG sprites for almost all the resources. as it turns out, these sprites take way more resources than desired ... with one taking as much as 200 kb. so if you have two objects using the same sprite, that increases the memory usage exponentially.

The problematic part is that, if you make a sprite and rotate it, photoshop uses antialiasing, which creates a few transparent pixels around the slanting or curved edges of an object that is rotated. now wehn you convert that into an 8 bit PNG image, all the transparent pixels turn out to be white and thus all the sprites have ugly white outlines.

After much trial and error, I found out that the best way to avoid this is to rotate the entire image, not just the object with in the sprite. The problem that comes then is that the attributes of the image get distorted, so you cannot use the image as it is and have to extract the object from within the image.. the object that you wanted to rotate and then paste it into the sprite that you wanted to create. I end up making the same image twice ... which is a pain... if only I had 3D Studio Max, I could've created a space ship in 3D and used 3D studio Max to generate the frames for me, which would've looked much better and would've been easy to convert into PNG.

just my luck huh?

Friday, April 10, 2009

We now have an Icon

The game now has its own icon:




Which as you can see is basically a planet. For some reason, I am unable to edit the properties of the game, so I have to go to this path:

C:\NetBeansWorkspace\Kayenaat\nbproject

and make changes to the project.properties file to make the icon work. Anyway, I should clean up some unnecessary files abd try to optimise the game a bit.


Thursday, April 9, 2009

Out of memory error

In my last post, I was pretty ahppy about the weapons and the enemies behaving as they should. Today, I got the random spawning of the enemies fixed and now you can control the number of enemies that you can play against from the Options menu. 

All good so far but unfortunately, my happiness was shortlived. As soon as I started playing the game on my cell phone, I started to get out of memory errors. It seems that I am loading too many resources at a time and a serious reworking of the memory management is in order. This can however take a long time to fix, so maybe I should fix the damage taking part done and fix the  research menu and the related stuff.

more updates will be coming soon!

Wednesday, April 8, 2009

A major milestone complete

Right now i completed a major milestone in the game. The ship fires at the enemy in the right direction. The cool thing about that is that, all the weapons are placed at the different places on the ship itself. So as they fire, the projectiles converge at the enemy's ship.

But that is not what got me all excited. The cool thing is that, as the enemy takes damage, its shields flicker. Just like how i wanted it to work. its a treat to see the things work as you visualise them. The bug that I am experiencing right now is that, instead of the hull taking damage, it actually gets repaired. I guess it has something to do with icorrect addition sign.

Anyway, the next task is to fix the damage  taking mechanism and also to place the enemy ship at random quadrants and then to check the system with it. This is going to be fun :)