Wednesday, May 13, 2009

a few lines of code mean a big explosion

Yes, the ships explode. I just coded that in, so if you get into a fire fight with another ship, one of you is bound to explode. Now the part that is left to code is to create time dependant creation of bases on asteroids and planets, balancing the weapon damage and repair progress. Then to make the resource gathering process to work better and finally to code in the game rules.

Then, it will be time to code in the tooltips, special UI elements and the creation of many sprites for the different weapon effects. lets see how that goes.

Tuesday, May 5, 2009

MIDI music and Sound Effects

I recently added a background music to my game. It is the MIDI of the U2 song, October. This will work as a place holder till I find someone to do some original music for me (fat chance).

The ship also gives off the laser firing sound effect whenever the laser is fired. That is the first sound that has been added to this game. There are going to be explosion sounds, hitting sounds and some notification sounds in future.

By the way, I have also created an options menu, and you can use that to control the music sound volume. I think I will make the sprites for the enemy ship today as I do not feel like doing any coding.

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. 

Tuesday, March 17, 2009

Sprites are here

When I started coding for this game, I opted to go for vector graphics, instead of sprites to make this game. Although that idea had its advantages in the long run, but right now working in vector graphics will take me away from completing the game, and complicate the whole process of collision detection and other calculations.

I just completed a sprite for the ship that the player is going to use and it is shown below. J2ME has a good sprite support which makes collision detection easier, which will be a big part of this project. The code for the vector graphics is there, but it will stay in active till I find time to do it.

With vector graphics you can greatly reduce the amount of memory that is used by the application and do different effects and create a particle system, something that I would love to do, but not right now. Do note the cool glow around the engines.



Friday, March 13, 2009

Double Buffering Enabled

I just implemented double buffering into my game. What double buffering does is that, it stores a frame in the memory buffer as an image and then pastes the image when it draws the game. This avoids flickering which is normally encountered when drawing complicated scenes. The best thing was that, it required only 6 lines of code to do all that.

I just tested the game on my mobile, which is Nokia 3110c and the game is running smooth. I also made the game full screen, thus it looks much better than before. The next step will be to make the weapons work.

Thursday, March 5, 2009

making an empire

The recent update has been that now you can capture/populate planets and asteroids. As a result, if you watch your empire screen, the asteroids and planets just captured will be displayed there. Apart from that, the rate of resource generation will also be updated on the main screen.

I have also added popup boxes that come up as soon as an action is done, like capturing a planet or if some action cannot be done, like when you want to capture a planet and its status is already owned or neutral. Capturing an asteroid or a planet costs population resource which can be filled up with the growth rate. I am also thinking that the user can only refill his crew on a planet, so if he is down on crew, he will need to go back to a planet to get more crew.

The next thing to be done is to make the weapons fire. This can be a bit tricky, so i should get on it soon.

Tuesday, March 3, 2009

The work so far

The work you see in the picture below is about as far I have come into developing my game. The screenshots with the coloured backgrounds show the different courses of action that a person can take while managing the menus. All you see here is working code and there are almost no bugs. You will notice that there is no spaceship in the shots as at the time I made this big picture, there wasn't any ship. But now, there is one and I am currently making it move.

In the beginning I made a design decision that the ship will only be able to jump to different quadrants. Later I realised that this might actually take the fun out of flying the ship. Now as the ship crosses the screen, a new quadrant is drawn and the jump is only used to jump to a different quadrant instantly. So the things that need to be done right now are:

- make the ship move properly so that it comes up at the right spot when it crosses the screen
- change the current quadrant to the new quadrant
- create the cool down time for the hyperjump

here is the screenshot:

Game Publishers

Once my game is complete or at least is in a state where I can provide a demo, I will surely contact these publishers to see who can provide me with the best deals ... if it is possible. Just putting them down here for future reference.

Shadow of Empire

This is a welcome message to whoever stumbles upon this blog. It has been made to inform about the progress that I have made on a game of mine. I think I will stick to the name 'Shadow of Empire' for my games as I could not get 'Kayenaat' from blogspot... surprisingly. I guess someone beat me to it/ But I guess shadow of empire ain't bad at all. Now first come fist, I should write down the publishers of mobile games in a new post followed by the things that I am working on at the moment. So here starts the game blog...!