Gasha-power’s performance problem — seeking help

Posted by (twitter: @jprogman)
December 17th, 2013 11:14 pm

TRY THE GAME HERE

My entry, “Gasha-power,” is one of my better works that I’ve done since I first participated Ludum Dare. This is my first time making a platform game with Flash, so there were a lot of “risks” to focus on getting things done instead of getting things done properly. While the game runs well during development, playing it on a web browser turned it all around for the worse. I would like to find the solution to that flaw to make the game more easier to run.

If any of you who have done Flash platformers, it would be nice to find out what have you done to make it work.

I think the reason for the lag could be from of the following reasons:

  1. Moving the entire level across the stage. There’s a Movie Clip that has the level’s assets like enemies, blocks, capsules… everything. What I’ve done is setting that Movie Clip’s x/y position
  2. Trying to cache certain objects as bitmaps when I shouldn’t. In general, caching did work on making Flash apps perform faster. But I heard that it actually reduces the performance if it is used incorrectly.
  3. Scaled the level to 200% to make the level two square-pixels bigger. Maybe doing that made processing more consuming.

I’ve provided the original source code of this game included with comments and details. (My second upload of the source code is a lot more cleaner than the first.) I appreciate any help from other Flash devs out there! 😀

 


One Response to “Gasha-power’s performance problem — seeking help”

  1. foumart says:

    Hi, I tried your game and I like it, but it is lagging indeed.
    Regarding your concerns it probably is a combination of all you mentioned. You can check what’s been redrawing with “show redraw regions” tick from the flash right click menu. For the things to work properly you should separate the enemies and all moving stuff outside the level and cache the level as bitmap. Also you can try masking the level in order to show only a portion of it on screen, regardless that the other is not visible(outside the flash window) – flash may still be drawing it, not sure. Only apply cache as bitmap on objects that are not animating internally – for example don’t apply caching on the moving enemies (remember that applying filters has the same effect as caching), you can apply cache on the sleeping enemies.

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]