Mod Metadata - Ijwu/PhoenixPointModLoader GitHub Wiki

Mod Metadata

This page is intended to provide mod authors with an overview of mod metadata files and their expected format.

Mod Metadata File

Any mod may optionally ship with a metadata file which should be named similarly to the mod's containing assembly. The expected extension for these files is .json. As an example, if I ship a mod with a DLL named DummyMod.dll then the metadata file should be named DummyMod.json.

My reasoning for this naming scheme is that it will be easier to sort as an end-user. If you have 5 mods and each mod ships metadata then you don't need to look very hard to know which JSON file goes to which DLL.

Mod Metadata Format

The mod metadata format is simply the ModMetadata class found in PhoenixPointModLoader/PhoenixPointModLoader/Manager/ModMetadata.cs serialized to JSON. There are four main fields:

  • string Name
  • string Description
  • Version Version
  • List<ModMetadata> Dependencies

Each field may be filled in any form that Newtonsoft.JSON will deserialize. For example, you do not need to insert an object which matches the Version class structure. Newtonsoft is happy to deserialize the string "1.2" to an equivalent object. (new Version(1,2))

Example Metadata File

{
  "Name": "Example Metadata",
  "Description": "This is an example metadata file for a non-existent mod.",
  "Version": "1.0",
  "Dependencies": [
    {
      "Name": "Another Non-Existent Mod",
      "Version": "1.2"
    }
  ]
}

Default Mod Metadata

If the mod loader cannot find or cannot load an appropriate metadata file for a mod, then it will create a fake, default, metadata. This is done by using the mod class's fully qualified type name for the Name field and the version "0.0" for the Version field.

No other fields are defaulted.