Better to use multiple layouts or many layers in one layout?

0 favourites
  • 5 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • A performance and basic structural question: Is it better to use multiple layouts or many layers in one layout?

    Example:

    One layer with 5 layers. Turning layers on and off (visible/invisible) according to a variable value (0-5)

    OR

    Five different layouts directing to that layout depending to a variable value (0-5)

    FYI: The basic content (text and graphics) would be basically the same.

    Suggestions.

  • If you don't need it then don't put it in the layout. Everything is loaded into memory at the start of the layout even if the object images are invisible. Multiple layouts might be better for your game, or rather than invisible, destroy the objects and unload them from memory.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So you are saying that multiple layouts will NOT burden down the performance UNLESS they are called? Correct?

  • Yes correct. Only the images for the current layout that you are on are loaded into memory. If you go to the next layout then anything not in use from the previous layout is unloaded etc. Only the current layout matters.

  • Also, keep in mind that anything you have set to global is created for the duration of the game once it is created unless you specifically destroy it.

    For example. Drop a button and a text on a layout. Create another layout and drag the same button and text onto it. Have the button on layout 1 go to layout 2 and have the button on layout 2 go to layout 1.

    If you run it in the debugger, and expand the trace for the text object, you'll see that when you click the button to switch layouts, it creates an 'instance' of the text for each layout and destroys it when you switch layouts so that only one instance of the text exists at any one time even though you have it on 2 layouts.

    If you set that text to global though, it still creates a new instance when you switch layouts but doesn't destroy the one from the previous layout so you end up with two instances, just different UID's.

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