Is it Core or Capability?
In the midst of testing the platform (everything is building and Core, IF Domain, Event Processor, World Model, lang-en-us, Standard Library, and Engine all compile), there were some actions without clear implementations.
For scoring, where do we keep that data? In the player entity? In the world model at some global level? After circling on it for a few hours, I finally came up with "capabilities".
The idea is that some things really own their own data (and structure). Scoring is a good example of this and by making it an intentional capability with its own data structure, we can allow future extensions to replace the scoring capability with an alternate data structure. Conversations would also fit into this model.
// Scoring capability registers its data schema
world.registerCapability('scoring', {
schema: {
scoreValue: { type: 'number', default: 0 },
maxScore: { type: 'number', default: 0 },
achievements: { type: 'array', items: 'string', default: [] },
history: { type: 'array', items: 'object', default: [] }
}
});
Inventory would not. It's an action that queries the current state and that is as it should be.
This discussion led to new architecture decision records as seen on the Sharpee github issues page: https://github.com/ChicagoDave/sharpee/issues