Large sprites, tiled backgrounds, and performance

Discussion and feedback on Construct 2

Post » Wed Aug 08, 2012 2:27 am

The problem with doing 'modular parts' or using heaps of sprites to make areas is that it can push up the objectcount to thousands, and I think the objectcount impacts the performance quite a bit from my experience. So I think I'm going to do my levels with unique sprites with a size of 1000x1000 (and invisible solid objects for collisions).alspal2012-08-08 02:28:10
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Wed Aug 08, 2012 9:47 pm

Wonder if this is something Scirra can incorporate or get some ideas from.
http://thinkpixellab.com/pxloader/

Not sure if something like this could help.
Havok2012-08-08 21:47:33
B
19
S
3
G
4
Posts: 79
Reputation: 3,711

Post » Thu Aug 09, 2012 12:11 am

@Ashley (hope he can weigh in on this issue)

Alspal, that is what I've been doing. Basically, I draw my entire level map in Photoshop which is very large, about 1000 by 10000 pixels, set my Construct window size to about 640x480 which results about 15 screenfuls in the game, then I split my single huge photoshop map into 10 png files of 1000 pixels by 1000 pixels so something like this:
level_p1.png 1000x1000
level_p2.png 1000x1000
...

These png files are imported as tiled backgrounds. My reasoning for this is that even though I'm not taking advantage of the tiling functionality, I recall reading somewhere that tiled background objects have less "built-in maintenance/logic" as opposed to full sprite objects.

Then using Scirra Construct 2 View Grid I lock the grid size, then drag each image p1 - p10 into the game view adjacent to each other. After this, I use generically alpha transparent shape sprite objects(squares, 45 degree triangles, etc) which have collision behavior on a separate layer in the appropriate places where the terrain should be solid. These collision objects are visual in-editor, but visibility is turned off in-game.

Of course, anything in the game, such as enemies, player, etc are separate sprite objects. This approach seems to work, but I want to know if it is a good idea in terms of performance/optimization.

I need a professional definitive expert opinion about this approach with respect to Construct 2. Is it a good idea? Why or why not? Will I run into scalability issues depending on the platform and or scope of the game? I think many people using Construct 2 would like an answer about this.
B
4
Posts: 10
Reputation: 320

Post » Thu Aug 09, 2012 12:13 am

I really strongly recommend you do not take this approach to designing levels. Using very large images is the quickest way to fill a mobile device's limited memory and make it unplayable.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Thu Aug 09, 2012 12:14 am

[QUOTE=Ashley] @alspal is right, it's not just on-screen objects that are in memory. The entire project is in memory, even off-screen images, and even images on different layouts.[/QUOTE] Why don't you load the images on diffrent layouts when the layout containing tose images is loaded?


It seems like a waste of memory to me, but what do I know.
B
18
S
4
G
1
Posts: 413
Reputation: 2,512

Post » Thu Aug 09, 2012 1:07 am

He's said he might do memory per layout later on.

@Ashley, but if we're not doing it for mobiles its fine then?
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Thu Aug 09, 2012 1:58 pm

It's a bad habit to get in to, because if you do come to design a mobile game the way you're used to will probably not fit in to the device's memory. Also, some old desktop machines have about as much memory as a high-end mobile device, so this method is still possibly excluding some desktop machines.

It also hugely increases the download size, because a series of very large image could run in to the megabytes, whereas levels made out of a series of smaller objects will probably just be a few hundred K.

Construct 2 will eventually support loading layout by layout like Classic does, but it's a low priority because it's generally not necessary for projects designed properly (using levels composed of smaller images).

Obviously C2 is just a tool and you can do what you like with it, but I strongly encourage you to compose levels out of smaller objects. It's faster, smaller to download, and uses vastly less memory, and won't make your game unplayable on low-end desktops or mobile devices.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Thu Aug 09, 2012 4:47 pm

Hey all

I have been working on my optimisations today and implemented a lot of the methods mentioned.

One thing I tried and now just found to be very BAD was over using tiled backgrounds. I thought that I could use a nice small tile and grow it over a large area. Big mistake! It killed the performance. I think I am getting a good idea of how html5 handles images and memory.
B
22
S
7
G
3
Posts: 189
Reputation: 4,270

Post » Sat May 11, 2013 7:30 pm

Ashley,

First of all, thank you for all that you do. You have enabled a small team of teachers to go from one developer and four designers to four developer/designers with Construct 2. We are very much looking forward to using it in the classroom.

We are looking at rebuilding a 50 MB iPad app from the ground up in Construct 2 because of the portability of HTML5 versus Objective C. I am working through the first question layout (of approximately 40). I am not worried about download size, as I intend to PhoneGap the final product, but I am worried about overloading my phone's memory (a Samsung Galaxy S2 with a persistent memory leak). Objective C agressively handles memory so having 50 MB worth of resources isn't an issue. My first layout currently uses 1.5 MB of memory. If I extrapolate that out, the final product should require about 60 MB. Is it foolish to think that I will be able to load the app with all 40 question layouts built?

Thanks for the help!

-Chris
B
24
S
5
G
1
Posts: 71
Reputation: 2,379

Post » Sat May 11, 2013 8:54 pm

You resurrected an antique thread.
By now we have layout-by-layout loading in C2.
B
66
S
25
G
30
Posts: 434
Reputation: 18,178

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: blurymind, ishmaelmoreno, y2j, Yahoo [Bot] and 11 guests