dataforged icon indicating copy to clipboard operation
dataforged copied to clipboard

make oracle prerequisites more programmatically accessible

Open rsek opened this issue 5 years ago • 3 comments

basically moving from a format like:

"Region": "Terminus",

to

"Requires": {
  "Property": "Region",
  "Value": "Terminus"
}

rsek avatar Apr 06 '21 18:04 rsek

for the record, the final format is

"Requires": {
  "Region": "Terminus"
}

the idea being that the Requires object can then be compared to the generated game object to see if it meets the requirements. Requires keys whose value is an array must match an item in the array; all keys of Requires must be met to qualify.

rsek avatar May 06 '21 05:05 rsek

This is still really hard to use programmatically (at least for strongly typed languages). The first issue is that because the property name contains the requirement and property names are often changed/removed at compile time in compiled languages, or only accessible through reflective programing it makes them hard/ugly to use. The second issue is that the values are now arrays of allowed prerequisites, so doing Table.Requires == myRequirement will no longer work.

I think your initial proposed format (below) is better, and makes adding new requirements in the future easier.

"Requires": {
  "Property": "Region",
  "Value": ["Terminus"]
}

The only issue I foresee with the above format is that things with multiple different requirements would not be supported unless it's an array of requirements.

DominicEliot avatar Jun 28 '21 23:06 DominicEliot

yeah, there's a not-insignificant number of oracles that have multiple prerequisites, so i'll need to give that format some thought. it might make sense to have two different sets of output from the YAML master files that i generate via a script: one for strongly typed languages and another that's semantically oriented (maybe even in a non-json format, to make it more accessible to people who want to incorporate it into a wiki or other non-programmatic implementation).

i'll reopen this to keep it on my radar.

rsek avatar Aug 07 '21 18:08 rsek