Skip to main content
9 events
when toggle format what by license comment
Jul 8, 2023 at 14:09 comment added Philipp @Basic Yes, I think you understood what I was trying to say. The buffer is not "shared between components on a single entity" because each buffer is a component on a single entity (or at least behaves like one for most intents and purposes).
Jul 8, 2023 at 13:37 comment added Basic Actually, the documentation on InternalBufferCapacity clarifies anwyway. It's not indexing per-se, it's just setting a "memory stride" to leave enough space for up to n of a component.
Jul 8, 2023 at 13:35 vote accept Basic
Jul 8, 2023 at 13:35 comment added Basic I meant "Shared between components on a single entity" I was imagining that the data structure internally would be [0,0,0,0] with -say- Iron indexed to 0, Carbon indexed to 1, etc... So an entity with 2 resource components [say 50 iron & 10 carbon] would be represented in memory something like [50,100,0,0]. Doesn't matter, worst case, I can get it working and start digging through memory/profilers to see what it's doing under the covers.
Jul 8, 2023 at 13:12 comment added Philipp The [InternalBufferCapacity] attribute sets the expected(!) maximum number of entries per entity. So in this example, every entity has its own buffer, and that buffer is expected to have up to two entries. You can add more, but that causes chaos in the memory layout which might degrade performance. The whole buffer acts as a single component. Not sure what you mean with "shared". Shared between systems? Yes. Shared between entities? No.
Jul 8, 2023 at 12:58 comment added Basic Thank you, that sounds very much like what I'm looking for. To clarify my understanding, are you effectively populating a single shared array for each entity, with each resource using a different index? I ask due to the InternalBufferCapacity decorator
Jul 8, 2023 at 10:00 history edited Philipp CC BY-SA 4.0
added 1 character in body
Jul 7, 2023 at 8:15 history edited Philipp CC BY-SA 4.0
added 15 characters in body
Jul 7, 2023 at 8:10 history answered Philipp CC BY-SA 4.0