thepeanutgalleryandco/create-and-mint-nft-collection

[FEATURE] Layer Combination Exclusions

Closed this issue · 10 comments

Summary

Add the ability to exclude certain layer item combinations from appearing on the art being generated.

Basic example

If I have a character layer with one item, hair layer with two items and glasses with three items.

Character:
main.png

Hair:
short.png
long.png

Glasses:
funky.png
square.png
oversized.png

I do not want my art generations to contain a combination of long.png and oversized.png, but all other combinations should be able to generate.

Motivation

Users would like to be able to to skip certain combinations as their art work does not look correct when certain combinations are used.

As written by arnaugm (Thank you very much for the work done here)

If for any reason the artist doesn't want two specific traits to appear together, they can be defined as incompatible.

Let's consider an example where we are creating a character with a hat and a background among other layers. And we don't want to generate the character with a white hat if the background is also wait because we don't like how they look together. We can exclude this combination in the configuration.

These incompatibilities can be configured at a layer configuration level with the option incompatibleTraits which is an object where the keys are traits in the format / and the value is an array of all the traits that are incompatible with this one using the same / format.

Example:

const layerConfigurations = [
  {
    growEditionSizeTo: 5,
    layersOrder: [
      { name: "Background" },
      { name: "Eyeball" },
      { name: "Eye color" },
      { name: "Iris" },
      { name: "Shine" },
      { name: "Bottom lid" },
      { name: "Top lid" },
    ],
    incompatibleTraits: {
      "Eye color/Cyan": [
        "Eyeball/Red",
      ],
      "Iris/Large": [
        "Bottom lid/High",
        "Top lid/High",
      ],
    }
  },
];

If the art engine generates a new artwork that contains 2 incompatible traits, this new piece will be discarded and a notification will be displayed in the console with the message:

Combination of traits excluded because of exclusion rules!
The creation of artworks will continue generating new combinations as usual.

This option will reduce the number of possible combinations and could be possible that the collection can not reach the requested number of elements. In this case reduce the number of incompatibilities or provide more traits in the layers that has less options to increase the probability of selecting different traits.

If the option is not defined the restriction is not applied.

I have introduced this functionality into my repo and have slightly modified the error that gets returned to the screen to "Combination of traits excluded because of incompatible layers exclusion rule!"

Users can now make use of the incompatibleTraits configuration within their layer configuration to excluded or force certain trait combinations.

incompatibleTraits: {
      "Eye color/Cyan": [
        "Eyeball/Red",
      ],
      "Iris/Large": [
        "Bottom lid/High",
        "Top lid/High",
      ],
    }

I'm doing a simple test, I want the spider body and spider head to just go together. But this didn't work. What am I doing wrong?

build
config
layers

@cesar4design uou are 50% there. You have set that when Corpo Spider is chosen, then Head Spider should also be chosen. You also need to say that when Head Spider is chosen, only Corpo Spider can be chosen.

@cesar4design you do not have any rarities specified, so first add the correct naming convention for your files as per the sample files provided in the code repo.

Hi! I am using this configuration to exclude the layer, when specific layer item generates. But it doesn't work as expected.
I expect that if Iris/Large generates, then no item from Bottom lid and Top lid layers will be generated

const layerConfigurations = [ { growEditionSizeTo: 20, maxRepeatedTraits: 10, layersOrder: [ { name: "Background" }, { name: "Eyeball" }, { name: "Eye color" }, { name: "Iris" }, { name: "Shine" }, { name: "Bottom lid"}, { name: "Top lid" }, ], incompatibleTraits: { "Iris/Large": [ "Bottom lid/*", "Top lid/*", ], }, }, ];
7

Screen Shot 2022-09-06 at 2 46 26 PM

