Does Family load all its Children into Memory even if ...?

Discussion and feedback on Construct 2

Post » Thu Apr 02, 2015 7:56 pm

Does Family loads all its member into memory even if one is not explicitly added to the Layout?

Before I report it as a bug can someone try and confirm this?

I have created a Family called "Levels" where I add each of my Level sprite (eg: Level1 to Levl5), each Level sprite is a collection of "Tiles" that are saved in as animation (speed set to 0)

I only use one Level sprite in each Layout. I use the Family "Levels" in a common Event where I handle the scrolling, Collision detection and everything related to a Level.

My question is, when running a particular Layout that contains only one member of the Family, does Family load all its Children sprites into the Memory?

I am currently noticing that even though sprite is not added to the layout, when I call for example "Spawn Level 2" in Level1 Layout(which has only sprites from Level1) the un-added sprite object is getting created! :?:

Sorry if I sound confusing, I can explain more if required.
@Ashley Can you help here please?
Create your own Isometric Runner Game using C2:

Image

Check out my game "Last of the Survivors":
Play Store
App Store
B
60
S
14
G
2
Posts: 427
Reputation: 5,564

Post » Thu Apr 02, 2015 8:18 pm

lennaert wrote:The source images from your project are loaded into memory at start up.


lennaert wrote:
Ashley wrote:The images go in to RAM and also in to VRAM (graphics card memory) if the rendering is hardware accelerated, which it usually is these days.

They get decompressed to the same size as the image saved as a 32-bit bitmap, so yes, a 1000x1000 pixel image will always take about 4mb of memory alone. This isn't much when both your computer and graphics card have gigabytes of memory, but bear in mind 4mb is still a lot for a single image on mobile.

The various compressed formats just package the data in to a smaller filesize. Compressed images cannot be drawn though, so it's normal to decompress the images in to memory whenever they are loaded.

We have plans for a feature to load textures layout by layout (like Classic can) somewhere on the todo list, to save memory with very large projects.



:)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Thu Apr 02, 2015 9:50 pm

@lennaert how old is that post? as C2 now loads layout by layout. so only images Sprites that are used are loaded. therefor them being in a family shouldn't matter unless created at some point
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Fri Apr 03, 2015 10:12 am

volkiller730 wrote:lennaert how old is that post? as C2 now loads layout by layout. so only images Sprites that are used are loaded. therefor them being in a family shouldn't matter unless created at some point



I just read Collodiums post, seems it was implemented already :D
Last edited by lennaert on Fri Apr 03, 2015 1:23 pm, edited 1 time in total.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Fri Apr 03, 2015 10:52 am

I think that this has been implemented for a while now; here's the info.
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,285
Reputation: 47,554

Post » Fri Apr 03, 2015 11:30 am

lennaert wrote:
@volkiller730 wrote:lennaert how old is that post? as C2 now loads layout by layout. so only images Sprites that are used are loaded. therefor them being in a family shouldn't matter unless created at some point




Did they already implement loading by layout ? I thought that was not yet realized and that every project resource image is loaded into memory at start up.

As far as I know, all images are loaded at start up, and only images in the viewport are rendered. I think you are mixing these 2 up.


No! Only images added to Layout are loaded into memory. Else no current C2 games would run on Mobile :D
Thats why I am surprised when a Sprite that part of a Family but NOT part of Layout is spawned in the current Layout
Create your own Isometric Runner Game using C2:

Image

Check out my game "Last of the Survivors":
Play Store
App Store
B
60
S
14
G
2
Posts: 427
Reputation: 5,564

Post » Sat Apr 04, 2015 12:38 pm

Families are not involved in the texture loading at all. Texture loading works by individual object types instead of entire families to avoid dragging in loads of textures that aren't necessary. So if you have one "Sprite3" instance in a layout which is a member of a family, only "Sprite3" has its textures loaded.
Scirra Founder
B
402
S
238
G
89
Posts: 24,637
Reputation: 196,071

Post » Sat Apr 04, 2015 1:34 pm

Ashley wrote:Families are not involved in the texture loading at all. Texture loading works by individual object types instead of entire families to avoid dragging in loads of textures that aren't necessary. So if you have one "Sprite3" instance in a layout which is a member of a family, only "Sprite3" has its textures loaded.


Thank you for Confirming @Ashley. However I am experiencing some weird issues with Family. I will experiment with a separate CAPX and report back.
Thanks for your constant help :)
Create your own Isometric Runner Game using C2:

Image

Check out my game "Last of the Survivors":
Play Store
App Store
B
60
S
14
G
2
Posts: 427
Reputation: 5,564


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests