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

bypassDNA generated duplicate characters - uniqueness check doesn't work? #212

Closed rakuscinec closed 1 year ago

rakuscinec commented 2 years ago

Hello, I noticed that having bypassDNA set to true causes engine to generate duplicate images (with different background).

I used freshly cloned repository and changed just layers configuration: Without bypassDNA:

const layerConfigurations = [
  {
    growEditionSizeTo: 100,
    namePrefix: "Series 2", // Use to add a name to Metadata `name:`
    layersOrder: [
      { name: "Background" },
      {
        name: "Back Accessory",
        // options: {
        //   bypassDNA: true,
        // },
      },
      { name: "Head" },
      // { name: "Clothes" },
      { name: "Eyes" },
      { name: "Hair" },
      // { name: "Head Accessory" },
      // { name: "Shirt Accessories" },
    ],
  },
  // {
  //   growEditionSizeTo: 10,
  //   namePrefix: "Lion",
  //   resetNameIndex: true, // this will start the Lion count at #1 instead of #6
  //   layersOrder: [
  //     { name: "Background" },
  //     { name: "Hats" },
  //     { name: "Male Hair" },
  //   ],
  // },
];

npm run build ends with "You need more layers or elements to grow your edition to 100 artworks!" and generates only 23 images

$ ls  build/json/| wc -l
      24 (24th file is _metadata.json)

When I set bypassDNA: true for background layer

const layerConfigurations = [
  {
    growEditionSizeTo: 100,
    namePrefix: "Series 2", // Use to add a name to Metadata `name:`
    layersOrder: [
      { name: "Background", options: { bypassDNA: true, } },
      {
        name: "Back Accessory",
        // options: {
        //   bypassDNA: true,
        // },
      },
      { name: "Head" },
      // { name: "Clothes" },
      { name: "Eyes" },
      { name: "Hair" },
      // { name: "Head Accessory" },
      // { name: "Shirt Accessories" },
    ],
  },
  // {
  //   growEditionSizeTo: 10,
  //   namePrefix: "Lion",
  //   resetNameIndex: true, // this will start the Lion count at #1 instead of #6
  //   layersOrder: [
  //     { name: "Background" },
  //     { name: "Hats" },
  //     { name: "Male Hair" },
  //   ],
  // },
];

and run npm run build; 100 images are generated with duplicate characters (and different background, of course);

$ ls  build/json/| wc -l
     101 (101st file is _metadata.json)

Duplicate characters are here (character 16 and 17):

$ cat build/json/16.json 
{
  "dna": "73e73b624246b4db1a48c99acf111dac8c50fec4965650b1563170f7bd612d94",
  "name": "Series 2 #16",
  "description": "This is the description of your NFT project, remember to replace this",
  "image": "ipfs://NewUriToReplace/16.png",
  "imageHash": "84a365ff615808c2ffd7449ecdbe0cbf759a6600f08d65ccf5204d4660489c45",
  "edition": 16,
  "date": 1655991591899,
  "attributes": [
    {
      "trait_type": "Background",
      "value": "stars"
    },
    {
      "trait_type": "Back Accessory",
      "value": "Backpack"
    },
    {
      "trait_type": "Head",
      "value": "faceB"
    },
    {
      "trait_type": "Eyes",
      "value": "eyesa"
    },
    {
      "trait_type": "Hair",
      "value": "Clippingexample_0002_bluehair"
    }
  ],
  "compiler": "HashLips Art Engine - NFTChef fork"
}
cat build/json/17.json 
{
  "dna": "32776b81f81b4d75971681c704b9a60c8a0ebc94a597189d0b7e725f699578a0",
  "name": "Series 2 #17",
  "description": "This is the description of your NFT project, remember to replace this",
  "image": "ipfs://NewUriToReplace/17.png",
  "imageHash": "9092196e3e8418f7f54831dac5af625340c747dad1ea25762b29eaf934f34999",
  "edition": 17,
  "date": 1655991592033,
  "attributes": [
    {
      "trait_type": "Background",
      "value": "coulds"
    },
    {
      "trait_type": "Back Accessory",
      "value": "Backpack"
    },
    {
      "trait_type": "Head",
      "value": "faceB"
    },
    {
      "trait_type": "Eyes",
      "value": "eyesa"
    },
    {
      "trait_type": "Hair",
      "value": "Clippingexample_0002_bluehair"
    }
  ],
  "compiler": "HashLips Art Engine - NFTChef fork"
}

Although the Background layer should be excluded from DNA calculation, the DNA generated for character 16 and 17 are different.

My goal is to ensure 100% of generated characters are unique no matter what background is used. Is there a way to achieve this? Thank you!

celsosa commented 2 years ago

I need the same solution

ilanssari commented 2 years ago

Hello guys, same case. @rakuscinec did you manage to resolve this issue?

nftchef commented 1 year ago

Improvements/fixes were made to fix bypassDNA in 1ebc82c36dd2b39306fc617e4530d407e9f9cf61 This should no longer be an issue.

If something comes up, please open a new issue