Difference between 0 Opacity and Invisable?

0 favourites
  • 13 posts
  • Does anybody know the performance difference between 0 opacity and Invisable?

  • 0 opacity still draws the object, which has an effect on performance, but nothing visually appears.

    Invisible skips drawing the object at all which is faster. So instead of setting 0 opacity, set the object invisible.

  • thank you

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley, would it be technically impossible to code objects as 0 opacity to be invisible?

    That just makes sense to me...

  • if object opacity = 0 : object set invisible

    else : object set visible

    That's probably how you could do it

  • It's based off how Classic did it. Since it's possible to write a shader that changed opacity 0 to something else (making the object visible), it should still be drawn so you can see the effect of the shader. However I'm not sure if there are any shaders which can actually do that. So it's kind of a philosophical point. If you mean "don't draw the object at all", make it invisible. Opacity 0 means "draw the object in such a way that (by default) it is not visible".

  • So, what are the performance differences between invisible objects and destroyed objects?

  • Invisible objects still take up logic performance, but a destroyed object does not.

  • Invisible objects still take up logic performance, but a destroyed object does not.

    If I have layers (such as menus or options) set to invisible, and basically inactive are the objects still using up resources?

    Say for example, the whole logic involving the objects on an invisible layer needs to be toggled by a boolean, would the fact that the objects are held ready to be set visible be using up resources?

    I am considering destroying all menus etc and programatically recreating them if needed, but don't want to do this unless necessary.

  • In addition, if I go to a new layout, but don't destroy all the objects, or make them invisible will they still be held in memory?

  • Sorry, to ramble on over several posts, but just to clarify, is the position, angle, size etc of an invisible object much of an overhead (specifically on slower android systems)?

    If I were to add an extra check for objects (as visible or invisible) would this save logical resources or just mean a whole load of extra checking, using up more resources? Also, if a layer is invisible, would the objects on it be marked as invisible if checked individually?

    Thanks

  • All objects are in memory, all the time. If not, you would suffer massive stuttering. However, when an object is invisible, you save ressources on all calculations (when an object is invisible, you don't have to worry about polygons collisions and all that, for example).

  • Nathan

    There are two issues here: rendering performance (the time it takes to draw it) and logic performance (the time it takes to process events, collisions etc. for the object). Invisible objects, or objects on invisible layers, don't take any rendering time, but their logic performance is unaffected - events obviously keep running for invisible objects!

    Trying to change your events to make it faster is usually pointless: I doubt you can measure any improvement at all changing your events to improve logic performance. Game performance is usually 90% the rendering performance.

    As for size/position/angle: the short answer is no, it doesn't affect performance. The long answer is it can if the rendering is software rendered, but usually software rendered platforms are not particularly usable anyway (they're too slow overall). On hardware-accelerated systems it makes no difference at all.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)