instance or objects? the best performance

Discussion and feedback on Construct 2

Post » Tue Mar 11, 2014 6:37 am

Colludium is right.

In WebGl rendering version WebGL can render the same textures numerous times once. Where as rendering of different textures requires more draw calls.

In C2; C2 treates one Sprite object and all the images as a single texture. So while you see the division of frames it is in fact better optimized for WebGL rendering. Where as different sprites are always rendering different image textures.

minimize the number of sprites as much as possible. In fact it's best to to creat the game with master Sprite's that are only pinned to gameplay objects. Used image sprites have collisions off, where as gameplay objects never render.

So it's always better to minimize sprite used. however C2 still needs to groups sprites by transfer size which is most of the time 2048.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Tue Mar 11, 2014 8:26 am

This is very interesting. I had wondered why some people took the approach of using a sprite object plus an invisible 'logic/mover' sprite...though, somehow it seems like using 2 objects versus 1 would have to be slower logic-wise, even if one is invisible and one has no cols. Guess I'll have to try and see... ;)

How does this work outside of WebGL, or has anyone tested it?
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Tue Mar 11, 2014 5:16 pm

@TiAm,

When I turn off WebGL on my 'little test' the draw calls cpu use for drawing the 99 instances of an object goes up to the same amount as required to draw the 99 different objects. Although I was generally aware of this principle before I must confess to being surprised that WebGL was so beneficial. If I get the chance later I'll try this on mobile chrome and see if there's any difference on a mobile browser.

So, if there will be no WebGL in the final product then there's nothing to be gained by going through the pain of trying to minimise the number of individual objects in a project - the only thing that can save cpu demand here is, as was already apparent, minimising the number of objects on screen.... Which is interesting to me because I already find that just by enabling WebGL on my old laptop (only 6 years old) the performance can sometimes become a bit choppy. So my personal policy has been to avoid WebGL when designing for a market that could be using older hardware.

Thanks @jayderu, some good advice there as always.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,205
Reputation: 43,832

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: A2D, paxto22, Refeuh and 3 guests