Hi I'm creating an adobe AIR application..Its working fine ,But I want to make my application without performance issues..How to Check Adobe AIR applications performance ?Is there any tools available?
Take a look at Adobe Scout
"Adobe Scout is the next-generation profiling tool for Adobe Flash Player and AIR."
When building any flash application you define the application FPS. If the real FPS (flash can skip frames under high load) is lower than the defined FPS- you have troubles. You can check the FPS by vast variety of FPS meters here.
If your real FPS coinsides with the defined one - it is great, but try rising the defined FPS value up to 120 (which is max) and check out the real value, it is hardly be higher than 60 during animations, but the higher you can get - the better your application is. With this approach you can eliminate or at least point out "slow code".
ADD: It also worth mentioning that if the defined FPS value is 24, and the application is in stable state (the amount of animation, animation complexity and computational complexity stay more or less the same) the real value will "float" across some value, let's say 23 FPS with the spread of 1-2 (i.e. 22.7, 23.5, 23.9, 23.1, etc). And the mean value will be always lower than the defined FPS value.
Try to check memory usage. I would start trying to launch Flash Builder profiler remotely while your app is running live on the device and check out memory utilization. Refer this
Try to check redraw regions. Note that MovieClips that are not visible (e.g. throbbers) are still redrawing unless the are stopped. So if you see some region redraws without sencible reason - try to figure out why. The ideal case is to call stop() and visible=false or remove from stage the unused animations.
ADD: Redraw regions indicator is a part of Debug version of Flash Player. You can enable it through the context menu of the debug version of Flash Player.
UPDATE: I added some details to my answer as I see the interest to the Adobe Flash Perfomance issue. I don't remember the exact acticle, but I found a lot of usefull advices on the Abode's site, now I see that the number of such articles there increased.
Also I didn't know about the Adobe Scout before, but it sounds promising. I'll definately try it soon.
Related
At some point of development of my new game, I stumbled upon a problem which lead me to discovery of Adobe Scout. The problem occurred after some time of gameplay when the game started lagging more and more heavily up to the point when the whole application crashed. I did some profiling with Scout, and here's what I found: most, if not every heavy memory load is caused by gotoAndPlay() function (if I understand the data presented by the profiler correctly). This function always seemed and even felt like an easy task for Flash, but turns out it's not? Or is it caused by using text labels instead of frame numbers? I am currently looking for possible workarounds to use this method less, and while I do, it would be infinitely helpful to hear thoughts or possible options from people who are aware of this issue.
I am creating a voice enabled application in Flash using RTMFP and I noticed that the Flash plugin automatically regulates down the sound volume of other processes/applications (at least on Windows) as soon as a RTMFP stream is opened and starts playing - very similar to the way Skype does this. Furthermore it seems that Flash also regulates itself (!) down in volume as soon as the Microphone is accessed what is quite contraproductive in group conferences. See: http://i50.tinypic.com/2415r4k.jpg
So, what I am trying to do is to get access to the automatic sound settings, either to disable or to set my own rules for them because the defaults don't work out very well in my oppinion. Unfortunately, searching on this topic did not raise any usable results so I hope that maybe someone else has managed to do this already and is able to give me a hint.
If this is not possible in general it would still be sufficient to disable automatic sound settings on every NetStream opened so that at least these are always at 100% volume or more, depending on the case. Does anyone know if manually setting the volume/gain on a NetStream instance overrides the automatic settings made by the plugin? Or is the automatic sound setting always overriding that/adding to that settings and entirely out of a developer's influence?
Thanks in advance
It's more of a Windows 7 problem and not directly related to Flash. You can change this behavior if you check your settings in the Control Panel: Sound - Communications - "When Windows detects communications activity".
There is no workaround from the Flash point of view, as the operating system itself controls this volume adjustment. If you use SoundTransform(1) on your NetStream, the Flash Player outputs the full volume, but the Windows sound manager is one level above and turns it down again.
I opened this matrix multiplication benchmarks and my browser (Firefox 7.0.1) froze until the benchmarks finished (I opened the page in an old Asus EeePC 1000H).
I heard that web workers were invented to separate processing from displaying the web pages. Is it possible to make use of the Web Workers API to make WebGL not stall the whole web browser ?
For the sake of clarity: the benchmark that you linked to does not use WebGL at all. (I should know, I wrote it.) And in the case of that particular benchmark you absolutely could run it in a Web Worker now and it would be perfectly fine.
(Fun fact - Web Workers didn't support TypedArrays when the benchmark was built, and since most of the matrix libraries rely on that it was impractical to run it in a Worker at that time. That has since been fixed.)
Anyway, to answer your original question: No, WebGL cannot run in a worker. The core blocker to this is that in order to get a WebGL context you need to call getContext on a canvas element. Web Workers explicitly disallow DOM access (which is a good thing, BTW!) and as such you'll never be able to access WebGL from a worker.
But that's not as bad as you might think. For one, consider that most all 3D rendering is actually happening in a different thread anyway. Specifically, a whole bunch of threads running on your GPU. The only part the browser has in it is to tell your graphics driver "Hey! Start rendering some triangles using this data!" and then it moves on without waiting for the triangles to actually be rendered. As such, while the draw commands must be executed from the main process, the time it spends blocking that process is (usually) very little.
Of course, that's not what's going to eat up a bunch of your time if you were coding a realtime game. You've got animations, physics, AI, collision detection, pathfinding... there's a lot of non-graphical tasks involved that will eat your CPU alive if you let them. In some case (animation), it's usually just gobs and gobs of matrix math, just like the benchmark you linked to! Fortunately for us, however, that type of processing CAN be done in a Worker, and all we need to communicate back to the main thread is the data required to render the scene.
Yes, this introduces some challenges in terms of synchronization and data transfer, but on the whole it will be vastly preferable to locking up your browser while we try and simulate those 500 boxes colliding.
Yes, on Firefox!
https://hacks.mozilla.org/2016/01/webgl-off-the-main-thread/
We’re happy to announce WebGL in Web Workers in Firefox 44+! Using the new OffscreenCanvas API you can now create a WebGL context off of the main thread.
By default you can't use WebGL in a Web Worker as Toji explained.
You can check out WebGLWorker which is a library that lets you do WebGL stuff in a Web Worker, by transparently proxying commands to the main thread.
Here is a nice blog post that explains how it works.
I am triggering short sounds dynamically from the library for a game (Specifically Air for Android). When the user clicks a button the sound can take up to 600ms to actually play.
I have set it for any silence before the actual sound by calling the sound like so:
private var channel:SoundChannel = new SoundChannel();
private var buttonClickSound:Sound = new button_click();
public function buttonDownClick() {
channel = buttonClickSound.play(63);
}
Still getting a ridiculous amount of latency.
Things I have tried:
converting MP3 to wav
placing Sound Clip in the timeline
calling Sound Clip from urlLoader
All return the same results. I know there are threads here that talk about this but none have offered a real solution that I can find. Is there no way to cache the sound or store it in a buffer?
Thanks for looking.
Important update
The flash CS5 AIR for android functionality was never out of beta. And sadly as adobe is famous for, the functionality has been discontinued for flash CS5 so that the full working/updated version will become a selling feature for CS6 or CS5.5. I have many, many feelings about this as a customer who has spent literally MANY THOUSANDS of dollars on adobe products but I'll keep this about information and not my burning rage towards adobe feelings. For proof of this see:
http://labs.adobe.com/technologies/flashpro_extensionforair/
So it is most likely that this is one of many bugs left unfixed in AIR for android in CS5. This is not a surprise, as when I bought CS4 master collection which promised AIR 1.5, even AIR 1.5 was left broken and all bug fixes were rolled into 2.0, which was only available for CS5. One of the biggest bugs they never fixed in CS4 AIR 1.5 was a major, crippling bug in webkit which nearly rendered any use of webkit in AIR non-functional. In fact when I worked for Webkinz.com, a major project was completely thrown out the window and I was actually ridiculed for proposing using AIR, touting all it's amazingness and then left looking like an idiot in front of all my peers when these bugs appeared. Literally I'm not kidding the head of my 180+ developer division centered me out in a meeting around a gigantic table with every major player in that company.
Anyway perhaps my update did bleed into somewhat of a rant but it's good information I think and a good lesson to be learned, which is always assume the worst with Adobe products. Fortunately, as mentioned in my answer, it's not a dead end and there are ways around their "business model."
Original Answer
It's a bug in AIR for Android:
http://forums.adobe.com/thread/753977
That post is dated, but I've seen several more around the same time frame and enough that I'd call it a fact. Have you updated flash CS5? ( Go to Help->Updates). To be honest I don't even know if they have patched/addressed this bug yet but your best bet of finding out is to grab the very latest Flex SDK and try manually packaging your SWF into an APK using it. Instructions:
http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac25d3d8c712b2d86751e-8000.html#WS901d38e593cd1bac25d3d8c712b2d86751e-7ffb
More detailed/tutorial-like instructions:
http://thulasiramsoft.wordpress.com/2011/01/16/build-apps-for-android-using-as3-without-a-device-using-flex-air/
If this is a bug this is where you're going to see the fix appear first. Try packaging your SWF into an APK manually using the above methods and ensure you've updated the AIR for android on the device to AIR 2.6 (latest, just go to the market to update). This will either fix the problem or eliminate it as a possibility both on the compiler and runtime side.
Sound latency is a bug in Flash exporting to AIR.
Easy way around is to make some background music playing, then sound device doesn't go to sleep. If you don't want music you can make some silent sound playing forever. This solves the problem with sound delay for other short sounds.
[Embed(source="sfx.mp3")]
const snd_sfx:Class;
const sfx:Sound = new snd_sfx();
const SilentSoundTransform:SoundTransform = new SoundTransform(0);
function playSoundSilentlyEndlessly(evt:Event = null):void
{
sfx.play(0, 1000, SilentSoundTransform).addEventListener(Event.SOUND_COMPLETE, playSoundSilentlyEndlessly, false, 0, true); // plays the sound with volume 0 endlessly
}
playSoundSilentlyEndlessly();
I'm the developer of ShellShock Live, a free online artillery game:
http://www.newgrounds.com/portal/view/564049
Everything has been running smoothly, but every once in a while for a period of 4 hours or so, hundreds of "VerifyError: Error #1026" will show up in my error log. Then, they will stop.
I looked into VerifyError and found that "The VerifyError class represents an error that occurs when a malformed or corrupted SWF file is encountered." The SWF on Newgrounds is just small loader SWF that loads the full game SWF from another site, so there must be a problem there. I'm stumped, because the game will run fine for days, and then just start getting these errors out of the blue, after no changes to either SWF.
ShellShock has hundreds of players online at any given moment, so I would like to fix this ASAP. Any help would be appreciated! Thank you!
I know the original post is a couple of years old but since I've just spent many days trying to work around a similar issue, and since this thread does not contain what I believe is the correct explanation I'll post the conclusions of my own investigation here, for anyone else to use:
The VerifyError events are almost certainly being logged because the loader SWF on NewGrounds targets a lower Flash Player version than that of the game SWF that causes this error.
The Flash Player on the user's system will accept the NewGrounds SWF loader because it targets a version equal to or lower than the version installed. After that, an external SWF that targets a higher Flash Player version can be loaded without any complaint from the Flash Player, unless it tries to access unavailable features in that Flash Player, and then it will throw the VerifyError.
The sporadic nature of this problem, in 4-hour surges, is likely related to the different penetration of later Flash Player versions in different parts of the world (and hence different time zones). During very active periods of casual gaming (weekends and evenings?) in countries with low penetration of recent Flash Player versions you will likely see batches of these VerifyErrors logged.
The bad news is that after many days of trying to find a workaround for this very problem we have been unable to find any way to catch the VerifyError. It does not even get caught by an UncaughtErrorEvent handler!
The only thing I can suggest that might help in your case (not mine, unfortunately) is to determine the target version of the NewGrounds loader SWF (check the 4th byte in the SWF) then do one of the following :
Compile your game to target the same version of Flash Player as the loader targets. That way you can be sure that if the NewGrounds loader SWF is successfully loaded into the user's Flash Player your SWF will also work in that version without problem, or
In the initialization code of your game, check the Capabilities.version to determine the Flash Player version installed on the user's system and use that to branch control so that advanced Flash Player features are only used in appropriate Flash Player versions.
In my case I have access to the loader code, but not the code of the thousands of SWFs it loads. Since the external SWFs are stenciled into copies of the loader SWF as ByteArrays I can check the SWF's Flash Player target version byte (byteArray[3]), and compare it to the installed Flash Player 'major.minor' version obtain from Capabilities.version, but since SWF Flash Player target version bytes are (currently) incremented with every minor version increment of the Flash Player, it is impossible to map the SWF target byte (byteArray[3]) to future Flash Player 'major.minor' versions, until we know what the maximum minor version number of the current Flash Player will be.
Hope anyone else encountering this will have better luck than we did.
I think it may be a flash player error, try disabling any graphics acceleration or caching. It may be helpful to figure our what graphic card they are using.
Have you made changes to your socket server? Are you using like smarfoxserver?
I had this error in a very small project with cs3 flash9. So I was able to track this error down.
NOTE: this error is emitted incorrectly. The reason the error was emitted in my project was NOT because of a faulty swf because I do not import any swf into my project.
REASON:
I had a code line written like this:
_mc.my_counter && _mc.my_counter--;
SOLUTION:
I changed the line to this:
if(_mc.my_counter) _mc.my_counter--;
... and the verify error message was gone as fast as it appeared. Looks like this is a real as3 bug.