Skip to content

Create and Import a Package

Michael Huyler edited this page Feb 9, 2024 · 1 revision

Create and Import a Package

Once you have a server up and running, you can begin importing game packages. But first, you'll need to have packages to import.

Create a Package

Packages

Packages define a game and contain relevant information for importing and displaying Bestiary entries.

A package is a package.json file, which contains the following data:

{
    "metadata": {
        "name": "<Game name>",
        "ns": "<Namespace/unique package prefix>",
        "icon": "<Relative path to the game's icon>",
        "langs": [ "<List of ISO-639 languages the game supports>" ],
        "groups": [
            {
                "ns": "<Group namespace/unique prefix>",
                "name": "<Group name>"
            }
        ]
    },
    "groups": [
        {
            "ns": "<Group namespace/unique prefix>",
            "entries": [
                {
                    "bid": "<Unique entry Bestiary ID>",
                    ... // attributes for each entry
                }
            ]
        }
    ],
    "resources": [
        {
            "resId": "<Unique resource ID>",
            "values": {
                "<Supported language>": "<Resource value>",
                ...
            }
            // or
            "resId": "<Unique resource ID>",
            "type": "<Resource type (currently only 'image' is supported)>",
            "basePath": "<Path to image resource>"
        }
    ]
}

Groups

Group represent each "type" of entry within a game.

A group can be pretty much any plural thing in a game, such as "monsters," "items," or "abilities." Groups are shown on the left edge once a game package has been selected, and can be configured to include collections.

Collections are user-configured, and display as small banners next to each entry in a group. Users can add and remove entries to their collections at will, and collection stats are shown at the top of the group panel.

Entries

Entries represent individual items within a group.

An entry can be pretty much any singular thing in a game, such as "Slime," "Iron Broadsword," or "Gold." Entries for a particular group are shown in the main panel, and can be clicked on to open the Bestiary page for that entry.

Some entries may also contain links to other entries, and links can even be made across groups.

An entry contains all of the attributes particular to itself, as well as links to other entries. Links take the following form:

{
    "type": "link",
    "group": "<Group namespace to link to>",
    "id": "<Entry bestiary ID to link to>"
}

Import a Package

Once you've created a package, you can import it via File -> Dev Options -> Import (Ctrl+I).

In order for Bestiary to detect all necessary import data, the package folder should exist in the Bestiary folder, which can be found in the following locations:

  • %LocalAppData%/Bestiary on Windows
  • ~/Library/Application Support/Bestiary on macOS
  • ~/.local/share/Bestiary or $XDG_DATA_HOME/Bestiary on Linux.

Within the Bestiary folder, create a subfolder - the name does not matter.

On Windows, create your package subfolder inside the Data folder.

Place the contents of the package within this subfolder so package.json is at the root of the subfolder. The folder structure should look like this:

<BestiaryData>/<package namespace>/package.json
""             ""                 /icon.png
""             ""                 /images/<supported languages>/
""             ""                 /layout/preview
""             ""                  ""    /view

Any errors encountered during the import are logged to the console.

Clone this wiki locally