-
Notifications
You must be signed in to change notification settings - Fork 7
Automatic dependency tracking #523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
25fefc4
to
e9feff3
Compare
e9feff3
to
1ef929d
Compare
80e2576
to
ff029bb
Compare
ff029bb
to
752d671
Compare
752d671
to
855d37f
Compare
Are you worried that this will be infeasible? For example: a nation has I ask because you seemed concerned about the performance impact of adding an additional pointer indirection to a handful of arrays, and adding that sort of overhead to changing prestige values is going to cost far more than those pointer indirections could have. |
The concern is mainly that we don't know when to update a part of the UI. We still have to find the right balance between reacting directly and updating after a tick. Events, decisions, reforms and peace treaties are difficult to deal with as they could have all sorts of effects. Perhaps we'll end up marking a pop, province, state, building or country dirty or perhaps we have to force a full UI refresh. |
When it comes to reactivity in the UI I'd love to use a reactive pull based model.
Where the reactive part is event-driven marking data as dirty.
The pull part would be the UI updating all elements marked dirty.
This would be kinda like Svelte, but Svelte does it compile-time.
Sadly according to Gemini and my own research neither godot nor C++ have something like this.
We're stuck with signals and manually invalidating or directly updating UI elements.
Also we have to ensure that signals can't flood the UI with updates.
This is a error-prone approach.
I thought about it some more and came up with the following high-level idea:
Split state up into:
We can use signal for the events.
signal_property would have to be replaced with mutable state that exposes a get() method and changed signal.
Manually tracked derived state would be pop distributions and other aggregates that we know when to update in the sim.
You don't want to track every pop his size in the province + the list of all pops. You could just manually update that like we do now.
Mutable, derived & manually tracked derived state all implement the same interface of a get() method and changed signal.
The derived state (mainly for UI purposes) should automatically handle tracking.