I didn't actually mean for the flowchart to be exhaustive. Mostly I was trying to give an example of something I thought would be neat to be able to see in-game (with the various links lighting up as they're satisfied or not). It clearly needs to be a bit more thorough than what I posted
Anyhow, there is a question of how I should design the simulator to be most accessible to people. My thought right now is to do something where there's a side panel that lists the various sorts of events or decisions that the planet can experience, and you can turn them on or off with check boxes. A given configuration of 'model + event list + action list' could be created as a tab in the display, and you could click 'Simulate' to gather time data on a random run of that combination (or even do something interactive where you can play the Hydral and do dispatches and such?). Then, you have the data of a full playthrough for each tab, and when you view the various graphs you could select to show them overlapping.
However, this doesn't necessarily make it easy for people to add their own events or models, so I need to figure out if there is a way for me to make that simpler or if its just something we have to live with.
The basic model of an event looks like:
- activateEffect: this is a function that runs when the event starts
- duringEffect: this is a function that runs once per month when the event is in play
- removeEffect: this is a function that runs when the event ends
- canTrigger: this is a function that returns 'true' if the event can happen right now, and 'false' if it cannot
- chancePerYear: this is the probability per year that the event will occur if canTrigger is true
- duration: this is how long the event lasts once triggered (set to -1 for permanent)
The basic model of an action that the planet itself can choose to take looks like:
- resourcesToComplete: this is the cost in some sort of resource track to perform this action. This could tie into a budget model, or be things like the mineral resources.
- minTimetoComplete: this is the minimum time to complete the action given that all the necessary resources are instantly available
- conditionFunc: this is like canTrigger, but it determines whether or not the planet can decide to perform this action given its current status
- weightFunc: this is a function which returns a floating point number that determines how much the planet wants to take this action
- duringFunc: this function is applied each month while the planet is taking this action
- interruptFunc: this function is applied when the action is interrupted
- finishFunc: this function is applied when the action completes
The idea was that the planet would perform an action and when finished, would consult its list of possible actions and choose the next action to perform based on RCI, resources, etc, using a weighted random selection. The planet then completes the next action and so on. Each action can also let itself be cancelled using 'duringFunc' to call 'interruptFunc' if the situation calls for it, but this decision is made on the action basis not on the global decision-making basis.
Goals:
In order to make the decision-making more coherent, there's also a list of hidden states that can be set by actions - 'Goals'. Essentially, you could make an action that says something like 'when Economy<-50, add 'repair Economy' to the Goals list and finish immediately'. You could then have an action 'when Economy>0, remove 'repair Economy' from the goals list'. Then you could have other actions that can trigger only if 'repair Economy' is on the goals list. That way, you don't just hover around -50, fixing the Economy RCI by 1 point whenever you dip below - instead, the planet can repair all the way up to zero before it stops pursuing that plan of action.