Android Frame Rate Slow (even with animation engine)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Android Frame Rate Slow (even with animation engine)
So I have made a relatively simple game for android, since the forums don't allow me to post links you can ask me for the source code, the only problem with it is the frame rate lag that is only present when the app is run on my phone. Is their a way to make the animation smoother. I have tried to put in this code to make it run smoother.
on preOpenStack
set the acceleratedRendering of this stack to true
end preOpenStack
but it seems that it has no effect, I have also implemented the animation engine (which is used in the gravity ball card) which smooths the animation on the computer really well but the lag on the android device is still as bad as before. Just so you know my android device is no slouch in performance its a nexus 5.
So what i really need is confirmation that live code can sustain a reasonable frame rate to look good on android devices, and if i should look for another animation engine, eg. Corona. Or maybe their is a way to implement it into live code.
Thanks for any help and suggestions. if you would like the source code I will provide it on request. kinda don't want the complete thing getting copied and stuff.
on preOpenStack
set the acceleratedRendering of this stack to true
end preOpenStack
but it seems that it has no effect, I have also implemented the animation engine (which is used in the gravity ball card) which smooths the animation on the computer really well but the lag on the android device is still as bad as before. Just so you know my android device is no slouch in performance its a nexus 5.
So what i really need is confirmation that live code can sustain a reasonable frame rate to look good on android devices, and if i should look for another animation engine, eg. Corona. Or maybe their is a way to implement it into live code.
Thanks for any help and suggestions. if you would like the source code I will provide it on request. kinda don't want the complete thing getting copied and stuff.
Re: Android Frame Rate Slow (even with animation engine)
Did you also set the layermode of each moveable object to "dynamic"? Without that, the image will not be cached.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android Frame Rate Slow (even with animation engine)
You sir are a god!!, works so much better now thank you so very much, no lag what so ever. The reason I wasn't looking into caching the image because I read somewhere that it automatically cached it but oh well! you fixed it now. Now i can work on building this Gamejacque wrote:Did you also set the layermode of each moveable object to "dynamic"? Without that, the image will not be cached.

Re: Android Frame Rate Slow (even with animation engine)
I have one more question, when animating from one card to another, the lag is still present. To avoid this would I make every object on the next card and the current card dynamic? or is there another setting that I should change to get better results. (maybe not use multiple cards just animate menus into and out of the current card?)
I am sure that this will be the last question i will ask on this post (hoping for the best)
I am sure that this will be the last question i will ask on this post (hoping for the best)
Re: Android Frame Rate Slow (even with animation engine)
I should clear up the bit about caching. The engine does automatically cache the images on a card when the card opens. The dynamic layermode setting forces an additional type of caching so it can quickly redraw only the parts of the image that have changed (which happens when you move it.)Drago2308 wrote:I have one more question, when animating from one card to another, the lag is still present. To avoid this would I make every object on the next card and the current card dynamic? or is there another setting that I should change to get better results. (maybe not use multiple cards just animate menus into and out of the current card?)
Since card images are automatically cached before the card opens, setting a dynamic layermode on non-moving objects is pointless, and may actually slow things more. I've never had issues with lag when opening cards containing static images so there is probably something else going on in your scripts. What are the commands you use to go to another card? Is it more than just "go card x"? Do you have any preOpenCard handlers that take a long time to execute? How many images are on the card, and how large are they in bytes?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android Frame Rate Slow (even with animation engine)
I currently have 5 images on the second card, (most are graphics with images attached that are loaded in from another stack) the 5 images combined are a total of 11 kb which is hardly anything( I think), the command to go to the next card is "jacque wrote: Since card images are automatically cached before the card opens, setting a dynamic layermode on non-moving objects is pointless, and may actually slow things more. I've never had issues with lag when opening cards containing static images so there is probably something else going on in your scripts. What are the commands you use to go to another card? Is it more than just "go card x"? Do you have any preOpenCard handlers that take a long time to execute? How many images are on the card, and how large are they in bytes?
visual effect push left
go to card "window 2"
"
the visual effect might be the thing that causes the lag.
To add i have one openCard handler which loads the AnimationEngine. There was lag before this. but there is no preOpenCard handlers.
Re: Android Frame Rate Slow (even with animation engine)
Hi Drago,
"visual effect" requires a slightly different syntax, maybe that is the problem:
...
lock screen for visual effect
go to card "window 2"
unlock screen with visual effect push left
...
Best
Klaus
"visual effect" requires a slightly different syntax, maybe that is the problem:
...
lock screen for visual effect
go to card "window 2"
unlock screen with visual effect push left
...
Best
Klaus
Re: Android Frame Rate Slow (even with animation engine)
Hi Jacqueline,
keram
Do I have to to do the same for objects (images) that do not move but are resized, like 'zooming' in or out?jacque wrote:Did you also set the layermode of each moveable object to "dynamic"? Without that, the image will not be cached.
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: Android Frame Rate Slow (even with animation engine)
Any object that requires rapid redraws needs it. Moving objects have to be redrawn repeatedly as they change position on the screen. If your zoom is scripted and the rectangle changes rapidly, then that object needs to be redrawn each time the change happens. So, probably yes.
Objects that just sit on a card (like most background images or other static elements) and which rarely move, don't need to be dynamic. An occasional change of position that happens only once in a while doesn't need to be dynamic. For example, changing the rectangle of a field to accomodate new text is a one-time operation and requires only a single redraw. It isn't dynamic.
The best way to know is to try it. If a static object moves in jerks, it needs to be dynamic. Otherwise leave it set to static mode.
Objects that just sit on a card (like most background images or other static elements) and which rarely move, don't need to be dynamic. An occasional change of position that happens only once in a while doesn't need to be dynamic. For example, changing the rectangle of a field to accomodate new text is a one-time operation and requires only a single redraw. It isn't dynamic.
The best way to know is to try it. If a static object moves in jerks, it needs to be dynamic. Otherwise leave it set to static mode.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com