How does C2 handles objects using the same image?

  • Hi all,

    I'm wondering how c2 deals with objects using the same image when they are in the window view.

    Are 10 objects using the same image will be counted as 1 object in the scene? or 10?

    If they are counted as 10 objects, is there any tricks to make them be counted as 1?

    In the past, I used Unity 3D. There are plugins that can be used to combine sprites into a bigger sprite sheet. Every objects in the scene use the same sprite sheet so that reduces the draw calls => better performance.

    This is not an issue for my game atm as it is running great on the mobile, I just want to know.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are you talking about object or images? 10 objects is 10 objects regardless of what image is used. This is separate from 10 objects using the same image and 10 copies of the image being included in the game files. C2 with one of the recent updates will look for duplicate images and remove duplicates and have all objects use the same image from the sprite sheet.

    You have to remember that the image an object uses is separate from the object itself. The object is a logical unit used for behaviors, the image is another object that is associated in order to show a visible representation. The image does not have behaviors on it, the object does.

  • 10 instances of the same sprite would use the same set of textures/images.

    10 different sprites object could use 10 different set of images.

    Nevertheless, since a few releases ago, deduplication of images is available in C2. I think though it only impacts on the download size of the final project, not sure it works on runtime, providing less RAM use.

    @Ashley could you confirm/infirm ?

  • Image deduplication can save RAM, because previously two images would have both been loaded in to memory, whereas when deduplicated there is only one image in memory. However the original question is vague. tipztv - are you referring to CPU speed, GPU rendering, memory use, VRAM use, or something else?

  • Ashley CPU speed I guess.

    Taken from Unity docs:

    To draw an object on the screen, the engine has to issue a draw call to the graphics API (e.g. OpenGL or Direct3D). The graphics API does significant work for every draw call, causing performance overhead on the CPU side.

    Unity can combine a number of objects at runtime and draws them together with a single draw call. This operation is called "batching". The more objects Unity can batch together, the better rendering performance (on the CPU side) you can get.

    docs.unity3d.com/Documentation/Manual/DrawCallBatching.html

    Is something similar available in C2?

  • Yep, we've already fully implemented a high-efficiency batcher. You don't need to worry about it at all from the event system, the engine already batches all rendering calls as optimally as possible.

  • Awesome! Thank you!

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