Flash / Adobe 3.4 air fullscreen performance dip issue - actionscript-3

I'm creating an HD(1280x800) adobe air 3.4 app for desktop and in the background I'm doing a simple timeline animation that has circles emanating outward. These circles are pngs and I've tried both rendering as bitmap and not, and I tried as flash drawings with a blur on them. The problem I'm running into is that in fullscreen mode, the performance dips significantly. In window mode things run pretty smooth. I've tested this with the animation alone and it always happens. The stage size is the same as monitor res, and I've made sure that the stage isn't scaled, but still the performance problem persists. In the publish settings I have the acceleration set to GPU.
I was under the impression that flash can do all kinds of crazy 3D, so I'm just not understanding why this stupid simple timeline animation is causing so much grief. Can anyone fill me in on some info? Have a solution for the fullscreen performance problem? I have not been able to find a good answer or solution in all my searching.
UPDATE: looks like fullscreeninteractive, and not just full screen is the way to go.

dont use blur on animations. never. ever. that is the reason, people believe Flash is slow. Its not. But the banners are badly constructed, and use tons of filter. Go ahead, and implement blur filter in photoshop to a 3MP image. There will be a progressbar. It will take 1 sec. Blur is slow! If you want blur on your animation, record it, and store as a gif or fla. If you want working blur runtime, implement stage3D, and create an AGAL program that will render it on GPU.

Related

Why this rendering artifacts happen?

I'm developing simple mobile game for android using cordova. The game is the simple Hidden Object game where player has to find requested objects on the scene. One of my levels had very slow performance. More powerful devices worked fine. I've tried force GPU rendering using translateZ hack and got huge performance boost but, on low-end devices started wired rendering artifacts.
This screenshot is from Meizu U10. The background consists of 3 layers with position absolute, z-index 1,2,3. Objects to find (Cow, chicken etc) has same position absolute and z-index depends from background they are related to. If run game in browser on the same device, there is no artifacts and performance just great. Google did not give me any useful clues, so i will be very appreciate any guesses and tips.
Using SVG can be an option you might need to consider, specifically inline SVGs.
Using inline SVG is beneficial to the performance of a website because
it eliminates the HTTP request needs to load in an image file. Since
no file needs to download, this results in smaller loading times for a
page. This makes your website appear faster to visitors, improving the
user experience.
You should really consider using a webGL rendering engine such as PixiJS if you want to have performance in your games. You would just have to convert your images into textures.

How to make efficient dynamic mask in starling

I'm trying to make an interactive book for tablets with animations and page flip.
I'm using starling framework.
My idea of page flip is to mask 2 instances of next page with 2 static quads which are moving and rotating (it works great on pc/mac, but slow on tablets).
Using PixelMask is slow/very slow(10-20fps). Using clippedsprite is fast(40-50fps) but cant rotate the mask.
Are there any other options?
EDIT:
During my search I've found the idea of shaders (AGAL in ActionScript3), but I'm not familiar with this. Is it possible to simulate masking by the use of GPU shader?
EDIT2:
This problem was experienced on iPad1, on iPad3 its 60fps :) Dont know how its going to work on iPad2 and iPad4
I'm pretty sure AGAL is the ultimate answer!
But easiest, and still very good, solution is the smart use of ClippedSprites
(Sprites with clipRect since Starling 1.3+)
I've managed to achieve almost static 60 fps on iPad1.
Just needed to remove filters and stop/flatten animations inside Objects!
Filters are massive performance killers!
You can find here a mask class based on FragmentFilter. i got better results with it. But if you want to implement a PageFlip, you can use this class. And here is an improved version of the pageflip with interactive corners. Hope it helps you :D

HTML5 Canvas and Game Programming

