OlaOst/spacegame — Issue #46: Relation between entity values and component values
Author: OlaOst
Created: 2012-03-03 04:11:28+00:00
State: open
Labels: code design

What is the problem?
When updating an entity via console, one must first set a value, then register the entity so subsystems are updated with the new value. This re-registers all values, and they are very likely to have fallen out of sync (because I'm too lazy to update the entity values from component values)

What is it like now?
Entity values are untyped and likely to fall out of sync
Component values are typed and are always current

How could it be?
Entity values are typed and are always the latest word on what a specific value is
Component values are views into a specific subset of entity values
(How does this play along with parallellism and multithreading?)

Another way would be a more fine-grained registerEntity function that only updates component values corresponding to entity values that have actually changed.

This still leaves the issue of syncing up an entity from all subsystems. There needs to be some way for a subsystem to 'own' a value, so that for example the physics, placer and graphics subsystems won't fight over what the position value really is.