-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"relations" feature #70
Comments
As far as WHEN to implement all of this, it'd probably be good to aim for |
I think there's too many questions remaining about the design of this:
I think it's been a long enough wait for |
Hi, I'm trying out I was trying to figure out how to get I'm too new to have strong opinions about a lot of the things you bring up here, but I can report back on what path I take since I do need entity references to work in my game 🙂 |
With LDtk 1.0, field instances can now store a reference to another entity. Ever since, I've been thinking about how to properly allow users to transform these references into "relational" components that store an
Entity
object.Here's the plan.
ldtk::FieldInstanceEntityReference
bothHash
andComponent
, maybe rename it to justEntityReference
EntityReference
component.HashMap<EntityReference, Entity>
of all currently-spawned and soon-to-be-spawned LDtk entities, and pass it as a new argument into theLdtkEntity
creation functions.LdtkRelation
trait for constructing relational components.#[entity]
field attribute forLdtkRelation
for marking anEntity
field, or maybe just make it smart enough to construct anyEntity
fields w/o an attribute.#[ldtk_relation("FIELD_IDENTIFIER")]
field attribute for theLdtkEntity
derive that uses theLdtkRelation
constructor to create the component from the entity reference field with the given field identifier.Example:
It might also be worth considering supporting deriving
LdtkRelation
on tuple structs, but I'm not exactly sure how to do that nicely.The text was updated successfully, but these errors were encountered: