How does C2 handles objects using the same image?

Discussion and feedback on Construct 2

Post » Thu Jun 20, 2013 4:54 am

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!
B
12
S
4
G
1
Posts: 104
Reputation: 1,512

Post » Thu Jun 20, 2013 5:35 am

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.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,568

Post » Thu Jun 20, 2013 9:04 am

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 ?
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
276
S
103
G
84
Posts: 7,289
Reputation: 83,098

Post » Thu Jun 20, 2013 1:24 pm

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?
Scirra Founder
B
383
S
225
G
86
Posts: 24,119
Reputation: 190,546

Post » Sat Jun 22, 2013 6:00 pm

@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.

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

Is something similar available in C2?
B
12
S
4
G
1
Posts: 104
Reputation: 1,512

Post » Sun Jun 23, 2013 12:04 am

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.
Scirra Founder
B
383
S
225
G
86
Posts: 24,119
Reputation: 190,546

Post » Sun Jun 23, 2013 10:38 am

Awesome! Thank you!
B
12
S
4
G
1
Posts: 104
Reputation: 1,512


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests