BenCreating / LPC-Spritesheet-Generator

A spritesheet generator for Liberated Pixel Cup characters
https://bencreating.github.io/LPC-Spritesheet-Generator/
MIT License
6 stars 1 forks source link

Data model: group related assets for different body types #13

Open bluecarrot16 opened 1 year ago

bluecarrot16 commented 1 year ago

I'd like to propose changing the structure of data in sheet-definitions.json:

There's a related issue with credits: in Sander's generator, credits are assigned to each image. In Ben's generator, they are assigned to the asset. In a lot of cases, one person draws the "male" version of the asset and someone else adapts it to the "female" (and other) version(s), so the credits for the male and female version of an asset are overlapping but not identical. In Ben's current setup, this situation kinda requires any two objects that have separate attributions to be separate "assets" (i.e. separate entries in resources/sheet-definitions.json.

I would propose that this generator adopt a model of "one asset, multiple images", similar to Sander's generator. In fact, perhaps we can (ab)use the notion of layers to implement this model, and create a "cascading" series of definitions: category > asset > layer:

Example:

"cape": {
    "solid": {
      "tags": [],
      "credits": {
        "authors": [
          "bluecarrot16",
          "David Conway Jr. (JaidynReiman)",
          "Nila122"
        ],
        "licenses": [
          "CC-BY-SA 3.0",
          "GPL 3.0"
        ],
        "links": [
          "https://opengameart.org/content/lpc-curly-hair-elven-ears-white-cape-with-blue-trim-and-more",
          "https://opengameart.org/content/lpc-roman-armor",
          "http://opengameart.org/content/lpc-clothing-updates"
        ],            
      },
      "palettes": [
        "cloth"
      ],
      "layers": {
        "male": {
          "excluded-by": [
            "child",
            "muscular",
            "female",
            "teen"
          ]
        },
        "female": {
          "excluded-by": [
            "child",
            "muscular",
            "male"
          ],
          "credits": {
            "append": true,
            "authors": [
              "someone_else_who_made_the_female_version"
            ],
            "links": [
              "http://opengameart.org/content/lpc-special-clothing-modifications"
            ],
          }
        },
        "solid_behind": {"z_position": 5 }
      }
    }
  }
BenCreating commented 1 year ago

I think this may be two related issues:

  1. Switch between equivalent assets when changing body type
  2. Simplify the management of attribution/licensing information by minimizing redundancy for related assets

1. Switching between equivalent assets

I'd prefer to add the concept of variants rather than trying to cram this into layers. This could be handled by either listing all information for each variant in a single asset as you suggest, or alternatively by only listing the names of equivalent items.

The second option would require duplicating the list of variants for each asset definition.

"cape-male": {
  "solid": {
    "tags": [],
    "credits": {
      "authors": [...],
      "licenses": [...],
      "links": [...],            
    },
    "palettes": [...],
    "layers": {
      "solid_behind": {"z_position": 5 }
    }
    "variants": [
      "cape-female",
      "cape-muscular",
      "cape-child"
    ]
  }
}

A third option with less duplication would be a single "parent" asset that only has the variants array.

I don't feel strongly about any of these options. There are advantages and disadvantages to each.

2. Managing attribution

I'm seeing three cases here:

  1. The assets are essentially the same item (e.g. pants for the male and female bases)
  2. An asset is derived from another, but the two are not interchangeable (e.g. the character base itself and any clothing item)
  3. An asset is derived from multiple sources

I propose that instead of a boolean append key, that it should be an array. We can then give it the names for any other assets, and append the authors and links from all of them.

We would need to settle on a standard format for referring to the assets, since at the moment names are only guaranteed to be unique within a category. Maybe the format category/asset, or an object with named keys { category: "body", name: "male" }