I hope this isn't too open ended.
I'm wondering if there is a better (more battery-friendly) way of doing this --
I have a small HTML 5 game, drawn in a canvas (let's say 500x500). I have some objects whose positions I update every 50ms or so. My current implementation re-draws the entire canvas every 50ms. I can't imagine that being very good for battery life on mobile platforms.
Is there a better way to do this? This must be a common pattern with games.
EDIT:
as requested, here are some more updates:
Right now, the objects are geometric primitives drawn via arcs and lines. I'm not opposed to making these small png/jpg/gif files instead of that'd help out. These are small graphics -- just 15x15 or so.
As the game progresses, more and more of the screen changes at a time. However, at the start, the screen changes relatively slowly (the objects randomly moved a few pixels every 50ms).
Nearly every game with continuous animation like this redraws everything every frame; clever updating algorithms are only applicable when a small part of the screen is changing and there is a nice rule to figure out what is overlapping that part.
Here is some general optimization advice:
Make sure that as much as possible of your graphics are handled by the GPU and not the CPU. (This may be impossible if the user's browser does not use the GPU for 2D canvas rendering, but you can expect upgrades may change that as HTML5 gaming gains popularity.)
This means that you should avoid elaborate clever algorithms in favor of doing as little work as possible in JS code — except that avoiding performing a lot of drawing when it is easy to determine that it will be invisible (e.g. outside the bounds of the screen) is generally worthwhile.
If your target platforms support it (generally not the case for current mobile devices), try using WebGL instead of 2D Canvas. You will have to do more detail work, but WebGL allows you to use operations which are much more likely to be provided efficiently by the GPU hardware.
If your game becomes idle — that is, nothing is actually animating at the moment — stop redrawing. Stop your update loop until the user interacts with the game or a timeout occurs.
It may be helpful for you to add to your question details of what types of graphics you are drawing (e.g. are you using sprites, or geometric primitives? Are you drawing images rotated/scaled? Does most of the screen change or just a few small objects? Are you blending many layers?) and perhaps even a screenshot or two; then we can suggest what sort of optimizations are suitable for your particular game.
Don't draw a background, make it an image and set the CSS background-image of the canvas.
Using requestAnimationFrame should help with battery life.
http://paulirish.com/2011/requestanimationframe-for-smart-animating/
Only do a redraw if something has actually changed. If you haven't already, introduce the concept of invalidations. (ie, the canvas is valid so nothing redraws until something moves. Anything moving within the window of the canvas causes the canvas to become invalid, thus needing a redraw)
If you want to be battery friendly you can use Crafty. This game engine is using modern CSS3 technology so it doesn't need to update a canvas all the time. Look at this example game here.
The way you don't want to redraw entire canvas every frame, it only can be the "Dirty-Check" or "Dirty Matrix" algorithms.
Dirty-check seems more efficient than entire redraw. but I think it depends on your render implementation.
it is not necessary to use it if you are using canvas2D to render. Nearly every game has complex sprites and animation. if you use dirty-check, when a part of sprite or background map need to update, you have to figure out what is overlapping this part. and then clearRect this small area of canvas, and then redraw every sprite or map. etc, what is overlapping.
It means your had to run canvas render api more times than normal render implementation because of the overlapping part. And Canvas2d render performance usually does't sounds efficient.
But if you use WebGL, that maybe quite difference. even though I am not family with WebGL, I do knew that maybe more efficient. Dirty-Check should be a good Choice to match your propose.

Flash actionscript 3 smoothly moving large sprites

I've got a problem in actionscript3 with moving large DisplayObject-s. When the size of the DisplayObject is quite large (more than screen size) the movement loses smoothness and it looks like the object starts jumping forward and backward, which overall looks very unpleasant.
Does anybody know the way to fix that? I am trying to make a sort of a race game, where I need to move the background sprite to make the illusion of movement.
Try turning on cacheAsBitmap. That may give you some performance improvements, especially if the object is static (doesn't have any animated bits in it). With AS3 and Flash Player 10 or newer you should be able to get smooth movement even with a large sprite. I've got several games that do it.
Have to agree with Laurent - it is probably better to split the background into small pieces and move them

Actionscript 3.0 Tween Question

I am currently working on a website for a construction company and I am trying to build a very simple flash intro. I have two images in the falsh intro: a tractor and a picture of clouds in the background.
I am trying to have the clouds appear to float by in the background. It is a very wide image that I am trying to loop through very slowly. It looks pretty cool :) IMO.
For tweening, I have always used TweenLite. The problem I am having is that while the image is moving, it 'blips' and looks pretty choppy. I have adjusted fps and about every other thing I can think of. The only thing that fixes it is when I use Hardware Acceleration (Level 2 - GPU). But this creates all sorts of problems for the HTML page.
My Question Is:
I am just a terrible coder, or would I be better off using Tweener (or something of the sort) or using the native tween engine in flash cs4? Any advice would be great!
Try these:
If the image is in your Library, make sure "Allow smoothing" is checked in your Bitmap Properties (select the image in the Library and go to "Properties" in the Library menu).
Or, if you are loading the bitmap dynamically and using the BitmapData class, make sure you've set the "smoothing" property to "true" on your BitmapData.