-
Please keep in mind I'm not an experienced game developer. Here's a problem I hit with Bevy: I've got entities that can reference each other using If I'm not using Bevy, I would have something like this: struct World {
rooms: HashMap<RoomId, Room>,
}
struct RoomId(String);
struct Room {
persistent_id: RoomId,
exits: Vec<RoomId>,
} And then, as a dumb example, whenever I have a |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I'd say take Can I suggest joining us over at the discord, and especially at the |
Beta Was this translation helpful? Give feedback.
-
To add further to this, you can spawn an entity with no components, then add components at runtime. |
Beta Was this translation helpful? Give feedback.
-
The Entity id should be the default and preferred choice for referencing entities at runtime, because you get it for free and it is the cheapest and most direct way to access an entity's components. However if you need a "persistent" and a stable id (ex: networking, some types of scenes persisted to disk), a |
Beta Was this translation helpful? Give feedback.
The Entity id should be the default and preferred choice for referencing entities at runtime, because you get it for free and it is the cheapest and most direct way to access an entity's components. However if you need a "persistent" and a stable id (ex: networking, some types of scenes persisted to disk), a
HashMap<MyId, Entity>
resource is a perfectly reasonable solution to the problem.