A new ReactiveComponent type that automatically inserts and updates a component of type Output on the same entity whenever the source entity's component of type Input changes (as detected by change detection ticks)
Implementation issues
There's a single place where reactive components get updated (the Last schedule). Ideally it would be an immediate reaction like how observers work.
The update_reactive_components driver system loops over every single expression any time an expression changes. It would be ideal if we could track affected components, and only re-run expressions that would be affected. But for the initial prototype, performance isn't too important anyways.
Not implemented/tested
ReactiveComponents that can add/remove the component, instead of just modifying the value.
Chaining reactions
Expressions that depend on multiple components from an entity
Expressions that depend on multiple entities
Expressions that depend on resources
Expressions that depend on queries or other complicated sources of data
Reactive entity tree structures (e.g. a reactive version of WithChildren/WithChild, using the Name component as a key)
Objective
Solution
ReactiveComponent
type that automatically inserts and updates a component of typeOutput
on the same entity whenever the source entity's component of typeInput
changes (as detected by change detection ticks)Implementation issues
update_reactive_components
driver system loops over every single expression any time an expression changes. It would be ideal if we could track affected components, and only re-run expressions that would be affected. But for the initial prototype, performance isn't too important anyways.Not implemented/tested