Whats the best way to optimize my game for top performance.

TWEAmazingAppsTWEAmazingApps Member Posts: 219
edited June 2012 in Working with GS (Mac)
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

  • domeniusdomenius Posts: 108
    edited June 2012 Accepted Answer
    I 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.
  • KiwiLeeKiwiLee Posts: 181
    Accepted Answer
    And 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

  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius lol thank you I was just reading that!
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius I want to ask, how exactly would you use the timer for animations? would you do it by change picture? Or how did you implement that for best use. I have alot of animations so I would like to know exactly how you did it that helped you. Thank you so much.
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius Wow ok thanks I am going to give this a shot.... with my...many...animations hahaah
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius So i am guessing that self.frame is a integer?
  • domeniusdomenius Member Posts: 108
    @domenius So i am guessing that self.frame is a integer?
    Yes, your frames also have to be numbered sequentially, but most people do that anyways.
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius So i am guessing that self.frame is a integer?
    Yes, your frames also have to be numbered sequentially, but most people do that anyways.
    mmm if thats the case is there anything else that I have to do with mod1 other than creating it unless I am reading it wrong for me I am not seeing the change of image. Tho I could have made a error which is probably what I did.... instead of it changing pictures it disappears.

  • domeniusdomenius Member Posts: 108
    Mod1 can not be equal to 0, change mod1 to 0.05 and it'll work.
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius Ha.. nice I see what I did wrong. I typed the word self.frame XD I didnt realize that till I opened the expression editor. Ok so it works like a charm! Thank you. So if I want more animations I would just make a rule stating that if self.frame =/= 9 then I would go to the otherwise and put 9 change attributes of self.image to the name of it then..self.frame? Thank you!
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius ok so I created rules that state with self.frame = 1 then
    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?
  • domeniusdomenius Member Posts: 108
    Do you have an otherwise section on the frame=/= 9 resetting frame back to 1? A screen cap of the rule might help...
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius hmm no? Ok ill put up a screen shot.
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius Wana do join.me? my join.me number is 388-327-044
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius I think it would be quicker if we did it that way :)
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    @domenius Ok nvm I got it down! I messed with it abit when you said to put a otherwise for the frome =/= 9 section. I put a rule in the otherwise stating that with self.fram = 9 then change attribute self.frame to 1 and it works great! now Thank you so much for your Help!!
  • domeniusdomenius Member Posts: 108
    Awesome, glad to hear you figured it out.
  • vikingviking Member, PRO Posts: 322
    Hey guys,

    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?
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    Thank you!
Sign In or Register to comment.