Animation & Game Frame Rate Not Smooth

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
LoopThatRoutine
Posts: 2
Joined: Sun Dec 16, 2012 3:19 am

Animation & Game Frame Rate Not Smooth

Post by LoopThatRoutine » Sun Dec 16, 2012 3:30 am

Hello All,

This is my first post so hope it makes sense!

Okay so I am at the point where my game application is almost complete, however i have run into a few problems which are irritating me now after a whole lot of research with no avail...

So my problem is effectively smoothness, I have terrain moving on the background, a player and enemy set up, I cant get the app to run smooth on the tried devies 3GS, 4,4s, 5 etc
The PNG files loop through the animation both for player and enemy but not at the desired speed, i had trouble with load times but that is now sorted.

My Game works fine just majorly slow and jerky, wasn't sure on how to use AE properly and havent had the time to study the literature but AeMove sounds interesting.

So basically to sum it up, if anybody could be so kind on any tips regarding smoother animations and maybe a way of handling the frame rate of the game i would be very grateful.

Hope it makes sense

Cheers

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: Animation & Game Frame Rate Not Smooth

Post by paulsr » Sun Dec 16, 2012 4:21 am

Try:

Code: Select all

on preOpenStack
   set the accelleratedRendering of this stack to true
end preOpenStack
HTH

--paul

LoopThatRoutine
Posts: 2
Joined: Sun Dec 16, 2012 3:19 am

Re: Animation & Game Frame Rate Not Smooth

Post by LoopThatRoutine » Mon Dec 17, 2012 12:47 am

Thanks, have tried this segment and it doesn't seem to adjust any performance speed on the devices?!

I have that run in the preopenstack section and then have cards load accordingly, when the game is running it seems to be held back by some functions I think? Been working on this for a while. Is livecode capable of handling a lot of calls and functions at once? I assumed it did until Device testing started.

Cheers

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Animation & Game Frame Rate Not Smooth

Post by sturgis » Mon Dec 17, 2012 1:54 am

There is probably optimization that can be done. Also, if you base your frame updates on time rather than always doing "1" frame when your updatescreen ticks over you can more easily handle small lags here and there.

Have you set your backgrounds and any moving objects to dynamic?

If you use any repeat loops, those can often be optimized.

Does it seem to lag when the screen is touched several times? If you're doing this using "the mouse is down" (ok, checking to see if there is a touch) rather than catching "touchstart" (I think thats how the game academy does it, would have to look at my code) then there can be "stutters" when you touch the screen especially if there are several touches.

The easiest way to handle the stutter problem (again, unless you actually need to use "touchstart") is to put empty touchstart handlers in the card script. Otherwise, you touch, it looks in the card, then the stack, then goes on up the line to the engine looking for something to handle the touchstart message. If you place an empty handler at the card level some time is saved because the touchstart message stops there rather than going on along the message path.

Can you post your code?

scotttyang
Posts: 125
Joined: Sat Jan 31, 2009 12:01 am

Re: Animation & Game Frame Rate Not Smooth

Post by scotttyang » Tue Dec 18, 2012 4:21 am

One thing I noticed about Livecode animation is to avoid using GRAPHICS EFFECTS, meaning drop shadows, outer glow, etc. If you want a drop shadow and you want to move your sprite, image around, then make the shadow in photoshop and bring it into Livecode. But don't use the native graphics effect in Livecode. Use the graphics effect of livecode for stationary objects. Also avoid alot of hidden graphics, images on the card. Instead of having 10 different hidden backgrounds, just have one and if need another image call it from another card...eg. put image "a1" of last card into image "bkgnd"

Post Reply