Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Some more help with chunks pls..

Discussion in 'Entity Component System' started by mattKsp, Nov 18, 2018.

  1. mattKsp

    mattKsp

    Joined:
    Jul 15, 2014
    Posts:
    15
    I updated the other day and the editor started showing me chunk info..nice. But now i am confused. I thought i understood, but obviously not!

    I create 1 archetype at the start with a shared texture.
    I spawn 100.
    The model swaps between 3 shared textures depending on health level.
    I swap around 1 component (to tell whether it is doing something).

    ..so why are there 55 chunks?
     
  2. Floofloof

    Floofloof

    Joined:
    Nov 21, 2016
    Posts:
    41
    from my understanding each shared component combination gets its own chunk (or something to that affect). dont remember were i read that from but if i come across it ill post it here.
     
  3. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    Even with that he would have at most 6 archetypes :
    • Shared#1 + Everything else with that 1 component
    • Shared#1 + Everything else without that 1 component
    • Shared#2 + Everything else with that 1 component
    • Shared#2 + Everything else without that 1 component
    • Shared#3 + Everything else with that 1 component
    • Shared#3 + Everything else without that 1 component
    Assuming "swaps" means changing value inside the Shared.
    So at least we start with 6 chunks when all these are present.

    The way to get 55 chunks from this is that the entity is very large and it goes over chunk's capacity.

    - To get 55 chunks from 6 chunks, that means each chunk would have to go over chunk's boundary 9 times. (6*9 = 54)
    - Each chunk is currently at fixed 16kB
    - In order for that to happen with 100 divided equally to 6 archetypes, so 100/6 = 16 entities each, have to span 9 chunks.
    - For 16 entities to span 9 chunks Shared + all components + that one component combined should weight 9kB. ( (16kB*9) / 16 )
    - In reality the 2nd 9kB should become 18kB and already over 1 chunk, he would end up with 16 chunks instead of 9. So I have no idea what is happening without more detailed data sizes and components.
     
  4. mattKsp

    mattKsp

    Joined:
    Jul 15, 2014
    Posts:
    15
    That makes sense.
    ('swap' is removing/adding a component, which i understand will change archetypes.)
    I think then it is because i have entities with lots of components.
    (Still doesnt quite add up in my head but i will leave it until i learn more.)
    Thanks for your help.