SpriteSheets are wasteful

Discussion and feedback on Construct 2

Post » Thu May 15, 2014 12:15 pm

Aphrodite wrote:I do not clearly understand why a rectangular sheet wouldn't be possible?

Low-end GPUs only support square power-of-two texture sizes. Also, I don't think even having non-power-of-two texture size support actually guarantees that in memory they are a non-power-of-two size - it could still put it on a power-of-two size and just emulate non-power-of-two support (e.g. by reporting a different texture size to what's really allocated). Square power-of-two guarantees that the GPU texture will also be exactly the size of the spritesheet.
Scirra Founder
B
399
S
236
G
89
Posts: 24,546
Reputation: 195,436

Post » Thu May 15, 2014 12:44 pm

I am not exactly sure I get it yet, if the image was not power-of-two sized, it wouldn't make a difference for low-end GPU then (since they will consider it like a power of two size still), but will be in theory a smaller filesize at the end, and also:

Ashley wrote:Square power-of-two guarantees that the GPU texture will also be exactly the size of the spritesheet.


but in that case, the the added texture ins't used either, unless it means the GPU would deteriorate the texture in case of non-power of two, but since 1 frame only objects aren't spritesheeted nor resized, it seeems unlikely to me

@Ashley

EDIT: I misread, low end GPU doesn't support at all then, but it is still weird for the non-power of two sized exported for one frame, that they works
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Thu May 15, 2014 2:10 pm

The only way I can think Construct 2 could be improved in terms of performance is to have spritesheets shared between animations (I may be wrong, but I remember seeing the folders separated by animations).

But the spritesheet system is already robust and awesome enough for our needs!
B
108
S
40
G
11
Posts: 456
Reputation: 13,787

Post » Thu May 15, 2014 2:31 pm

@Aphrodite Basically if the texture/sprite image is not a power of two, then the computer will add blank space to it to make it a power of two. This means it will increase the size. So for example if your image is 240x512 it will be converted to 512x512. If it is 500x500 it would still be converted to the next compatible power of 2 size which would be 512x512. It does this because it can't remove space to make it fit since that would cut the image.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,603

Post » Thu May 15, 2014 4:08 pm

Aphrodite wrote:but will be in theory a smaller filesize at the end

PNG/JPEG compression will compress away empty space to effectively nothing, so in practice extra space in the image does not affect file size, only memory use.

have spritesheets shared between animations

They already are - a spritesheet can have images from all the animations of one object type on it. Two different object types won't share a single spritesheet, but then that probably helps keep the colour counts down (since animation frames of the same object type are likely to use a similar palette), making it more likely the whole spritesheet can go to PNG-8 and significantly save on the file size. Also as mentioned in the blog post, if everything ended up on one giant spritesheet, there would be no progress feedback while loading, so it's useful to break things up across a few spritesheets for that too.
Scirra Founder
B
399
S
236
G
89
Posts: 24,546
Reputation: 195,436

Post » Thu May 15, 2014 8:31 pm

Kronar wrote:@Arima Thanks for your suggestion. I just tried it and unfortunately did not work. The origin points will remain in the same place for each frame but because of the frame size differences the animation playback will 'jitter'. For cropping to work, the engine needs to take into account how much got cropped off in each frame and offset each origin appropriately.


@Kronar
I have a thread about this issue. I have a solution that works great also. Cropping still works beautifully. I saved tons on memory usage by implementing the "fix"

No jittering. Smaller sprites due to proper cropping.
B
8
S
2
Posts: 163
Reputation: 1,115

Post » Fri May 16, 2014 6:43 am

Lol, just saw this on twitter:
Product of Death Cycle
Bnt1Wb4CIAA61vd.png
You do not have the required permissions to view the files attached to this post.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,718

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests