Sprite performance question

0 favourites
  • 4 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Like many others have in the past, I'm considering creating a random background with a single sprite object repeated randomly across a layout (think: starry sky).

    Is there any way to make a sprite object static, where the only thing it holds is essentially just an array of coordinates, and the only thing it updates is drawing those coordinates to the screen?

    It's my impression that all sprite objects have a whole bunch of extra stuff that gets updated, with a bunch of unnecessary checks for something that never moves or needs to be checked for collision.

    What kind of overhead would this produce? What's the solution with maximum efficiency?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The Construct 2 engine is well-optimised. A sprite with a single animation with a single frame (or an animation speed of 0) that does not move does no work other than copying its cached co-ordinates every frame. That involves a negligible amount of CPU work.

    If the object has more than one animation or more than one frame and the animation speed is above 0, the engine will process it every tick to run the animation. This also involves a probably negligible amount of work (it's very simple logic), but if you're talking about vast numbers of sprites, it might be something to be aware of. Note also if you change the animation speed so it's not 0 any more, the engine will start ticking it. (The animation speed 0 thing is intended so that tile based games using lots of animations and frames for static tiles which do not animate are still handled efficiently.)

    If you move the object, it will keep re-calculating the vertex co-ordinates. This is also probably a negligible amount of work (it's highly optimised since movement is frequent).

    So sprites which don't move or animate are blazingly fast. You probably don't need to worry about it.

  • Thanks, good to know!

  • Ashley I'm curious, If one sprite with a lot of animation folders against multi-sprites with one animation... Does it make difference on performance?

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