Should I draw tiles to a canvas?

For questions about using Classic.

Post » Sat Oct 08, 2011 12:50 pm

My levels consist of multiple rooms, and are loaded from an array. I've managed to program a sort of 'portal rendering' where the whole map is loaded at each room transition, but everything outside of the current room is destroyed.

There's still ~300 tiles per room, plus ~100 collision tiles, so I've been thinking at each room transition I should create a canvas the size of the room and paste the tiles to it, then delete the tiles.

My questions are..

1) Is it worth it? I'm basically replacing ~300 16x16 tiled background objects for a single, large image with an average size of 1024x224 or vice versa..so I'd say it's worth it..I tend to stay away from giant images though, and as far as VRAM is concerned it could pad out to 1024x1024 or larger, right?

2) Should I also paste the collision tiles to another canvas? It's either ~100 sprite objects each with their own collisions, or a massive collision mask that is the canvas.

tl;dr... Which is better? Hundreds of little objects, or a handful of massive objects? Tokinsom2011-10-08 13:07:51
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Oct 08, 2011 1:07 pm

From my experience 300 tiles is nothing - I have had projects where a single explosion produced more objects than that. And the whole thing started getting slow around 10000 objects on screen. Meanwhile large textures brought the framerate down a lot faster. So, unless you are doing something really fancy with the tiles (such as baking in shadows or such) you are probably just fine with 300 or even 3000 objects.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Sat Oct 08, 2011 2:15 pm

Thanks for the input. Come to think of it I had ~3800 objects and 60fps before the 'portal rendering', and there's only ~400 now in the largest room so far, so I guess it'll be fine. I'm just worried about the game's performance on older computers, so I've been doing everything I can regarding optimization. Maybe I've gone a bit overboard ^^;
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Oct 08, 2011 2:31 pm

Yeah, a few hundred sprites shouldn't make much of a deference, unless you are moving them around a lot, and even then, the smaller the tile is the better the performance, so at 16x16 you should be doing ok.
Thing to remember about canvas is it adds a bit of vram on top, then updating the collision mask adds a bit as well.
Then you can't paste tiles that are off screen, so using it with scroll is pointless.newt2011-10-08 14:31:42
Image Image
B
161
S
48
G
90
Posts: 7,354
Reputation: 66,763


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests