Whats the best way to optimize my game for top performance.
TWEAmazingApps
Member Posts: 219
Hello everyone. My question is "whats the best way to optimize my game that has animations and moving actors for best performance?" Any tips!? Thanks you!
Best Answers
-
domenius Posts: 108
-
domenius Posts: 108I do my animations like this:
if mod1>self.time%0.1
change attribute self.frame to self.frame +1
change attribute self.image to "name_of_image"..self.frame
That will result in a 10FPS animation. Adjust the self.time% to change FPS (ex. 0.05 would be 20FPS)
If you need a looping animation, just wrap that logic in a rule that states if self.frame =/= (maximum frame), then place rules self.frame = 1 and update the frame in the otherwise section.
Funny enough, I was just working on a stress test that compared animation vs timer vs math and has the code to do timer animation within. I may throw it up on that main thread as an example when I got it done. -
KiwiLee Posts: 181And this too..... As always application performance whether it is on a mainframe, PC Servers or a gamesalad based runtime... There is never one silver bullet that solves performance.....
http://forums.gamesalad.com/discussion/54045
Answers
self.image to (name of image)..self.frame. So I did that and put them in the otherwise and it works for a seconds but it dosent loop am I doing something wrong? I also created a rule over the whole thing saying self.frame =/= 9 . Am I doing something wrong?
I am using self.time to animate in my game and I have finally found a way to run my animation at 60 FPS, which is awesome! I was unable to run any faster than 25 FPS using the Animate behavior. However, there is one issue and I was wondering if you have experienced the same, or found a solution. When I use Animate the animation runs a steady 25 FPS from the first play through and for every play through thereafter.
When I use self.time to change attribute self.image at every frame, my first play through is running at about 20 FPS and then every play through after that runs at 60 FPS consistently. My low-tech solution was to change my actor's alpha to 0, play the first play through in the background while I show some text on the screen, after a few seconds I change the alpha back to 1 and then play every animation at 60 FPS from then on. (By the way, I ran a test that shows that I animate 78 frames in 1.3 seconds, which means that the elusive 60 FPS is mine!)
I assume that GS "loads" the animation data during the first play through and then keeps it in memory after that, which is why it runs smoothly after the first play through. Any thoughts about this? Any other solutions?
http://forums.gamesalad.com/discussion/46652/31-optimization-tips/p1