04-30-2011 02:31 AM
Hey folks,
I'm trying to write a Solitaire game but the playbook slows to a complete crawl when its running. I believe I've narrowed it down to the number of sprites on stage at any one time (after the game is delt there are at least 28 cards on the table)
Are there any common Gotcha's that I can be looking out for to try and optimize this for the PlayBook? The game has been running perfectly on my desktop during development so running it on the device for the first time came as a huge shock.
04-30-2011 03:26 AM
I think that the maximum number of sprites on stage depends on the sprites size, animation(scale and rotation of bitmaps is expensive), alpha...
I recomend you to read this, it will definetly help with your problems.
04-30-2011 08:36 AM
04-30-2011 08:47 AM
Indeed, Vector based graphics make your app lagg a lot more. This is not only on the Playbook but on android devices as well if you are using Adobe AIR. A known performance boost is like becooltim says is to cache your sprites as bitmaps.
sprite.cacheAsBitmap = true;
or
movieclip.cacheAsBitmap = true;
It is also know to specify a new matrix a long with that but can't remember exactly how that worked
04-30-2011 11:41 AM
Flash performance on a typical desktop is much better than the Playbook, for now. Things might get better in the future. The simulator at least on my kit, is still not accurate enough to benchmark. That was driving me nuts, so now I don't even use the simulator, just deploy on my device for benchmarking, etc. And yah....the performance isn't that great, but if you can try to make it run at stable speed instead of letting it slow down / speed up, etc, etc. I think that works better in my opinion, unless you're using a decent time based solution.
04-30-2011 12:20 PM
ThomasOnWeb wrote:
It is also know to specify a new matrix a long with that but can't remember exactly how that worked
04-30-2011 12:23 PM
04-30-2011 01:34 PM
If you really want to optimize, you can do away with Sprites altogether and just use BitmapData and its copyPixels method. You have to give up lots of features (rotation, scaling), but it's quite fast. It's the technique I use for my game, "The Rainstorm" (http://appworld.blackberry.com/webstore/content/35
It's still not totally optimized code, but it does use the copyPixels idea.
Someone reported about 20fps, and I use more than 20 "sprites", plus filters.
04-30-2011 02:35 PM
Actually, with GPU rendering turned on, I'm getting good results using stage sprites. ![]()