aomarks / bridgesim

A starship bridge simulator for the web.
https://aomarks.github.io/bridgesim/
16 stars 3 forks source link

refactor elements to deep observe #8

Closed aomarks closed 8 years ago

aomarks commented 8 years ago

We used to constantly re-assign the top-level database tables on every tick because we assigned straight from the parsed full host snapshot JSON. Now we have deltas from the host, and only update the parts of the database that change.

Most elements (e.g. science, comms, engineering) still rely on full re-assignment for their change observers. They don't notice when something changes within the table. To make things work short term we are manually re-allocating some of the tables every tick. We should refactor to use wildcard observers.

I've done crew selection (3a3bbb081148751e438c356d4a187a6a45057044) and the power bars (96664c2e8819dfe9d88b1354cc235e4bae8b1777). I'm also trying to push some logic out of the templates by introducing intermediate models that turn the flat database tables into something better structured for each specific element.

aomarks commented 8 years ago

Finished the rest of the elements (18105658bd14457874499f8f0f09e31b947d169c).