nftchef / art-engine

An advanced fork of the HashLips Art Engine with additional features to generate complex art from provided layers using the familiar Hashlips setup.
MIT License
427 stars 203 forks source link

Forced combinations is not working as expected #304

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello how are you?

Awesome library! So it seems forced combinations is not working as expected. Essentially it works sometimes but not always. What I mean is it does not match like its suppose to and sometimes matches other things together.

In this case I want the Service Shirt to Always match Servicer Visor and nothing else.

Here is an example:

Layer configuration

  {
    growEditionSizeTo: 20,
    namePrefix: “Series 1”, // Use to add a name to Metadata `name:`
    layersOrder: [
      { name: “Background” },
      { name: “Body” },
      { name: “Mouth” },
      { name: “Clothes” },
      { name: “Nose” },
      { name: “Eyes” },
      { name: “Traditional Hat”, trait: “Hat” }
    ],
  }

Forced Combinations

const forcedCombinations = {
  "Service Shirt": "Service Visor",
}

Output 1 Does't Work

Setting up the folling forced combinations for Service Shirt:  S e r v i c e   V i s o r
DNA: [
  '0.3:Indigo#833.png',
  '1.0:Skin#100.png',
  '2.9:Rage#698.png',
  '3.0:Service Shirt#970.png',
  '4.1:Curve#1104.png',
  '5.9:Determined#954.png',
  '6.2:Gold Crown#85.png'
]

Output 2 Works

Setting up the folling forced combinations for Service Shirt:  S e r v i c e   V i s o r

Adding the following to incompatible list Snake Crown
DNA: [
  ‘0.11:Violet Blue#833.png’,
  ‘1.0:Skin#100.png’,
  ‘2.8:Cool#1006.png’,
  ‘3.0:Service Shirt#970.png’,
  ‘4.3:Rounded#1112.png’,
  ‘5.9:Quick#954.png’,
  ‘6.0:Service Visor#555.png’
]

I also tried adding incompatible layers as a test and it still does not work always as expected (only sometimes)

const incompatible = {
  "Gown": ["Service Visor"],
  "Jacket": ["Service Visor"],
  "Suit": ["Service Visor"],
  "Service Visor": ["Gold Crown"]
};

Thanks for the help!

JohnCarp commented 1 year ago

It seems I'm experiencing the same thing. Any updates on this @nftchef ? Thanks!

nftchef commented 1 year ago

Hi @spike-hue

given your example:

const forcedCombinations = {
  "Service Shirt": "Service Visor",
}

forcedCombinations expects the right side value of the object to be an Array of items to match it with.

Solution:

const forcedCombinations = {
  "Service Shirt":[ "Service Visor"],
}

Notes: It looks like the output here is trying to split the "Service Visor" into a string and then trying to force combinations for files that are single-letter file names

Setting up the following forced combinations for Service Shirt:  S e r v i c e   V i s o r

your Output 2 where it selected the Service Visor was still not working correctly but happened to roll the trait randomly.

Hope that helps! @JohnCarp if you have similar issues, hope it fixes it, otherwise please reach out to me or open a discussion 🙇