9 Replies Latest reply: Nov 6, 2010 10:20 PM by Pea RSS

    iPad choppyness?

    MartyGoldberg Community Member

      I'm having the same performance issue.  Trying to do a simple PONG as proof of concept.  a) The ball moves much slower than on the dev system, and b) It's choppy as hell with the slow motion for the bulk of it's motion interspersed with quick short random speedups.

       

      I have the GPU accelleration checked, and I've even tried three different rendering methods with no improvement (all actionscript based in Flash CS5, not timeline/scene work done):

       

      1) Typical vector style rendering of the game sprites.  Provided the slowest motion.

       

      2) Rendering each component (ball, bats, tennis line, etc.) as individual bitmaps and then adding each directly to the stage with addchilds.  Better than method 1.

       

      3) Putting all bitmaps in to a single blit canvas and rendering that to the stage.  Same results as method 2.

       

       

      Any one come up with a solution, or does a new version of the IOS packager optimized for iPad need to be put out?  I'm just not a happy camper if I can't even render a simple smooth ball motion, what's the point then?

       

       

      Marty

        • 2. Re: iPad choppyness?
          MartyGoldberg Community Member

          Thanks.  Took a lot of work and optimization based on the link you gave and this one:

           

          http://help.adobe.com/en_US/as3/mobile/flashplatform_optimizing_content.pdf

           

          But I'm finally having some success.

           

          Here's the steps I took for anyone else that's having the issues but doesn't want to do a ton of reading and experimentation:

           

           

          1) I cut down my frame rate to around 30.  According to the mobile development pdf, if you have too high a frame rate set it won't skip the frames and will still process all code each frame. But it will skip the actual rendering in those frames to keep up with that frame rate.  That's where some of my jerky rendering was occuring.

           

          2) Massively cut down on any unnecessary checks and setting changes in the main loop and elsewhere.

           

          3) Removed all filters.

           

          4) added what's apparently part of the new GPU api:

          - make sure and import flash.geom.Matrix

          - add the following statements to the init:

                cacheAsBitmap = true;
                cacheAsBitmapMatrix = new Matrix();

           

          I also set the device to just iPad instead of iPhone and iPad.

           

           

          Marty

          • 3. Re: iPad choppyness?
            kglad CommunityMVP

            you're welcome.

             

            but that's still a high frame rate for a weak device like the ipad.  24 (the same as film) usually is fast enough.  also, the frame rate can be changed dynamically do during times when no animation is being displayed, you can decrease the frame rate dramatically without detriment.  that's less important in limited devices like the ipad that can only do one thing at a time but is user-considerate in, for example, browser-based displays.

            • 4. Re: iPad choppyness?
              Dei_Machiavelli Community Member

              I must apologize for sounding simplistic here but if what I am getting here is right.

               

              This means by putting these codes:

              import flash.geom.Matrix //Inside Import Section.

               

               

              //Inside Constructor:

              ///////////////////////////////////////////////////////////////

              cacheAsBitmap = true;
              cacheAsBitmapMatrix = new Matrix();

              ///////////////////////////////////////////////////////////////

               

              And setting Rendering to GPU in the Publish Drop Down list will "Magically" make everything better ?

               

              From now on I will add this to ALL my Movieclip Classes.

              But I have a feeling from reading the pdf guide that it might not benefit Movieclips that changes graphics [one frame to the next], am I right ?

              • 5. Re: iPad choppyness?
                Pea Community Member

                I have been having exactly the same problems (see my blog entry) and assumed there was some sort of frameskip built in, so thanks for clearing that up.

                 

                This is highly annoying as it means the content behaves differently on the iPhone than it does while editing.  I would much rather have the behaviour whereby if there is too much code to run every frame the frame rate slows overall instead of skipping the rendering step.

                • 6. Re: iPad choppyness?
                  pTymN

                  The frame skipping can be nice when your sounds stay in sync with the graphics.

                  • 7. Re: iPad choppyness?
                    Pea Community Member

                    Is there any way to disable frameskipping? (either compile time or run time?).

                    • 8. Re: iPad choppyness?
                      PunchAndPie Community Member

                      Pea,

                       

                        Did you ever figure out a way to disable the frame skip?  I'm currently being driven mad by an issue with frameskip killing the smoothness of my animations, and not being able to even detect when it is actually happening, so there's no way to even try to compensate for it

                       

                      argh.

                      • 9. Re: iPad choppyness?
                        Pea Community Member

                        I didn't figure out how to stop it - but you can detect it. In your main loop use getTimer() to calculate the time between the current and the last frame. With frameskip this number varies wildly from high to low instead of staying relatively steady. Use this characteristic to determine whether frameskip is happening and lower the actual framerate to compensate.

                         

                        From what I have seen, lowering the framerate leads to much smoother animation than with frameskip, even though the framerate is set lower.  For example, an animation at 12 fps will look smoother than an animation at 20 fps with high frameskip. This makes me wonder why even build frameskip into the engine?  I would have thought the purpose of frameskip was to keep the animation smooth!