Families as a WebGL optimization technique? (Answered: NO)

0 favourites
  • 3 posts
  • Hi guys,

    So I noticed that you can set effects and behaviors on families. Does this have a similar effect as mention on the performance tips page in regards to putting things with the same effects on the same layers?

    [quote:2it7mfhz]3. Place objects using the same blend modes or effects on the same layer. For example, if you have a lot of objects using the Additive blend mode (commonly used for explosions, lasers and other effects), make sure all those objects are placed on their own layer. Also make sure they are created on that layer if the objects are spawned or created at runtime. Switching between effects can reduce performance, and doing this will ensures all objects using the same effect are drawn at the same time. This is described in more detail in the blog post How the Construct 2 WebGL renderer works.

    ~https://www.scirra.com/manual/134/performance-tips

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, it doesn't matter whether anything is in a family, it only matters what is drawn and in which order. For more information see this blog post on the WebGL renderer.

  • Ok thanks. I see how it's purely about Z order. Well at least families can make managing objects that use the same effect easier. I have quoted the relevant information below for others.

    [quote:6j5sw958]The key is to make sure wherever possible objects with the same texture, opacity and blend mode appear consecutively in the Z order. A good way to do this is simply to organise everything in to layers. In the previous example, if SpriteA and SpriteB are all on the same layer, they could easily end up in mixed Z order and end up with the long batch. However if SpriteA is only ever created on Layer 1, and SpriteB is only ever created on Layer 2, then they will always be together in Z order and the renderer can keep the same texture set while rendering each layer. Of course, this may affect the display of your game, animations might mean the objects are showing different textures anyway, and the batch can still be split up by changing blend mode or opacity. So this is not always easy to achieve.

    Similarly, putting objects with the same blend mode on the same layer allows the batch to reduce the number of "set blend mode" commands. The Space Blaster example puts all objects with "additive" blend (various explosions, lasers etc.) on the same layer. This means that layer can always be rendered with a single "set blend mode", avoiding the possibility of having a batch full of commands alternating back and forth between "additive" and "normal". For the same reason, you might want to avoid giving every object a different opacity (e.g. assigning a random opacity to lots of objects).

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