Hi all,
I am building a multiplayer game with the character as the main highlight. One requirement is for the character to be highly adjustable in appearance. The character is broken into 20 parts. Each part is then loaded accordingly at runtime from an asset library according to the saved values of each character. These parts can be changed by the players anytime. Each part in the asset library is a vector graphic.
It all works so far. I can load and display the character but the problem comes when I animate these parts. 1 to 5 characters moving around in the game does not have any impact. Once it goes above 20, things start to slow down. Even cacheAsBitmap does not help.
I know this is due to vector graphic + the numerous movieclips used. If I have 10 characters, that counts as 200 movie clips being animated? I’ve also read some great topics here on using Bitmap, BitmapData, copyPixels etc to speed things up.
One example I tried out is:
[LIST]
[]Load the character
[]Run through every frame of the animation and take a snapshot of the bitmapdata and push it into an array
[*]Once done, display each frame of character animation using bitmapdata from the array.
[/LIST]
This works and showed obvious performance increase when I placed in 200 characters on screen. No lags and slowdowns except higher memory usage.
But my worry is, each character is highly dynamic. I figure out this may pose a problem since each character has different appearance and there may be more than one type of animation (dance, jump, fly etc). And even greater problem if I have 200 unique characters on screen. I will have to copy 200 * total animation types.
By the way I am using AS3 and the game is an isometric tile based. I hope someone can correct me where I am wrong. Am I on the right track here? Are there more optimized approach?
Regards,
darnpunk