[Optimization] Overriding or сreating objects

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi. I would like to hear advice from you ... There are infinite levels, which are generated by objects in the environment. Will the game run faster if you create objects in advance and simply change their position, and not to create each time new and delete old ones? After creating objects also takes performance and change the position of old objects correctly?

    P.S. Sorry for my english ...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Creating/destoying objects gives you better performance. Could you rephrase your last question.

    Cheers

    Sophia

  • Hi. I would like to hear advice from you ... There are infinite levels, which are generated by objects in the environment. Will the game run faster if you create objects in advance and simply change their position, and not to create each time new and delete old ones? After creating objects also takes performance and change the position of old objects correctly?

    P.S. Sorry for my english ...

    When you load a layout with all the objects already, the performance is better than creating in a runtime. I think you only need to have them outside the layout and, on start of layout, destroy it if necessary. So, in your case, I'd keep all objects at the moment of layouts loading and then let the events do the rest.

    See:

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

    [quote:1ghq9ozv]Not placing all used objects in the layout

    If objects are not placed in a layout but are created by events, Construct 2 will load the textures for those objects the moment you create them. This can cause a momentary pause or "jank" and make the game feel less responsive. This can be avoided by placing any used objects in the layout. They can be placed off-screen and destroyed on startup to avoid interfering with the gameplay. Then Construct 2 will preload all their textures when the layout starts, avoiding any "jank" as they are created and destroyed at runtime.

  • kossglobal, thanks!

  • marsep If you have your objects just off screen on the first level ( be careful not to place all in your game if you have a big game ) Construct 2 will load these ( even if you right away destroy them ( on start of layout: Destroy ) ) so the next time you use the create object command and use one of those objects its already loaded it so the slow down will be minimal. It does however mean that it loads them all in as the level starts so maybe have a fade in screen or a slight load screen when the level first begins to give it time before they start playing.

    Regards

    Joel

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