Who wants to hear a rant?!

EastboundEastbound Member, BASIC Posts: 1,074
edited November -1 in Introductions
I'm having a hell of time while working on my scrolling shooter game. I want to have a nice looking score, but I can't afford to waste actors for a font. I have to strip away Parallax scrolling backgrounds, because I need the valuable fps. Now I am having to limit the number of enemies to much lower than any shooter should have.

And then the loading times of these games! Why does it load so fast on the viewer, but take ages once built as a development or distribution model?

I'm sorry, and I really do love what you guys have done with GameSalad. Never did I think I could get a game on the iPhone so quickly. But god is it frustrating at times.

I warned it was a rant.

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    If you're using my demo for the score, it's not so much the number of Actors, as it is the Constrain Attributes. Currently each digit requires 1 Constrain.

    Those Constrains are what kill FPS.

    I am going to see if I can rebuild it using a less costly method.
  • JGary321JGary321 Member Posts: 1,246
    FMG: I heart you.
  • EastboundEastbound Member, BASIC Posts: 1,074
    Hah, no I wasn't using your example FMG, I experienced the FPS hit first hand when making Kill the King a while back. I did look at your example though and we used the same method, pretty much.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I rebuilt the demo to set the image using concatenation as opposed to having 10 separate Rules. It still needs a Constrain. I have a 5-digit score and on my 3GS, the frames rarely drop below 60 - even if I tap like mad.

    At the very least, I just eliminated 50 Rules that were getting checked every time.

    Your mileage may vary of course, but it seems pretty solid to me.
  • JGary321JGary321 Member Posts: 1,246
    Wow this new one is nice =)
  • quantumsheepquantumsheep Member Posts: 8,188
    I'm going to have to re-do my score aren't I? :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • EastboundEastbound Member, BASIC Posts: 1,074
    Wow that's awesome thanks Joe!

    I may be able to apply these techniques to other rules of mine to make them quicker.

    @joe: Just how much in your games do you seek out to shorten your code in similair methods? I'm sorry if the question sounds odd, but I'm wondering if you think or possibly notice a clear fp advantage?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    As much as possible. Yes, it is absolutely key!

    It's good programming practice everywhere, but especially on an iPhone.
    It's not terribly critical on a menu screen for example, but for core gameplay, it really helps...

    The major CPU hogs (that I've found) are these:

    Timers
    Constrains

    Rules, specifically the "exposed" conditions

    complex trig functions
    large images
    large sounds

    The first two, if out in the open, get checked ALL the time. It's best to hide them within Rules, so they only trigger when necessary.

    The processor checks at least the first condition of every exposed Rule.
    So if you have any Rule that uses ALL conditions (as opposed to ANY), it's a good idea to nest them, with the easiest to check condition on the outside. Take this example:

    Rule
    ALL
    When self.myCrazyAngle >= sin(cos(vectorToAngle(25,89)*self.Rotation/234.5678))/634
    When self.Alpha = 1
    When Touch is Pressed
    -----Play Sound

    In that case, you really don't want the processor doing that math EVERY single time, only to find out that Touch isn't even Pressed. A better way would be to nest those Rules so that the outer one is the easiest to check, followed by the more complicated ones inside. The outermost one is still going to be checked every time, but it's much easier on the CPU.
    Like this:

    Rule
    When Touch is Pressed
    -----Rule
    -----When self.Alpha = 1
    ----------Rule
    ----------When self.myCrazyAngle >= sin(cos(vectorToAngle(25,89)*self.Rotation/234.5678))/634
    ---------------Play Sound

    Complex trig functions - sometimes unavoidable, but something to watch out for

    Large images - try and make your graphics actual size. Don't scale them down. There's no sense having a 2MB image for a 32x32 graphic in the game. If the image does not contain transparency, make it an 8-bit PNG. This is critical for things like scrolling backgrounds. It's better to have smaller, tiled images than huge 1024 pixel ones.

    Large sounds - if it's not critical to your app, I would make the audio mono, and try to make the audio as small as possible. You don't want to be playing a 3MB SFX every time you fire a laser.

    Those are the basics, if I can think of any more, I'll post them.
  • CoreJayCoreJay Member Posts: 17
    Wow, that last post would be a great expansion for this Wiki how-to article:

    http://gamesalad.com/wiki/optimizing_for_iphone (Under Behaviors)

    I wouldn't have thought to nest the ALL rules like that. Good ideas!
  • firemaplegamesfiremaplegames Member Posts: 3,211
    at any rate, those are just my guesses... I'm pretty sure they are accurate, but I would confirm with the GS guys first...
  • EastboundEastbound Member, BASIC Posts: 1,074
    What sort of fps hike might I see when implementing all these?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Of course, it totally depends on your situation, but anything you can do to squeeze some fps from the processor is a good thing.
  • quantumsheepquantumsheep Member Posts: 8,188
    @Eastbound

    BTW, I enjoyed your rant! God knows I'm due one soon. I'll give you fives stars for yours if you give me five for my upcoming one ;)

    Cheers,

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    So, he can rant, but I am not allowed, eh? :-D
  • quantumsheepquantumsheep Member Posts: 8,188
    Oh you're allowed. Just not ALL THE TIME!

    Heh ;)

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    I am 41. I am an old sock. Old socks rant all the time... :-P

    In two years I start to pull my pants up to my armpits :-D
  • JGary321JGary321 Member Posts: 1,246
    At least you'll get a Senior discount at restaurants
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    @Hunn - Now I see that you are just crotchety! That changes everything!

    Damn kids!
  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    My new hero

    http://twitter.com/shitmydadsays

    The guy is fantastic :-)
    He even gets his own TV series.

    I am trying to become like him :-)

    So my list of role models is extended:

    1. Carlos Mencia (I watched the other guys mentioned and no, they are not funny)
    2. Homer Simpson
    3. Twitter dad

    :-)
Sign In or Register to comment.