bevyengine / bevyengine/bevy

Change detection on entity

Open
#9,401 3 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Feature D-Complex S-Needs-Goal
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

Currently there is no way to directly detect if an entity has been mutably accessed. You can only examine each component. This means to implement replication it is necessary to iterate over all replicated components of all replicated entities to detect which components need to be sent to clients.

## What solution would you like?

`Changed` should work like `Changed`, and should be faster then checking each component is changed (ideally O(1)). The entity's last change tick should also be available for more advanced use.

## What alternative(s) have you considered?

None

## Additional context

- [`bevy_replicon`](https://github.com/lifescapegame/bevy_replicon) currently iterates over every component that might have changed.
- Issue #5097 also seeks to improve change detection.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Bevy's existing Changed change-detection entry point and compare it with the needs described for bevy_replicon. Review issue #5097 for related design context; done means Changed detects mutable entity access in O(1) and exposes the entity's last change tick.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.