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 :)

Tuesday, March 24, 2009

Bug fixes and 2 new important menus added

I just fixed a few annoying bugs, so the game is working really well now. In the past, while managing the menus, you sometimes needed to press the '5' key to make the menu work, instead of the 'Fire' key. I solved that annoying bug, so now almost all the menus work without any problem.

Also, now when you start the game, you first get a build menu, where you select which components you want to add to your ship. If you want 4 lasers, go right ahead, 2 lasers 4 rail guns, be my guest, extra shields, no problem! And only after that you get to play your game. This ensures that every time you pick up the game, you have a different playing experience.

The second screen that I added was that of the 'Options'. now you can control how much the star density should be, so that the low end phones can run the game smoothly. You can also select the number of opponents, the difficulty of AI, the FX and music volume, among other things.

The next thing to do is to put some building time while capturing planets or asteroids. I am still not sure  if that should be done or not. Right now, the planets are captured instantly. Then, I need to set some cost for making a hyperjump, right now its free. Still, a lot of things remain to be done before I start working on the AI.

Friday, March 20, 2009

Weapons firing done

One of the big problems that i encountered was to get the weapons to fire automatically, based on the position of the enemy. You find the angle by using tan(a) = y/x and then use sin(a) and cos(a) to make the weapons fire the projectile in the right direction. Now the next thing that I will do is to make the shields flicker whenever the ship takes damage. That ought to be fun!

Wednesday, March 18, 2009

Ship movement done

I was finally able to do the ship movement and that too properly. Now the left and right keys are used to rotate the ship and the forward key is used to move it forward. The problematic part was to rotate the ship at an angle and then move it according to the angle. Not to mention that I also needed to corelate the appropriate sprite to the appropriate angle. You can see the ship moving about in the screenshot below.