Constrain Attribute - My Friend, My Arch Enemy
Rattlehead
Member Posts: 485
Dear GameSalad,
RE: Constrain Attribute Behavious
Oh, how I love you... you make it easy to continually update values without much effort. Happily populating global variables that make the various cogs of my game go 'round.
Oh, how much I hate you... while easy and without complaint, you also choose to drive the performance of my game six feet under with no mercy and bring those same cogs you so lovingly are a part of to a halt.
*sigh*
I know this has been discussed many, many times before but I am still struggling to understand what is (really) going on under the hood in parts of the GameSalad toolset. If you look at the description for this behaviour in the help section, it really doesn't amount to much.
All I want to understand is what it is really doing...
What is causing it to crater the performance once it is on the device?
Are there guidelines for how many constrains should be running at any given time?
Are there alternate methodologies to my friend/enemy Constrain Attribute that can be used?
Are there ways to optimize a game heavily laden with Constrain Attribute?
Are there plans to look at ways at optimizing it under the hood?
If I were to compare it to what I would do coding it by hand, I can't see it doing more than variable assignments (=) on every clock cycle. But there has to be more... Is GS storing them in something funky like a hash table or dictionary which is cratering performance through read/writes?
ARGH!
It just seems every time I get a game almost to completion, things like Constrain Attribute - which seems sooooo freaking useful - put my plans on hold or force me to work on something with reduced logic or scrap it altogether.
If someone from the GS team could shed some light on this topic, perhaps one day I can reconcile with my (sometime) friend Constrain Attribute...
Sincerely yours,
Devastated-in-Calgary
RE: Constrain Attribute Behavious
Oh, how I love you... you make it easy to continually update values without much effort. Happily populating global variables that make the various cogs of my game go 'round.
Oh, how much I hate you... while easy and without complaint, you also choose to drive the performance of my game six feet under with no mercy and bring those same cogs you so lovingly are a part of to a halt.
*sigh*
I know this has been discussed many, many times before but I am still struggling to understand what is (really) going on under the hood in parts of the GameSalad toolset. If you look at the description for this behaviour in the help section, it really doesn't amount to much.
All I want to understand is what it is really doing...
What is causing it to crater the performance once it is on the device?
Are there guidelines for how many constrains should be running at any given time?
Are there alternate methodologies to my friend/enemy Constrain Attribute that can be used?
Are there ways to optimize a game heavily laden with Constrain Attribute?
Are there plans to look at ways at optimizing it under the hood?
If I were to compare it to what I would do coding it by hand, I can't see it doing more than variable assignments (=) on every clock cycle. But there has to be more... Is GS storing them in something funky like a hash table or dictionary which is cratering performance through read/writes?
ARGH!
It just seems every time I get a game almost to completion, things like Constrain Attribute - which seems sooooo freaking useful - put my plans on hold or force me to work on something with reduced logic or scrap it altogether.
If someone from the GS team could shed some light on this topic, perhaps one day I can reconcile with my (sometime) friend Constrain Attribute...
Sincerely yours,
Devastated-in-Calgary
Comments
They are not as good as Change Attribute which is basically assignment as it does no monitoring of the right hand side of the equation.
I get very good performance out of Constraints because I am very careful to put simple and not frequently updating values in the constraint's source. If you have a very complex equation it's better to do the whole equation in one expression than to break it down into multiple constraints each assigning to a temporary variable.
Put a rule around constraints that determines when they need to fire so that they don't fire constantly.
At the moment I'm liking: When 0 (an attribute i make) = (self.time*20)%2.... do stuff.
Higher multiples of the self.time for more constant attribute changes of course.
It doesn't work great for smooth character movement but for other stuff it's useful.