Loop Behavior vs Constrain Behavior
jamie_c
ImagineLabs.rocksMember, PRO Posts: 5,772
In my new game I have been using the new Loop Behavior to continually Change an Attribute to a new value and it works the same as using a Constrain Attribute. Is anyone else doing this? Are there any opinions on which practice might be 'better' in the sense of easier on the engine and performance?
I've never had an issue with too many Contraints but just thought I'd try something different and it also seems to me to be more correct in a programming sense to use Loops.
Comments
@jamie_c, just did a test, since something similar was asked somewhere else.
Surprising new results! Different from what it was sometime pre v10.4
That means, 1 update every draw call except for timers which cycle once every two draw calls.
Same test with 60 of each caused NO loss in performance!
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch, cool. Thanks for the detailed stats, very good to know!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
They are functionally equivalent for the case you described. Constrain will be slightly more efficient in CPU time and memory, but it would probably take a lot of instances before the difference is noticeable.
@TaoOfSalad, great, thanks for the info.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Did you test them with 60 actors or all 60 behaviors in one?
I tested 100 constrains in one actor and I'm getting around 18 updates (game loops) per second on iPhone 5 and 30 on my mac.
100 change attributes in a loop behavior got 51 on iPhone 5 and 60 on Mac.
So if you have multiple constrain attributes in one actor, you should group them using the loop behavior where possible.
@Manto1, absolutely, as each contrain is like a mini rule or timer. However, my test was performed with 60 individual constrains, loops, etc.
@jamie_c, I did some more tests,
only by spawning and destroying 30 actors every draw cycle could I get the frame rate to drop a little.
Adding 10 particle system, with 500 particles each (particle lifetime 10s) made no impact on frame rate.
GameSalad kicks a**!
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch, yeah I'll say. Thanks for taking the time to do the testing, good information for us all!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Point is, adhere to optimisation strategies, but don't treat GS like some fragile egg.
In response to another thread (someone switching to another tool) I threw something together, recreating the mechanics in GameSalad in about 4 hours. I will compromise quite a lot for this kind of development speed, but then again, if the end result is almost the same...?
Rebel Twins, your game is FANTASTIC!, and no, this is not a template in the making. This is more to show that what you created is less about the tool than your artistic skill and attention to detail.
@jamie_c, the structures in the levels above get spawned from tables to facilitate an endless runner with no loading screens.
Again, not an upcoming clone, just my usual messing about!
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
How did you do this test? I want to do it too..