Creating A New System For Foundry VTT: The Data Template Title Screen

3- Creating A New System For Foundry VTT: The Data Template

Every Foundry VTT requires a Data Template which defines the Actor and Item entities in the new Foundry System.  In this article, I will explain how to set up the Data Template to create a simple character definition.

Creating A New System For Foundry VTT Part 3: The Data Template

In addition to the Manifest File, each Foundry VTT System requires a Data Template file.

This file defines the database models for the various Actor and Item entities in the System.

Actors are used for representing Characters, NPCs, and even Monsters or Vehicles in your System.

Items are used to describe objects and things you might find in your character's inventory, such as treasure, armor, or weapons.

Items are also used to describe Skills, Feats, Advantages, and other things that aren't tangible objects.

 

template.json - The Data Template File

This file must be located on the root level of your System folder, alongside the system.json file.

Here's the sample template.json file:

{userData}/Data/systems/mysystem/template.json

{
"Actor": {
  "types": ["hero", "pawn", "villain"],
  "templates": {
    "background": {
      "biography": "",
      "hairColor": "blue"
    },
    "resources": {
      "health": {
        "min": 0,
        "value": 10,
        "max": 10
      },
      "power": {
        "min": 0,
        "value": 1,
        "max": 3
      }
    }
  },
  "hero": {
    "templates": ["background", "resources"],
    "goodness": {
      "value": 5,
      "max": 10
    }
  },
  "pawn": {
    "templates": ["resources"]
  },
  "villain": {
    "templates": ["background", "resources"],
    "wickedness": {
      "value": 5,
      "max": 100
    }
  }
},
"Item": {
  "types": ["weapon", "spell"],
  "templates": {
    "rarity": {
      "rarity": "Common",
      "price": 20
    }
  },
  "weapon": {
    "templates": ["rarity"],
    "damage": 5
  },
  "spell": {
    "templates": ["rarity"],
    "cost": 2
  }
}
}

 

template.json Explained

The two top-level entity types are Actor and Item.

Within each type of entity, you can use the "types" array to define variations of the parent entity.

Actors

In our example above the Actor entity has the following three subtypes:

  1. hero
  2. pawn
  3. villain

Next, use the "templates" object to extend the subtypes with common attributes.

In our example, there is a "resources" object that defines an Actor's Health and Power attributes.

There is also a "background" object that provides for a "biography" and "hairColor" attribute.

In the example, all Actors are given a "resources" object, but only the hero and villain entities get backgrounds.

You can overwrite and extend entities just by adding additional fields.

In our example, you can see that "hero" includes the background and resources templates defined under Actor in addition to a "goodness" attribute.

Likewise, the "villain" includes the background and resources templates but instead of "goodness", she gets a "wickedness" attribute.

Items

In our example, we see weapons and spells are defined.

A common set of attributes defined as "rarity" is created and assigned to both weapons and spells.

 

Data Types

When creating your own Data Template, you can use the following three data types:

  1. string (enclosed in quotation marks, ie- "weapon")
  2. number (just a plain real numbers without quotes, ie- 123 or 3.21)
  3. boolean (TRUE or FALSE)

 

Resource Keys

If you want to display a status bar on your token, you will need a value and max key for the associated attribute.

For instance, if you plan to show an HP status bar on your token, you might do the following:

"hero": {
    "hitpoints": {
        "value": 10,
        "max": 10
    }
}
 
 

Your Turn: What Do You Do?

Jot down some ideas for a basic character definition for your favorite game.  Keep it simple and expand upon it later.

What is the one item your character needs? Create a basic item definition.

Make your own tempalte.json file with the Actor and Item definitions you created based on your notes above.

Tell me about it in the Comments Section.  I'm interested in what you have to say about creating your own Foundry VTT Data Template.

 

Check out the next article in this series: Creating A New System For Foundry VTT: The Actor Data Template


 

E-mail Notification Opt-in

Do you want to receive email notifications when we add new game design content?

Sign up on our private mailing list.

YES! Notify me of new game design posts!

Sign up for tips and tricks to make your own RPG.

We don't share your info or spam you. Unsubscribe any time.


Print   Email
Add comment


Related Articles