For AI agents: the complete documentation index is available at /AchReactive/en/llms.txt, the full documentation bundle is available at /AchReactive/en/llms-full.txt, and this page is available as Markdown at /AchReactive/en/usage/data-sources.md.

Data and sources

IData and DataBase

All domain data implements IData (= string Id). DataBase<T> is an in-memory index of id → definition, and all domains share this single class generically.

var skills = new DataBase<SkillData>();
skills.Load(loader);              // full replace
skills.Add(loader);               // merge
SkillData s = skills.Get("fire_slash");
bool has   = skills.Has("fire_slash");

Source-agnostic — IDataLoader<T>

No matter where you read data from, it goes through the same boundary, IDataLoader<T>. The package provides two implementations.

JSON

Based on Newtonsoft.Json, it reads a top-level array as is. (No wrapper class needed.)

// Direct string
skills.Load(new JsonDataLoader<SkillData>(json));

// Deferred read (file/StreamingAssets/network)
skills.Load(new JsonDataLoader<SkillData>(
    () => File.ReadAllText(path)));
[
  { "id": "fire_slash", "cooldown": 5.0, "reactions": [ /* ... */ ] }
]

CSV

Uses the first row as the header and converts each row with ICsvMapper<T>. Quotes, commas, and newlines are supported.

skills.Load(new CsvDataLoader<SkillData>(
    () => File.ReadAllText(path), new SkillCsvMapper()));

ICsvMapper<T> implementations are usually generated by the Type Designer.

Custom sources

For binary, ScriptableObject, in-house formats, etc., you only need to implement IDataLoader<T>.

public sealed class MyBinaryLoader<T> : IDataLoader<T> where T : IData
{
    public IReadOnlyList<T> Load() { /* decode directly */ }
}

JSON in the editor, CSV/Remote in production — you just swap out the source.

Data format (reactions)

Domain data inherits from EntityData. The common fields are id, stats, and reactions.

[Serializable]
public class SkillData : EntityData   // inherits id / stats / reactions
{
    public float cooldown;
    public float castTime;
}
{
  "id": "fire_slash",
  "cooldown": 5.0,
  "stats": { "manaCost": 20 },
  "reactions": [
    {
      "trigger": "on_use",
      "conditions": [{ "type": "alive" }],
      "effects": [{ "type": "damage", "params": { "power": 1.8 } }]
    }
  ]
}

params is an arbitrary key-value (ParamBag) that effects/conditions read with type conversion, like ctx.Params.Get<float>("power").