Skip to content

How to depict an Entity owning other Entities #105

Answered by sebas77
CodingJinxx asked this question in Q&A
Discussion options

You must be logged in to vote

The best way to solve your problem is to use filters. This article will show how to use them:

https://www.sebaslab.com/svelto-ecs-3-3-and-the-new-filters-api/

in this case, you would need to use persistent filters. The aeroplane component would hold the id of the persistent filter that holds the indices of its weapons.

in short, a filter is a way to subset groups using double array indexing.

A group is a set of entities and the components are stored in linear arrays
a filter is an array of indices of these component arrays, so a way to subset the component arrays.

the subset is defined as componentArray[filterArray[i]]

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CodingJinxx
Comment options

Answer selected by CodingJinxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
FAQ Svelto FAQs
2 participants