×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    8

    Flash Lite Performance Problem

    Hi!

    I'm starting to develop flash lite games for symbian^3 devices and I have a C7 phone.

    I'm facing a big performance problem with flash lite 4 (and/or others) and I wanted to know if I was doing something wrong.

    There is a 360x640 jpg and a 40x40 png file (without transparency, though I'll need transparency) in the library. I embed the bitmaps into sprites in the library and instantiate them in the code. I use the larger file as the background image, and I put 12 of the smaller images in the display, just to be translated circularly within an enterframe event (I keep the sprite references in arrays or vectors). There is no overlap among the smaller images. So It's just a plain test with bitmaps on screen. And the frame rate is set to 20.

    When I run this on pc, it just works perfectly; a bunch of images translate around in their circular paths. But when I try this on the device (either as sis package or wgz), it runs normally for about 1 sec, and then the frame rate drops quickly down to <1fps. Do you have any idea why this is happening?

    Secondly, is there a way to lock flash content to fullscreen and landscape orientation without requiring user interaction?

    Thanks,

    Serhat

  2. #2
    Registered User
    Join Date
    May 2011
    Posts
    8

    Re: Flash Lite Performance Problem

    Seems like it's not about the number of sprites on the screen. The slowdown occurs after about 1 second, even with a single sprite going around. After a touch, it speeds up for just a little, and slows down again.

    The device is not set to power saving mode. Do you know if the device slows down the cpu automatically?

  3. #3
    Nokia Developer Champion
    Join Date
    Nov 2006
    Location
    Mumbai, India
    Posts
    48

    Re: Flash Lite Performance Problem

    The slow down should not happen because of the images.
    How are you creating the 12 movieclips (with bitmaps) on stage? I'm guessing you are running a loop for placing them on stage during runtime. Are you ensuring that loop for creating these movieclips is running only once? I.e you have only 12 moving movieclips with bitmaps and not more.

    In my experience, raster images have always improved performance of complex games.

    Mariam
    Mariam Dholkawala
    http://www.igamestudio.com

    Blog - http://www.mariamdholkawala.com/mobile
    MaD UG - http://www.indimadgroup.com

  4. #4
    Registered User
    Join Date
    May 2011
    Posts
    8

    Re: Flash Lite Performance Problem

    Hi Mariam,

    The sprite class resides in the library of the Flash IDE. I instantiate each of them from that class once during initialization and keep their references in a vector (tried arrays also) then add them to the display list. Later move them inside an enterframe loop. The thing is really weird, because the problem exists even 1) a config where one bitmap is moved without a background image, 2) another config where a single vector image is moved around without anything else.

    Could the reason be a device setting other than power saving? Or maybe some hidden setting for flash player? Any ideas?

  5. #5
    Nokia Developer Champion
    Join Date
    Nov 2006
    Location
    Mumbai, India
    Posts
    48

    Re: Flash Lite Performance Problem

    There is no hidden setting in the Flash Player to slow down an app, especially in the scenario you've mentioned. The processor also similar to N8 which I think gives a very good performance to Flash Lite games.
    Is it possible for you to attach your code for me to have a look?
    Mariam Dholkawala
    http://www.igamestudio.com

    Blog - http://www.mariamdholkawala.com/mobile
    MaD UG - http://www.indimadgroup.com

  6. #6
    Registered User
    Join Date
    May 2011
    Posts
    8

    Re: Flash Lite Performance Problem

    This is the simplest version that runs inside the Flash IDE. Well, there is not even much of "code" out there, and I'm not even using "Number"s...

    Maybe I should record a video...

    stop();
    var spr0:Man = new Man;//Man is a sprite in the library
    var _tick:int;

    init();

    function init():void {
    addEventListener(Event.ENTER_FRAME, loop);
    _tick = 0;

    addChild(new BackgroundSprite);
    spr0.x = 100;
    spr0.y = 100;
    addChild(spr0);
    }


    function loop(e:Event):void {
    _tick++;
    var angle:int = _tick * 0.1;
    var dx:int = Math.cos(angle) * 5;
    var dy:int = Math.sin(angle) * 5;
    spr0.x += dx;
    spr0.y += dy;

    }

  7. #7
    Registered User
    Join Date
    May 2011
    Posts
    8

    Re: Flash Lite Performance Problem

    I shot a video from a similar version, which has a couple of sprites against no background image. You can see the problem clearly:

    http://www.youtube.com/watch?v=6l8BrKfCp4o

  8. #8
    Nokia Developer Champion
    Join Date
    Nov 2006
    Location
    Mumbai, India
    Posts
    48

    Re: Flash Lite Performance Problem

    I tried the code on my device and it does run slow. This mostly has to do with the loop event which is making complex calculations that the device cannot handle.

    There are several tricks to making it run faster.

    1. Round off decimal points to reduce calculation overhead. You can do this with
    var dx:int = Math.round(Math.cos(angle) * 5);
    var dy:int = Math.round(Math.sin(angle) * 5);

    2. Assuming that in the example you sent, you've attached the eventHandler "loop" to all 12 movieclips. This unnecessarily adds to the overhead and reduces speed.
    You should try calling 1 event listener which runs a loop to animate all you movieclips. The below mentioned code runs with a 24 fps on my device.

    stop();

    var xpos = 10;
    var ypos = 10;
    var mcArray:Array = new Array();

    for(var a=1; a<= 15; a++){
    //Man is a sprite in the library
    var spr0:MovieClip = new Man();
    spr0.x = xpos;
    spr0.y = ypos;
    spr0.tick = 0;
    xpos += spr0.width + 10;
    if(a%5 == 0){
    ypos += spr0.height + 10;
    xpos = 10;
    }
    addChild(spr0);
    mcArray.push(spr0);
    }

    init();

    function init():void {
    this.addEventListener(Event.ENTER_FRAME, loop);
    }


    function loop(e:Event):void {
    for(var a=0; a< 15; a++){
    var mc:MovieClip = mcArray[a];
    var _tick:int = mc.tick++;
    var angle:int = _tick * 0.1;
    var dx:int = Math.round(Math.cos(angle) * 5);
    var dy:int = Math.round(Math.sin(angle) * 5);
    mc.x += dx;
    mc.y += dy;
    }
    }
    Mariam Dholkawala
    http://www.igamestudio.com

    Blog - http://www.mariamdholkawala.com/mobile
    MaD UG - http://www.indimadgroup.com

  9. #9
    Registered User
    Join Date
    May 2011
    Posts
    8

    Re: Flash Lite Performance Problem

    Hi Mariam,

    Thanks for the help. I tried your code and it runs well just for a little more time than mine. So the problem still exists

    I attach the enterframe event to the stage, not to the movieclips/sprites, so unfortunately that's not the case. I'm an experienced AS3 developer and I'd really wish I had made such a mistake )

Similar Threads

  1. The performance of Flash Lite 4 in N8
    By yeggo in forum [Archived] Flash Lite on Nokia Devices
    Replies: 12
    Last Post: 2011-04-04, 18:02
  2. Quality and performance degradation when standalone Flash Lite has been sent to back
    By bhorsting in forum [Archived] Flash Lite on Nokia Devices
    Replies: 2
    Last Post: 2010-11-22, 22:28
  3. Problem with Flash Lite & Nokia - Flash Lite does not open in MMS
    By muggzy in forum [Archived] Flash Lite on Nokia Devices
    Replies: 4
    Last Post: 2008-12-17, 17:13
  4. I have a problem in chat using Kuneri Lite and Flash Lite.
    By Felipe.Sampaio in forum [Archived] Flash Lite on Nokia Devices
    Replies: 1
    Last Post: 2008-07-09, 07:40
  5. Getting Flash Lite installed on Flash Lite enabled but not pre-built devices!
    By sirbijan in forum [Archived] Flash Lite on Nokia Devices
    Replies: 1
    Last Post: 2008-06-04, 07:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •