Optimization - multiple layouts vs one layout, assets layout

Get help using Construct 2

Post » Mon Jan 23, 2017 10:39 pm

Hello,

I was thinking of using an assets layout.

My game is currently - according to Construct 2 - using about 40 MB of memory. That's for the one layout I have.

Is that a lot? My previous projects had much less. I am currently using one single background sprite which holds different images for different levels. It also moves infinitely from left to right. Is it better to have seperate sprites for this? I'm using sprite because tileable background doesn't support frames and I would get like a ton of different backgrounds on one screen.

Now I find it really, really convenient to use one 'level' layout, one 'menu' layout and so on to limit the number of layouts.

What's better, use multiple layouts? Then I would have to use an assets layout for convenience. I tried placing them all on a seperate layout but for some reason I can't bloody figure out sometimes it wouldn't pin or spawn them on the level layout!

What are good ways to reduce memory size and best practises for layout use? Multiple layouts for different levels? Or one, but load them from an assets layout? But why aren't they always loaded?

Thanks!

- R
B
13
S
7
G
3
Posts: 131
Reputation: 3,057

Post » Tue Jan 24, 2017 1:46 am

Try and keep it below 100mb. Best practice is to load in smaller images. Another is to use the tilemap stuff but seems like you have already dismissed using that. I don't know why you would want to limit the number of layouts, this doesn't really do anything. If using a single layout is better for your project then that's fine but it won't affect performance. A layout doesn't load until you go to it. The memory being used is for the current layout.
B
45
S
15
G
73
Posts: 2,002
Reputation: 43,386

Post » Tue Jan 24, 2017 1:58 am

plinkie wrote:A layout doesn't load until you go to it. The memory being used is for the current layout.


Hey, thanks for your reply.

So if I didn't put all the assets on one layout it would affect performance correct? In a positive way.

Multiple layouts would reduce memory usage no? Backgrounds for example. All unique pieces. Instead of having them in one sprite, divide them and use tiled backgrounds each unique one on a seperate layout?

If you say memory is used for each current layout, the above would make sense.

I'll go and see where what causes the big usage. I think it's the background sprite indeed.

Regards

- R
B
13
S
7
G
3
Posts: 131
Reputation: 3,057

Post » Tue Jan 24, 2017 2:12 am

I think the estimated memory usage is based on the biggest layout. If you have a layout full of assets then its probably based on that, but this won't be used or loaded in the game so performance should be fine and the memory usage is going to be much lower. You're using it as a store for assets yes? I sometimes do that because you need an instance somewhere to set the initial values. If you have just the one layout at the moment with the background image then the memory usage will be based on that but it seems quite high for just one sprite.
B
45
S
15
G
73
Posts: 2,002
Reputation: 43,386


Return to How do I....?

Who is online

Users browsing this forum: marc254 and 7 guests