Making game faster -sluggish gameplay after ad hoc tested

ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
edited March 2012 in Working with GS (Mac)
Hi guys

Yesterday I make a adhoc version of my first major game to test on my iPhone. I gave the latest Os 5.1 and also bought Lion do the the Xcode part worked....all ok so far.

When I switched my phone back on and started to play my game, the graphics were so sluggish it was terrible.

When I built it I used the right size gfx rules and if a graphic is not to be used I turned visibility off and if it was not to
Move I turned off 'Moveable' in the physics part.

My question is...are there any other good tips to help save memory and processing power as it works fine in Gamesalad but not too well on my iphone4 with OS 5.1.

Thanks guys

It takes a Zombie to know a Zombie!!!

Best Answers

  • MotherHooseMotherHoose Posts: 2,456
    edited March 2012 Accepted Answer
    optimize your images:

    ImageAlpha
    ImageOptim
    both are free and work wonderfully
    do with the contents of the gameProject's image folder
    (right-click on the projectFile > Show Package Contents > images )

    devices have less resources than your desktop computer.
    uncheck all preload art …

    use a changeAttribute behavior: self.Image … rather than a changeImage behavior
    (seems that changeImage behaviors load the image at scene load)
    use Graphics: Flip Horizontally/Vertically instead of the two separate images for an actor

    try to use the same actors over again
    EX: one background actor
    that you drag to each scene
    and do something like change the instance name to the image name for that scene
    then add as first behavior: changeAttribute: self.Image To: self.Name

    use tables to store values/parameters (imageName; Width; Height; X; Y; etc.) of your actors
    better 10 tables … which are just data references … than 10 rules on each actor

    good that you want your game to be the best it can be! … @Zombiebrains

    image MH
  • scitunesscitunes Posts: 4,047
    Accepted Answer
    The other things that hurt frame rates are the number of movable actors in a scene, the amount of constrains used, and the amount of timers running. In my experience the number of moving actors seems to cause the biggest problems and if those moving actors each have constrains or timers in them you can get into all kinds of trouble. I always try to find ways to recycle actors. So in a platformer you could have bad guys set up so that instead of 50 bad guys placed in the level as instances you only put the amount in that will be on the screen at the same time. Then when a bad guy leaves the screen you use a change attribute behavior to move the bad guy further along in the level. To the player it will seem like a new bad guy but it will allow you to have fewer moving actors in the scene.
  • scitunesscitunes Posts: 4,047
    Accepted Answer
    Try removing the actors that you think are causing the problems and see what effect it has. That will help you find your culprit.

Answers

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Thanks MH

    I will look to make some of those changes and let you know if things improve!

    ZB

    It takes a Zombie to know a Zombie!!!

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Thanks for that useful info Scitunes

    I do have a few actors in my scene which I have spawned actors on a timer, this is to create a cool shadow snake effect...I will have to look at a different was of showing that as I suspect they are to blam for my very poor frame rates.

    It takes a Zombie to know a Zombie!!!

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Yeah, I have a few ideas on the culprit.

    I have these cool rainbow effect spawn actors. I also have a triple parallax starfield with multiple actors being generated and I think I forgot to say after the sprites are off screen to destroy them so that might be one thing...

    A question...what difference does it make with ticking or unticking 'Preload image'option?

    It takes a Zombie to know a Zombie!!!

Sign In or Register to comment.