Pathfinder 2: clash of the philosophies (Patreon)
Content
JavaScript is still going to be the core language of the character sheet builder, because that gives me the flexibility to run it on server, client or wherever. It keeps my options open. But the way I was using JavaScript there had a leaning towards functional programming, with heavy use of anonymous elements (ie a complete object being passed straight into a function, without ever being declared in a namespace or saved to a variable). As such it suffered from one of the classic flaws of, at least, that form of functional programming, in that anonymous elements are denied entry hooks for modification.
If I know anything about Paizo after working on their stuff for years, it's that there will inevitably be *more*. Whether that's more classes, archetypes, feats, spells, ancestries, or whole new things I haven't anticipated, there are going to be more things coming out. So this system needs flexibility.
The now classic form of this is the Pathfinder 1 archetype: a variant of a class that replaces or modifies existing class features. For this to work in a component-based character sheet builder, each replacable element needs to be identifiable. They need an ID in a registry. That doesn't jibe with the functional JavaScript approach.
So instead I'm trying a declarative approach. This excerpt shows a sample using a YAML-based DSL, in which class features are broken out into features with IDs. Each contributes elements into zones. The sample includes the Cleric, Rogue and Wizard, along with a few feats and templates. Enough to get the flavour of it.
https://gist.github.com/marcus-downing/0981631652d677608c892d71d659b967