Tricks to optimizing large scenes

TouchTiltGamesTouchTiltGames Member Posts: 1,162
edited January 2012 in Working with GS (Mac)
So Tiny Diggers is almost done and I'm trying to do as much optimizing as I can. One thing that is most important is obviously the amount of actors, what they're doing, spawning, not a lot of constrains, rules blah blah. I've got the scene setup so that actors will only animate when the main actor (truck) is near them, so it's a draw distance if you will. I'm not really sure if this is helping but what I was hoping to do was to only show the actors when the truck is near but I obviously don't want to use spawning....

Would:
A) moving the actors off-screen and moving them to their position when the truck is near work in optimizing?
B) Setting the actor's visibility to true when the truck is near help? Or would that be the same as spawing.
c) Setting their alpha to 0. I know the answer to this one is probably no.

Any other tricks to optimizing a large scene would greatly help!

Comments

  • simo103simo103 Member, PRO Posts: 1,331
    @TTG ... saw this fall to page2 so thought I'd post a few thoughts and maybe others will weigh-in to help also. I am only posting thoughts as I don't know for sure. I believe there are two optimizations that people focus on, one being loading times and then the other RAM/fps during gameplay. I don't think your A will help either of those. I saw recently that TSB posted he spawned some actors that I think he said were rule heavy and that helped load times and would also mean the engine isn't checking their physics all the time (until needed) .... so spawning might not always be a bad thing. I'm not sure you can do B during gameplay but in any case I don't think that would help as also with C.
    I think making sure your images and sounds are as small file sizes as possible will be one area you could look at (relook). Sorry not much but at least it gets the post bumped!
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Thanks simo, yeh spawning all my actors in a 30,000 px wide scene when needed MIGHT be better than just having them there. Theres only one way to find out.
  • imGuaimGua Member Posts: 1,089
    a) I think no
    b) you can't change visibility flag with rules
    c) no
  • MotherHooseMotherHoose Member Posts: 2,456
    edited January 2012
    A) no, the actors rules/behaviors/images are loaded in RAM when the scene loads
    B) that is not doable
    C) you can change the Alpha on the actor … so they appear invisible, but their image will still load in memory as Alpha = 1

    you can import a 2x2 transparent.png into GS
    when your actor is all set-up
    have it's first behavior: changeAttribute: self.image To: the correct image name that is in the actor's attributes section
    then drag the 2x2 into the image area of the actor (it will stretch to fit the W,H of that actor)
    when scene loads it will just load the little 2x2 in memory … and change the image attribute as soon as its starts

    spawners are only resource demanding when continuously spawning at timed intervals …(Every)
    to use a Control Actor off-screen for a one-time spawn of a bunch of actors in various location after the scene has been loaded is a good idea
    just use a Timer: After: 0.05 seconds … and that is very efficient especially when used with the transparent png

    @};- MH
  • gamedivisiongamedivision Member Posts: 807
    cheers motherhoose your a wealth of information
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @TouchTiltGames Are you talking about optimising frame rate of RAM usage?

    For good frame rates: I'm guessing you already do much of this but here's my general view...

    Whenever possible I try and use the most simple and 'manual' of rules. By that I mean I am trying to make it easy for the device CPU. I don't want to give it lots of complicated calculations to perform (if possible) and especially not all at the same time.

    So in the context of GS I'm using the 'change attribute' behaviour when ever possible. e.g if I can use 'change attribute>self>motion>linear>x' to get the effect I want I'll do that. Instead of using the 'change velocity', 'move' or' accelerate' behaviours which will probably involve larger calculations for the device.

    I think you've got the right idea with having your actors only move when close to the truck. As much as possible all rules should have specific conditions so that they are not constantly taxing the CPU. e.g you can wrap a set rules inside another rule so that the engine does not even have to bother checking through the entire set. It can just read the first rule, and if conditions are not met... no need to go looking through all those 'otherwise' rules.

    However I'm sure @codemonkey could clarify and confirm any questions regarding optimising in GS.

    Shaz
    _______________
    On the GS asset store: Rock Music, Pack 2
    Casual & Platformer Music, Pack 3
    Atmosphere Music, Pack 1
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Great thanks a lot guys, some great info here!
Sign In or Register to comment.