Quick question on Visibility

Get help using Construct 2

Post » Tue Feb 28, 2017 4:10 pm

Does anyone know if Sprites with Visibility hidden still renders, same as a sprite with 0 opacity.

I'm trying to locate a slight performance drop, and wondering if it could be pretty large UI elements with Visibility hidden.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Tue Feb 28, 2017 4:37 pm

Invisible means its is not rendered.
They should have little performance impact as long as they are invisible, and not moving.
You might get a drop when they are made visible however.
Btw 0 opacity means nothing to cpu performance. It's the same as 100 opacity.
Image ImageImage
B
168
S
50
G
163
Posts: 8,221
Reputation: 105,061

Post » Wed Mar 01, 2017 11:15 am

newt wrote:Invisible means its is not rendered.
They should have little performance impact as long as they are invisible, and not moving.
You might get a drop when they are made visible however.
Btw 0 opacity means nothing to cpu performance. It's the same as 100 opacity.


Thanks, I'm trying to pinpoint something causing my draw calls to shoot high occasionally. Even when nothing is seemingly moving and nothing animated is on screen. Clean project doesn't have the problem, so I'm clueless of what it could be.

Although
I'm using a lerp quite a lot, both on objects and on the camera so maybe it could be some objects or the. Checking the Debug, i can see that they are counting down to infinitely smaller and smaller decimal points.

Might be the cause, but how do i stop the lerp from counting?

Example of lerps i'm using.
lerp(Self.X,Object.X,0.03) to get a smooth eased movement...

Maybe there is some better way to ease movements, that doesn't count to infinity?
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Wed Mar 01, 2017 12:12 pm

Pick the 'self' & that 'object'
Compare 2 values .... distance(Pickedself.Y,Pickedself.Y,Object.X,Object.Y) ... > ... 2
______ lerp (dt corrected)
B
33
S
18
G
27
Posts: 2,440
Reputation: 20,344

Post » Wed Mar 01, 2017 2:30 pm

99Instances2Go wrote:Pick the 'self' & that 'object'
Compare 2 values .... distance(Pickedself.Y,Pickedself.Y,Object.X,Object.Y) ... > ... 2
______ lerp (dt corrected)


I've tried that but that wasn't really an optimization (for a lot of objects) as it's constantly comparing distances every tick, which seemed to be heavier than just leaving it as it is. There must be a smarter way to limit the amount of decimals.... i don't want all those lerps running in the background all the time.

maybe...
round(self.x) ≠ round(object.x)
round(self.y) ≠ round(object.y)

So if both of their rounded X & Y positions are not equal, lerp can bring them closer until their rounded values match.

Should be less heavy to check than distance hopefully. Have to try it out when i get back home from work.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Wed Mar 01, 2017 3:05 pm

If something moves at x pixels per second then you can figure out how long it will take to get there if you know the distance there.

Add a timer behavior to change a boolean variable.
Image ImageImage
B
168
S
50
G
163
Posts: 8,221
Reputation: 105,061

Post » Wed Mar 01, 2017 3:10 pm

newt wrote:If something moves at x pixels per second then you can figure out how long it will take to get there if you know the distance there.

Add a timer behavior to change a boolean variable.


Nono, that's not really what I'm after. I just want to stop all the lerping running in the background when they are close enough to see if that's the thing causing some performance issues.

Imagine like 40-50 different objects moving subpixel amounts all the time, because lerp never stops when you use. lerp(self.x, object.x, 0.03) object keeps moving but smaller and smaller subpixel movement every tick.

It's both causing draw calls when everything is seemingly not moving, and ticking away in the background.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Wed Mar 01, 2017 3:16 pm

variable canmove=1 object set position to lerp(newpositions)

On timer set variable canmove to 0
Image ImageImage
B
168
S
50
G
163
Posts: 8,221
Reputation: 105,061

Post » Wed Mar 01, 2017 3:19 pm

newt wrote:variable canmove=1 object set position to lerp(newpositions)

On timer set variable canmove to 0


I'll try that too, I just need to stop all the subpixel movements going on.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Wed Mar 01, 2017 6:44 pm

@tunepunk

Ya know what they say, measuring is the only knowledge about c2 performance.

https://www.dropbox.com/s/42m3rbnlg23cp ... .capx?dl=0

I think that the distance check wins.
I did not expect that 'moving invisible objects' has almost no effect on performance compared to 'moving visible objects'.
B
33
S
18
G
27
Posts: 2,440
Reputation: 20,344

Next

Return to How do I....?

Who is online

Users browsing this forum: digitalsoapbox, staltux, Yahoo [Bot] and 3 guests