Objects not in view - affect perfromance?

0 favourites
  • 8 posts
From the Asset Store
94 Inside buildings views - Isometric view - PNG transparent - 2048x2048
  • Simple question.

    Do instances of objects that are not in the visible area degrade performance?

    i.e. if I had 5000 instances but 4500 were no where in sight do they still get tested for collisions etc?

  • The answer is "Yes". This was addressed in the beginner's "top down shooter" tutorial, page 3 (Found here - scirra.com/tutorials/37/beginners-guide-to-construct-2/page-3)

    Excerpt: "Destroy outside layout." Instead of stopping an object leaving the layout area, this destroys it if it does. It's useful for our bullets. Without it, bullets would fly off the screen forever, always taking a little bit of memory and processing power. Instead, we should destroy the bullets once they've left the layout.

  • See Performance Tips.

    All objects, even if not on screen, still run the logic (events, collision detection, etc.) A lot of games would be broken if this didn't happen! However rendering is usually the bottleneck, so usually it's not important that offscreen objects are still doing that.

    The beginner's guide tutorial's advice to destroy objects outside the layout is more to prevent a memory leak. If every bullet you ever fire is still active in the game, the game will gradually slow down and use more and more memory.

  • Thanks, that is what I wanted to know.

    I have set it up that objects passing to the left of the viewport are destroyed.This product seems amazingly optimised.

  • Ashley Is there any difference between an invisible object in the screen area,

    and a visible object off screen for rendering?

    Also, if an object is behind another (for example a large UI for the game), does this area get updated by the renderer?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • lemo - invisible objects are identical to offscreen objects. C2 uses a back-to-front renderer, so objects underneath larger objects are still rendered.

  • Okay thx for the details!

  • Sorry to relive an old topic, but something's been bothering me a little. I know it's a good practice to destroy objects like bullets when they leave the screen, but does it affect performance if I add the "destroy outside layout" behaviour to level objects, such as platforms, background trees and such? That's when making long, scrolling levels of course.

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