Writing a manifest.json
The manifest describes a template in one file: its canvas, layers, traits, weights and rules. The platform writes it for you; write your own only to bring structure in with an upload.
A manifest is a JSON file. Start from an export of an existing template if you can: it is always valid. The Export tab of any template, a sample set or a DappFactory starter, gives you one.
{
"format": "dappfactory.template",
"manifestVersion": 2,
"name": "Whisker and Paws Club",
"kind": "collectible",
"templateVersion": 1,
"canvas": { "width": 3000, "height": 3000 },
"subjectLayer": "Body",
"layers": [
{
"order": 1,
"name": "Background",
"optional": false,
"usedWhen": "always",
"traits": [
{ "name": "Sage", "weight": 11, "file": "01-Background/Sage.png" },
{ "name": "Night", "weight": 5, "file": "01-Background/Night.png" }
]
},
{
"order": 2,
"name": "Body",
"traits": [
{ "name": "Ginger cat", "weight": 12, "subject": "Cat", "file": "02-Body/Ginger cat.png" },
{ "name": "Black dog", "weight": 10, "subject": "Dog", "file": "02-Body/Black dog.png" }
]
},
{
"order": 3,
"name": "Whiskers",
"optional": true,
"noneWeight": 30,
"usedWhen": { "layer": "Body", "traits": ["Ginger cat"] },
"traits": [ { "name": "Long", "weight": 10, "file": "03-Whiskers/Long.png" } ]
}
],
"rules": [
{ "type": "exclude", "if": { "layer": "Body", "trait": "Black dog" }, "then": { "layer": "Whiskers", "trait": "any" } }
]
}
Top-level fields
| Field | Meaning |
|---|---|
format | Always "dappfactory.template". |
manifestVersion | 2 for most templates. 3 if you use roles or one-of-ones. |
name | The template's name. You can change it on the editor screen. |
kind | collectible, drop, marketplace or keepsake. The page you upload on decides the kind of the new template. |
canvas | The size every PNG must be: { "width": 3000, "height": 3000 } or "3000x3000". If most files are another size, the files' size is used. |
subjectLayer | The layer that says what each item is. Optional. |
layers | The list of layers. |
rules | Never-together and requires rules. Optional. |
Layer fields
| Field | Meaning |
|---|---|
order | Drawing order, 1 at the bottom. Layers are sorted by it. |
name | Shown in the editor and written into each item's traits. |
on | false keeps the layer without drawing it. Default true. |
optional | true lets an item have nothing from this layer. |
noneWeight | How often an optional layer is left empty, as a weight next to its traits. Default 50. |
usedWhen | "always", or { "layer": "Body", "traits": ["Ginger cat"] } to draw the layer only for those traits. |
traits | The list of traits. |
Trait fields
| Field | Meaning |
|---|---|
name | The trait's name. |
weight | How often it's drawn, relative to the others in its layer. Default 1. |
file | Path to the PNG inside the zip, such as "01-Background/Sage.png". Leave it out for a placeholder. |
on | false keeps it without drawing it. |
subject | On the subject layer: what this trait makes the item, such as "Cat". |
tier | Optional: Gold, Silver, Bronze or Participant. The trait is drawn only for pieces of that rank tier. Leave it out for a trait open to every tier. |
A trait can also be just a name, such as "Sage", which makes a placeholder with weight 1.
Rules
Each rule names an if trait and a then trait. Type "exclude" means they never appear together; "requires" means the first always comes with the second. Use "trait": "any" in then to mean any trait in that layer. A rule that names a trait the set doesn't have is dropped, and the checks say so.
Roles and one-of-ones (manifestVersion 3)
- A Role layer: add
"role": trueto one layer. It can't be optional or have ausedWhen, a template can have only one, and keepsakes can't have one. With a Role layer, the role is the subject, so leavesubjectLayerout. - Roles have no picture. Leave out
fileon role traits, except one-of-ones. - One-of-ones:
"oneOfOne": trueon a Role-layer trait with a complete, fully opaque picture. It's drawn once in the whole collection. - Shown for:
"usedWhen": { "role": ["Angel"] }on a trait in another layer limits it to those roles. Every name must be a role.
See Named roles in templates for what these do when pieces are drawn.
What an export adds
A manifest the platform writes carries a few more fields: each layer's folder, a placeholder mark on traits still waiting for art, and the size of the placeholder images. Leave them as they are; you never need to write them yourself.