Performance difference between one or more frames?

From the Asset Store
[ C3 ] Firebase-Performance support C3 build service iOS | Android.
  • Hi everyone I would like to know if there is a performance difference between creating on screen an object with one frame or an object with 3000 frames on one or more animations, but the animation speed set to 0.

  • I suspect a single object with 3000 animation frames would be preferable to 3000 separate objects. But I also suspect it won't make any perceptible performance difference in most cases.

    The bigger consideration is your game logic. Are these 3000 objects functionally the same? If so, I would probably put them all in a single object.

  • Exactly it would only change the image depending on which one is used, it seems to me smarter to have some objects on the screen with thousands of frames each, more than creating thousands of objects, but I wanted to understand whether to have 10 objects on the screen for a total of 30000 possible frames could create problems for their creation, if it is imperceptible it is excellent

    (I shot high numbers at random just to understand how construct works)

    Thanks for the clarification!

  • The difference is sprite sheets.

    3000 frames in one object is like importing a video file all at once.

  • The important thing is that when I create these files on the screen it is immediate and does not slow down the game

  • I thought separate objects were also combined into sprite sheets automatically? And large animations are split up into multiple sprite sheets?

    I'm not really familiar with what goes on under the hood, but my understanding was that Construct optimized sprite sheeting, so I never really worried about it.

    One memory consideration though, as 3000 is quite a significant number, is that will all 3000 unique images always be necessary on any given layout? If your gameplay only calls for a portion of them to be seen at any given time/playthrough, you might want to consider a system loading them in on demand, or separate them out by layout.

  • It depends on the sprite sheets. The export will try to merge everything, but you do have control over what size they should be.

    Obviously 16x16 sprites won't really be as big an issue as 512x512.

    Of course going down the P^2 rabbit hole isn't worth it.

  • Don't do this.

    Give a check to debug window and check memory consumption. You will be shocked to see the results.

    Rather add all the images in files folder and import the images using URL

    I have done this thing in past and I am 100 percent sure about it. I was making a picture puzzle game and then I realized about this thing.

  • Thanks for the valuable advice, but I have a problem, I have multiple instances of the same object to which to assign different images, so each instance has a variable with the name of the image to assign, if I have only one instance on the screen it displays it correctly, but if I have multiple instances on screen, each instance will change image as if there was a looped animation with all the variable names. Can it be corrected?

    edit I tried to put generate only once when it is true as condition, now the image stays still, but loads the same in all instances ..

  • all instances use the same underlying object, so loading a new frame will affect all instances. You either have to use different objects, or have many frames available to load images into and keep track of which ones have been used for which instance.

    if you use different objects, you can put them in a family and give the family the instance variables, behaviors, and use the family name in all the code.

  • Thank you, I was able to correct the problem by inserting empty frames, and setting the instance frame first and then recalling the image from the url!

    Now I just have to figure out if having so many empty frames when creating an object is still heavy

    edit

    I have seen that even with empty frames when the object is created the memory occupied is less but still a lot

  • See memory usage in the manual. Lots of separate objects is much, much better than a single object with loads of animation frames. The reason is Construct's memory management only loads entire objects at a time, covering all their animation frames across all animations. One object with 3000 frames will mean you have to load all 3000 images in to memory any time any of those images are used. 3000 separate objects with a single image means Construct can only load the ones that are actually used in to memory, which is far more efficient.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, I noticed it when I entered the debug mode. With about 1600 frames it marked me more than 800 mb, entering with as many empty frames instead about 500 mb.

    I have however changed the project with more objects, able to change images using those loaded in the file folder.

    Thanks everyone for the help

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