i wanted to have dependentTrait function such that petals on ground should match color of flower. dependentTraits: { "ACC/PAT/ACC_PAT_BLACK-METAL":["FLO/FLO_BLACKMETAL",], "ACC/PAT/ACC_PAT_CARBON":["FLO/FLO_CARBON",], "ACC/PAT/ACC_PAT_CD":["FLO/FLO_CD",], "ACC/PAT/ACC_PAT_COLA":["FLO/FLO_COLA",], "ACC/PAT/ACC_PAT_DOLLAR":["FLO/FLO_DOLLAR",], "ACC/PAT/ACC_PAT_fabric":["FLO/FLO_FABRIC",], "ACC/PAT/ACC_PAT_GLASS":["FLO/FLO_GLASS",], "ACC/PAT/ACC_PAT_GOLD":["FLO/FLO_GOLD",], "ACC/PAT/ACC_PAT_JEANS":["FLO/FLO_JEANS",], "ACC/PAT/ACC_PAT_MARBLE":["FLO/FLO_MARBLE",], "ACC/PAT/ACC_PAT_METALIC":["FLO/FLO_METALIC",], "ACC/PAT/ACC_PAT_OVO":["FLO/FLO_OVO",], "ACC/PAT/ACC_PAT_PAINTEDMETAL":["FLO/FLO_PAINTEDMETAL",], "ACC/PAT/ACC_PAT_SELVER":["FLO/FLO_SELVER",], "ACC/PAT/ACC_PAT_VELVET_BLACK":["FLO/FLO_VELVET_BLACK",], "ACC/PAT/ACC_PAT_VELVET_BLOOD":["FLO/FLO_VELVET_BLOOD",], "ACC/PAT/ACC_PAT_VELVET_BROWN":["FLO/FLO_VELVET_BROWN",], "ACC/PAT/ACC_PAT_VELVET_CYAN":["FLO/FLO_VELVET_CYAN",], "ACC/PAT/ACC_PAT_VELVET_GREEN":["FLO/FLO_VELVET_GREEN",], "ACC/PAT/ACC_PAT_VELVET_LAVANDER1":["FLO/FLO_VELVET_LAVANDER1",], "ACC/PAT/ACC_PAT_VELVET_LAVANDER2":["FLO/FLO_VELVET_LAVANDER2",], "ACC/PAT/ACC_PAT_VELVET_ORANGE":["FLO/FLO_VELVET_ORANGE",], "ACC/PAT/ACC_PAT_VELVET_PASTELRED":["FLO/FLO_VELVET_PASTELRED",], "ACC/PAT/ACC_PAT_VELVET_PASTELRED":["FLO/FLO_VELVET_PINK",], "ACC/PAT/ACC_PAT_VELVET_RED":["FLO/FLO_VELVET_RED",], "ACC/PAT/ACC_PAT_VELVET_SKY":["FLO/FLO_VELVET_SKY",], "ACC/PAT/ACC_PAT_VELVET_TIFFANYBLUE":["FLO/FLO_VELVET_TIFFANYBLUE",], "ACC/PAT/ACC_PAT_VELVET_VIOLET":["FLO/FLO_VELVET_VIOLET",], "ACC/PAT/ACC_PAT_VELVET_VIOLET1":["FLO/FLO_VELVET_VIOLET1",], "ACC/PAT/ACC_PAT_VELVET_WHITE-":["FLO/FLO_VELVET_WHITE",], "ACC/PAT/ACC_PAT_VELVET_YELLOW":["FLO/FLO_VELVET_YELLOW",], } what am i doing wrong

Hi! I am using this configuration to exclude the layer, when specific layer item generates. But it doesn't work as expected. I expect that if Iris/Large generates, then no item from Bottom lid and Top lid layers will be generated

const layerConfigurations = [ { growEditionSizeTo: 20, maxRepeatedTraits: 10, layersOrder: [ { name: "Background" }, { name: "Eyeball" }, { name: "Eye color" }, { name: "Iris" }, { name: "Shine" }, { name: "Bottom lid"}, { name: "Top lid" }, ], incompatibleTraits: { "Iris/Large": [ "Bottom lid/*", "Top lid/*", ], }, }, ]; 7

