How do I do End Layout?

Get help using Construct 2

Post » Tue Feb 16, 2016 1:56 pm

Is there a specific End Layout function? Or does going to a different Layout end the current Layout? When a different layout is displayed, does the previous layout that is no longer displayed still persisting? Or does the act of a second layout being displayed end the previous layout?
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Feb 16, 2016 2:17 pm

@Phoenixbowman Don't be stressed about it. Construct 2 is smart enough to flush out memory of images from past layout to make room for another layout.

Please read if you have time : (These are helpful and this is from the founder of Construct 2 "Ashley")

https://www.scirra.com/tutorials/298/pe ... bile-games

https://www.scirra.com/blog/83/optimisa ... -your-time

https://www.scirra.com/manual/134/performance-tips
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
55
S
17
G
90
Posts: 1,111
Reputation: 59,145

Post » Tue Feb 16, 2016 2:37 pm

Something is causing memory to keep increasing. The memory goes up and up. If objects were being flushed than memory would drop. Something is still running in previous layouts. I re-use Sprites from previous layouts.

Do Sprites that are used later persist in memory from previous layouts?
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Feb 16, 2016 2:38 pm

My FPS is steady. The game runs smoothly, so it's not too many sprites on the screen.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Feb 16, 2016 2:48 pm

Phoenixbowman wrote:Something is causing memory to keep increasing. The memory goes up and up. If objects were being flushed than memory would drop. Something is still running in previous layouts. I re-use Sprites from previous layouts.

Do Sprites that are used later persist in memory from previous layouts?


In my past experiments. There are some cases.

If the sprites from your old layout is present in your new layout then it won't be flushed but if it isn't present in the next layout then it will be flushed.

If the sprites are global then it will never be flushed.
-------------------------------------------------------------
//*Persistent Sprites - Don't be fooled of the word, the image is not stored in the memory. The information that it exists is stored in the storage of the device if I am correct.*//

If the sprites are persistent then the information that it exists is stored in the storage of the device(Not MEMORY).

So the memory management is still the same above but better optimized because the if the image is not preloaded in the layout but when you are back in the layout
it automatically preloads itself. But on initial creation, it should be preloaded by adding the object in the layout on startup and destroyed if not needed.
Last edited by chadorireborn on Tue Feb 16, 2016 2:57 pm, edited 1 time in total.
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
55
S
17
G
90
Posts: 1,111
Reputation: 59,145

Post » Tue Feb 16, 2016 2:54 pm

chadorireborn wrote:
Phoenixbowman wrote:Something is causing memory to keep increasing. The memory goes up and up. If objects were being flushed than memory would drop. Something is still running in previous layouts. I re-use Sprites from previous layouts.

Do Sprites that are used later persist in memory from previous layouts?


In my past experiments. There are some cases.

If the sprites from your old layout is present in your new layout then it won't be flushed but if it isn't present in the next layout then it will be flushed.


The Sprites from the old layout are present in the new layout.

Thank you for this information. That could explain what is going on.

Will doing at End of Layout > Destroy A destroy the sprite and flush it from memory?

On End of Layout > Destroy A
Destroy B
Destroy C

A B C and are on the current layout. Will that function destroy A B and C, even if they are present on the next layout?
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Feb 16, 2016 3:00 pm

As in, A B and C are present on the current layout. WIll the End of Layout Destroy function flush them from memory, even if they are present on the next layout?

So they're flushed from memory, so they don't keep piling up. That way, they're only present in memory when on the active layout. So there are not instances of them still existing from previous layouts.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Feb 16, 2016 3:05 pm

There ought to be a function that checks to see if Sprites are used on the next layout. If they are, then there should be the option to flush them from memory. That way, they're not piling up.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Feb 16, 2016 3:07 pm

Phoenixbowman wrote:
chadorireborn wrote:
Phoenixbowman wrote:Something is causing memory to keep increasing. The memory goes up and up. If objects were being flushed than memory would drop. Something is still running in previous layouts. I re-use Sprites from previous layouts.

Do Sprites that are used later persist in memory from previous layouts?


In my past experiments. There are some cases.

If the sprites from your old layout is present in your new layout then it won't be flushed but if it isn't present in the next layout then it will be flushed.


The Sprites from the old layout are present in the new layout.

Thank you for this information. That could explain what is going on.

Will doing at End of Layout > Destroy A destroy the sprite and flush it from memory?

On End of Layout > Destroy A
Destroy B
Destroy C

A B C and are on the current layout. Will that function destroy A B and C, even if they are present on the next layout?


I think you misunderstood something @Phoenixbowman .

The images of the sprite are the only thing stored in the memory not the sprites or objects nor instances. The instances you are talking about (The Objects on the layout, THE number of sprites) are codes that are generated by the things you put in the layout or you created using the eventsheet.

IE: 100 instances of 1 sprite of 32x32 image
(100 instances are code during layout and not persisted on next layout in other words they are only available in that layout and is cpu based not memory.)
(1 sprite of 32x32 image is stored in the memory)

Explanation:
1 image of 32x32 image or frame is stored in the memory and the cpu is used to make them 100 instances and do movements.
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
55
S
17
G
90
Posts: 1,111
Reputation: 59,145

Post » Tue Feb 16, 2016 3:10 pm

@Phoenixbowman - you need to read this https://www.scirra.com/manual/183/memory-usage
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
55
S
17
G
90
Posts: 1,111
Reputation: 59,145

Next

Return to How do I....?

Who is online

Users browsing this forum: Christmas, marc254 and 3 guests