Who wants to hear a rant?!
Eastbound
Member, BASIC Posts: 1,074
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.
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
Those Constrains are what kill FPS.
I am going to see if I can rebuild it using a less costly method.
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.
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
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?
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.
http://gamesalad.com/wiki/optimizing_for_iphone (Under Behaviors)
I wouldn't have thought to nest the ALL rules like that. Good ideas!
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
Heh
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
In two years I start to pull my pants up to my armpits :-D
Damn kids!
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
:-)