Performance Tips

Discussion and feedback on Construct 2

Post » Mon Oct 06, 2014 1:37 pm

Direct to the point:

In terms of performance, what would be better, keep an object with opacity 0 and then makes it visible, or keep it out of the layout with a small size while not in use, and during the action moves it to the position correct and make the redimension?
B
12
S
3
G
1
Posts: 188
Reputation: 1,377

Post » Mon Oct 06, 2014 2:06 pm

Make the object invisible (not opacity 0, invisible), make it appear when needed.

However you could also just spawn the object when needed too.. this seems pretty much like micro optimisation unless you have an exemple
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Mon Oct 06, 2014 5:54 pm

Well, making it invisible or leaving it out of the layout I have the same performance? From what I read, even if not visible, the pixels are still processed and rendered.
And compared to these two cases, if I put the object in the layout, destroy it at the beginning and then do spawn the time it is needed, it would be less efficient or there would be no difference of the above cases?
I do not have an example because all I'm doing is studying about performance gains and good conduct when developing a game. Already read all the tutorials I found here about it, but now is the time to ask questions and try to do certain things in practice.
B
12
S
3
G
1
Posts: 188
Reputation: 1,377

Post » Mon Oct 06, 2014 6:29 pm

Invisible or out of the layout is actually the same. It's not being processed in the renderer. Hence same performance.
Spawning the object when needing, on the opposite, will have a hit on performances even if Ashley made a hell of a job optimizing garbage collection.

You probably should read the older blog articles, a lot is explained in there on C2's architecture, garbage collection, optimization, memory...
As for performance tips, this manual article contains what needs to be taken into account.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,332
Reputation: 71,306

Post » Mon Oct 06, 2014 6:53 pm

So basically, if I do several layers and leaving only one visible, the other will not interfere with the performance of the game? I suppose that applies to a sprite, is valid for one entire layer.
I had already read most of the links you passed, as said above (except the first, which I will read now). But I now want to ask everything possible so no doubt remain. XD
B
12
S
3
G
1
Posts: 188
Reputation: 1,377

Post » Mon Oct 06, 2014 7:46 pm

-dont waste your memory tutorial
-performance tips tutorial
-avoid layer if you use canvas2d
-enable / desable (physics,behaviors,collisions only when it is necessaire)
-use sprite font instead of sprite text (and set it when it is necessaire for example dont check score every tick update .... but update it for example when your player is on collisions with coins ot some goals
-avoid every tick on even sheet (like is on layer,every tick , compare variable ) and if you want use it use trigger once
-when you use set x or set y every tick , remember to use *60*dt
-dont use a lot of event
-use family and groups ;)

the last tips i discover maybe you will not be okay with my idea but if work for me is to optimize sprite and avoid transparencyof all game object ... for exampe for game title .... i use 2 sprite instead of 1 sprite with reducing transparency and some things like that .... and my cpu usage go from 19% to 14% and fsp is always 60 - 59 (58 at intensive steps) before it was between 51 to 59 ...

yes memory usage have impact on cpu and fsp

i waste all my time since these last 6 months to test and search about performance tips ... and all these were simply in ashley / aphrodite performance tips tutorial ....
B
47
S
16
G
8
Posts: 802
Reputation: 8,376

Post » Mon Oct 06, 2014 9:07 pm

How the layers may interfere with performance?
I do not see the layers as a big problem if I keep the actions related to the objects it holds, disabled while it is invisible.
But still, I would like to understand what layers might interfere with the performance?

And concerning:

"enable / desable (physics, behaviors, collisions necessaire Only When It Is)"

I did not understand the storytelling of this sentence. Should I avoid getting turning on and off?
B
12
S
3
G
1
Posts: 188
Reputation: 1,377

Post » Mon Oct 06, 2014 11:16 pm

You are worrying about the wrong things.

The things that matter are documented.
Scirra Founder
B
403
S
238
G
89
Posts: 24,654
Reputation: 196,145

Post » Mon Oct 06, 2014 11:47 pm

Yes yes, I understand that, actually, I just wanted some more specific explanation of the implications of the use of objects or layers kept as invisible in performance.
I know necessarily the number of layers or layouts not interfere with anything, but if I have many objects by layer or objects which occupy the whole screen and are kept as invisible, this leaves me with doubts in what may entail.
My doubt sounds dumb, but I'm just trying to lock it down, I have used to construct enough time guiding me with what I learned most of these tutorials, so I'm just clarifying this part.
So, this will not change anything in the performance? Unless, of course, I have some event running on top of one of these objects, or a behavior.

Ashley, Thank you for always showing interested in helping ^^
B
12
S
3
G
1
Posts: 188
Reputation: 1,377

Post » Tue Oct 07, 2014 11:32 am

As always, my answer is the same...

If you can measure a performance difference: yes, it matters
If you can't measure a performance difference: no, it doesn't matter
Scirra Founder
B
403
S
238
G
89
Posts: 24,654
Reputation: 196,145


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 14 guests