Archive for January, 2009

A pixel update

Well, here is some more updates on the pixels. The diamond thing show that the building can be upgraded, when upgraded you will be able to build other buildings and a stronger army.

I have about 6-7 more of these to make, trying to make 2 each day! ( I’m working full time so this is my night/weekend project :) )

so, here is the upgrade buildings this far. I’v made some progress on the engine as well, I will post some screenshots this weekend.

More pixels

Some more pixelanimations of how I build them

and

I’m working on some more, then I will continue with some coding

Pixel time

Hello,

I’v decided to not release any more demos until the beta version, Its not that much work left and I don’t want to show everything before the release! But will probably give you some screenshots!

The thing that takes most of my time now though is all the pixel stuff, I need to finish a lot of different buildings and such.. But I will post some updates how I progress on those, to start of I’ll show the main headquarter with a little animation :)

And here is the finished building:

More to come!

This weekends update

I’v made some good progress over the last few days, now it finally starts to look like a real game :) Here are the updates:

      GUI now it starts to take its form, I’m happy with how the minimap turned out. Most of the buttons dossnt work yet so thats the next part I’m going to work on.
      Preloader Now you see the different game parts load before the game starts.
      Infoscreen If you look at the bottom you will see the infoscreen, it will hold information about new events, new attacks and so on.

For GUI animations im using the great TweenLite class, Its awsome and if you dont know what it is you should really check it out http://blog.greensock.com/tweenliteas3/

Oh, and I’m using Steve Websters base64 class for the map data I was talking about in the last post. and can be downloaded here http://dynamicflash.com/goodies/base64/

No new demo, but I’ll post some screenshots to show the progress. Some new pixelbuildings have also been started, though they aren’t finished yet.

The preloader:

A screenshot from the game:

Engine demo 20090108

Here is the new demo, Click here to try it out

There are some new stuff added to the engine.

      Animated tiles I’m going to try and have some buildings animated to get some movement. Though this will probably add some to the memory usage, so I will probably add some options that lets you turn it of. I’v added a oil station just to let you have a quick look.
      Game save Now when you build your city it is being saved to the server, so if you reload the page then your city should still be there. This is a first test and I know there are some bugs.
      Minimap I’v added a first version of the minimap, it will look much better when I add the GUI stuff to it.

The biggest part in this update is the saving part, I’m using a query class so there wont be as much requests to the server, and all mapdata is in bytes which will save bandwidth. Here is a example of a save with 50 buildings:

  1. AwAAAAMA/gADAP4AAwD/AAMA/AADAPwAAwD9AAMA/voDAP76AwD++gMA/vwDAP7+AwD+/wMA/f8DAP4BAwD9AQMA/gIDAAMGAwACCAMAAQoDAAAMAgf/AQIH/wICB/4DAgr+/QIK//4CBP//Agn8/wIJ/f4CA/39AgYAAQIGAQICBgEDAgsCBAIGAgUCDAIGAggBBwIKAAcCCQEGAgMBBQIIAQQCCAADAgIAAgIH/wMCBwAEAgIABQIIAAYCCP8FAgL/BAIBAgcCBQEJAgIBCAIFAAsCBgAKAgMACQ==

This data is just being sent when you start the game, so I will be able to let the users have a lot of buildings! What the server gets depends on how much the user adds to the query, just a single building looks something like this:

  1. BQoAAQIHBgwAAg==

Great success!

(If you like explotions, scroll down and look at the old demo. It includes bombs and some other buildings)

Main loop actionscript optimizing

Hello,

Allthough the engine runs fast on all computers Iv tested it on, Iv now started optimizing the code to get it to run faster. Then maybe I will be able to use even more particle effects and such. I though ill start posting some code on this blog in case someone is interested.

So, the first thing iv done is to get the main loop faster. It loops through every tile on the map every frame. So if you have a map with 100 horisontal tiles and 100 vertical tiles you have a total of 10 000 tiles, and those are looped through 30 times a second, so 300 000. So to get the main loop faster will make some diffrence.

At first the loop looked like this:

I run each loop 100 times with 100×100 tiles, tileArray is the array holding all the tiles

  1. // class Render
  2. var e:Element;
  3. for (var i:int = 0; i < this.tileArray.length; i++)
  4. {
  5.  for (var u:int = 0; u < this.tileArray[0].length; u++)
  6.  {
  7.   e = this.tileArray[i][u] as Element;
  8.   if (!e.empty)
  9.   {
  10.    e.update();
  11.   }
  12.  }
  13. }

This took: 1842ms

  1. // class Render
  2. var xlength:int = this.tileArray[0].length;
  3. var ylength:int = this.tileArray.length;
  4. var e:Element;
  5. for (var i:int = 0; i < ylength; i++)
  6. {
  7.  for (var u:int = 0; u < xlength; u++)
  8.  {
  9.   e = this.tileArray[i][u] as Element;
  10.   if (!e.empty)
  11.   {
  12.    e.update();
  13.   }
  14.  }
  15. }

This took: 1520ms, some improvment!

  1. // class Render
  2. for each(var a:Array in this.tileArray)
  3. {
  4.  for each(var e:Element in a) {
  5.   if (!e.empty)
  6.   {
  7.    e.update();
  8.   }
  9.  }
  10. }

This is what I ended up with after some testing, and it took 1422ms, a bit faster though the the best part is that the code looks much better ;)

Here is two pages i found about this subject

Seven tips about actionscript optimizing at gamedevjuice.wordpress.com
Optimizing actionscript 3 at www.nbilyk.com