image reuse (optimization) - de-duping

Discussion and feedback on Construct 2

Post » Thu Aug 20, 2015 4:01 pm

hi,

I have about 14 animations for my player sprite, each about 15-30 frames. There are a number of these frames that most likely use the same image. I export them from my animation software, sometimes I'm just changing a small thing that is only in part of the animation sequence. So all the animations will definitely share some of the same exact frames. However they may have different names... i.e. "BeamWeapon008.png" and "AutoWeapon008.png"

Does anyone know if C2 will take out duplicate images (on Export) and only use one image, or is this something I have to do manually? Ideally I'm looking to optimize and not load the same image into memory more than once.

thanks..
B
97
S
32
G
15
Posts: 1,183
Reputation: 16,148

Post » Thu Aug 20, 2015 4:26 pm

Exact frames, per object, yes.
Exact frames in multiple objects? Nope.
Image ImageImage
B
168
S
50
G
169
Posts: 8,283
Reputation: 108,195

Post » Thu Aug 20, 2015 5:27 pm

so if I have different animations (for the same sprite object) that have different filenames it will only use the 1 image?? that is cool.

I guess that's why some people complain about export times, it's doing a bunch of deduping... thanks!
B
97
S
32
G
15
Posts: 1,183
Reputation: 16,148

Post » Thu Aug 20, 2015 8:11 pm

https://www.scirra.com/tutorials/577/co ... imisations See step 1

Only the same images between different object-types are not deduplicated.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Fri Aug 21, 2015 11:05 am

Sisyphus wrote:Only the same images between different object-types are not deduplicated.

Not quite - images can be deduplicated between different Sprite object types. Only images between Sprites and non-Sprites (e.g. Tiled Background) are not deduplicated. From the tutorial you linked to:

images are not deduplicated between Sprite objects and other objects, since Sprite object images are spritesheeted and other objects are not. For example, a Sprite and a Tiled Background with identical images will still export two images, but two Sprites or two Tiled Backgrounds with identical images will only export one image. Usually these are both edge cases and it should not be a serious problem.


Also image deduplication is a pretty quick part of the export process, even with large projects - image recompression takes far longer, and you can skip that.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Sat Aug 22, 2015 12:05 am

@Ashley even better! that makes my job way easier... so I can load as many redundant frames as I want and C2 will 'trim the fat' - so to speak.

excellent! thanks...
B
97
S
32
G
15
Posts: 1,183
Reputation: 16,148

Post » Sat Aug 22, 2015 12:52 am

@Ashley My understanding of "object-type" meaning was wrong, i thought object type is Sprite or Tiled Background, woops :lol:
I tried to say this
Ashley wrote:images between Sprites and non-Sprites (e.g. Tiled Background) are not deduplicated
B
22
S
9
G
7
Posts: 421
Reputation: 6,543


Return to Construct 2 General

Who is online

Users browsing this forum: KENYONB, mihirolover and 5 guests