Apologies, the * setting does not actually work. A few other users tested as well. I will be removing it from the comments.

Screen Shot 2022-09-06 at 2 46 26 PM

i wanted to have dependentTrait function such that petals on ground should match color of flower. dependentTraits: { "ACC/PAT/ACC_PAT_BLACK-METAL":["FLO/FLO_BLACKMETAL",], "ACC/PAT/ACC_PAT_CARBON":["FLO/FLO_CARBON",], "ACC/PAT/ACC_PAT_CD":["FLO/FLO_CD",], "ACC/PAT/ACC_PAT_COLA":["FLO/FLO_COLA",], "ACC/PAT/ACC_PAT_DOLLAR":["FLO/FLO_DOLLAR",], "ACC/PAT/ACC_PAT_fabric":["FLO/FLO_FABRIC",], "ACC/PAT/ACC_PAT_GLASS":["FLO/FLO_GLASS",], "ACC/PAT/ACC_PAT_GOLD":["FLO/FLO_GOLD",], "ACC/PAT/ACC_PAT_JEANS":["FLO/FLO_JEANS",], "ACC/PAT/ACC_PAT_MARBLE":["FLO/FLO_MARBLE",], "ACC/PAT/ACC_PAT_METALIC":["FLO/FLO_METALIC",], "ACC/PAT/ACC_PAT_OVO":["FLO/FLO_OVO",], "ACC/PAT/ACC_PAT_PAINTEDMETAL":["FLO/FLO_PAINTEDMETAL",], "ACC/PAT/ACC_PAT_SELVER":["FLO/FLO_SELVER",], "ACC/PAT/ACC_PAT_VELVET_BLACK":["FLO/FLO_VELVET_BLACK",], "ACC/PAT/ACC_PAT_VELVET_BLOOD":["FLO/FLO_VELVET_BLOOD",], "ACC/PAT/ACC_PAT_VELVET_BROWN":["FLO/FLO_VELVET_BROWN",], "ACC/PAT/ACC_PAT_VELVET_CYAN":["FLO/FLO_VELVET_CYAN",], "ACC/PAT/ACC_PAT_VELVET_GREEN":["FLO/FLO_VELVET_GREEN",], "ACC/PAT/ACC_PAT_VELVET_LAVANDER1":["FLO/FLO_VELVET_LAVANDER1",], "ACC/PAT/ACC_PAT_VELVET_LAVANDER2":["FLO/FLO_VELVET_LAVANDER2",], "ACC/PAT/ACC_PAT_VELVET_ORANGE":["FLO/FLO_VELVET_ORANGE",], "ACC/PAT/ACC_PAT_VELVET_PASTELRED":["FLO/FLO_VELVET_PASTELRED",], "ACC/PAT/ACC_PAT_VELVET_PASTELRED":["FLO/FLO_VELVET_PINK",], "ACC/PAT/ACC_PAT_VELVET_RED":["FLO/FLO_VELVET_RED",], "ACC/PAT/ACC_PAT_VELVET_SKY":["FLO/FLO_VELVET_SKY",], "ACC/PAT/ACC_PAT_VELVET_TIFFANYBLUE":["FLO/FLO_VELVET_TIFFANYBLUE",], "ACC/PAT/ACC_PAT_VELVET_VIOLET":["FLO/FLO_VELVET_VIOLET",], "ACC/PAT/ACC_PAT_VELVET_VIOLET1":["FLO/FLO_VELVET_VIOLET1",], "ACC/PAT/ACC_PAT_VELVET_WHITE-":["FLO/FLO_VELVET_WHITE",], "ACC/PAT/ACC_PAT_VELVET_YELLOW":["FLO/FLO_VELVET_YELLOW",], } what am i doing wrong

The code base unfortunately does not allow for sub folders within layers, this is why its not working.