lightyear
lightyear copied to clipboard
Update the way we collect world changes that need to be replicated?
Currently, replication works like this:
- we have systems that track entity spawn/despawn for all entities that have the Replicate component
- for each component in the protocol, we have one system that tracks component adds/updates, and one system that tracks component removals
- That's a lot of systems. Maybe we can try to benchmark against an archetype approach where we iterate through all archetypes that have the Replicate component? The code would be similar to having a custom
WorldQuery
:
- we need to update the cached State with the new archetype information (which ones contain Replicate)?
- then we iterate through all the components in the archetype
- Maybe we can use the new ComponentHooks and Observers ECS patterns to more efficiently accomplish this?