Description
Add API can set key for entities, and use the key fast find entities
"specs::prelude::WorldExt" add function
fn find_entities(&self, key: T) -> Read
and add
fn create_entity_by_key(&mut self, key: T) -> EntityBuilder
Motivation
In open source game "veloren"
I usually see the code.
let entity_opt = (&ecs.entities(), &ecs.read_storage::<comp::Player>())
.join()
.find(|(_, player)| player.alias == player_alias)
.map(|(entity, _)| entity);
Basically, any query from player will loop all entities to find alias equal query name.
If ecs has 10000 players. the design include performance bottleneck.
Drawbacks
- Is it a breaking change?
no.
- Can it impact performance, learnability, etc?
to improve performance for search specific entitie
Unresolved questions
I just learn this project. I think author group will give me a best solution.
Please indicate here if you'd like to work on this ticket once it's been approved. Feel free to delete this section if not.
Description
Add API can set key for entities, and use the key fast find entities
"specs::prelude::WorldExt" add function
fn find_entities(&self, key: T) -> Read
and add
fn create_entity_by_key(&mut self, key: T) -> EntityBuilder
Motivation
In open source game "veloren"
I usually see the code.
Basically, any query from player will loop all entities to find alias equal query name.
If ecs has 10000 players. the design include performance bottleneck.
Drawbacks
no.
to improve performance for search specific entitie
Unresolved questions
I just learn this project. I think author group will give me a best solution.
Please indicate here if you'd like to work on this ticket once it's been approved. Feel free to delete this section if not.