Component/relationship properties roadmap #532
SanderMertens
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Creating this discussion to keep track of current & future relationship properties (documentation for current properties can be found here: https://flecs.docsforge.com/master/relations-manual/#relation-properties).
Background
Glossary
(Eats, Apples)
)Eats
)Apples
)Bob
inBob.add(Eats, Apples)
)Pairs & Components
Pairs can either be tags or components, depending on its elements. The following rules determine the pair (component) type:
if both parts of a pair are a tag, the pair is a tag:
(Eats, Apples)
is a tag if bothEats
andApples
are tags.if one part of a pair is a component, the pair type is that component
The type of
(Eats, Apples)
isEats
ifEats
is a component andApples
is a tagThe type of
(Start, Position)
isPosition
ifStart
is a tag andPosition
is a componentif both parts of a pair are a component, the pair type is the first pair element
The type of
(Expire, Position)
isExpire
if bothExpire
andPosition
are components.Existing properties
For existing properties, see the component traits manual: https://www.flecs.dev/flecs/md_docs_2ComponentTraits.html
Future properties
The following properties haven't been implemented yet but are on the roadmap. Subject to change.
OneWith(R, T)
Forces the object of pairs with R to have T.
Usage:
OppositeOf(X, Y)
Entity cannot both have X and Y, or (X, O) and (Y, O). Adding (OppositeOf, Y) to X will add (OppositeOf, X) to Y.
Usage:
SameAs(X, Y)
X is equivalent to Y. Adding (SameAs, X) to Y will add (SameAs, Y) to X. Queries for X and (X, O) should include results for Y and (Y, O), and vice versa.
Usage:
Requires(X, Y)
X or (X, O) can only be added to entities with Y or (Y, O)
Usage:
Storage(T, O)
Specifies storage policy O for instances of T. Valid values of O are:
Usage:
Const(T)
Instances of component T cannot be modified after adding, but instances of T can be removed. Prevents creation of queries for T with an
inout
orout
modifier.Usage
Singleton(T)
Component T can only be used as singleton (cannot be added to entities other than itself). Prevents creation of queries for T that do not have T as subject.
Usage
Beta Was this translation helpful? Give feedback.
All reactions