esper icon indicating copy to clipboard operation
esper copied to clipboard

one to many relationship unit tests

Open Felecarpp opened this issue 1 year ago • 1 comments

Hello, I need to create relationships between my entities in my project. I have read this thread (https://github.com/benmoran56/esper/pull/62) and I would like to propose a way to build them using esper. The key idea is to add a same component instance (called a group) to many entities. This works already fine with esper but not any test assure it over the long-term. So this PR only adds unit tests.

Felecarpp avatar Jan 23 '24 12:01 Felecarpp

Finally, I found another way to implement it which don't need to add the same instance of a component to many entities.

the first idea

item 1 character item 2
Inventory <-- Hold Inventory (the same instance)

the new one

item 1 character item 2
Belong --> Inventory <-- Belong

for the farm/plant question (https://github.com/benmoran56/esper/issues/79)

plant 1 farm plant 2
Rooted --> Plantation <-- Rooted

The only oddity remaining is that a component has another component as an attribute. This allows to do not use an entity ID instead or to use a complex identifier system.

Felecarpp avatar Jan 23 '24 13:01 Felecarpp