HashLips / hashlips_art_engine

HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers.
MIT License
7.18k stars 4.3k forks source link

Making at least 2 or 3 different layers #889

Open codehakan opened 2 years ago

codehakan commented 2 years ago

Hello,

I have 12 layers. Production is provided even with only 1 change in the default settings. But I want to change that. For example, I don't want everything to be the same in 12 layers and only the background to be different. In other words, I want production to occur when there are at least 3 changes. Can anyone help on how I can do this?

bolshoytoster commented 2 years ago

@codehakan do you mean you don't want the images to be too similar?

codehakan commented 2 years ago

@codehakan do you mean you don't want the images to be too similar?

@bolshoytoster Yes. For example, the only difference between the 200th produced NFT and the 201st produced NFT is only the background color. I don't want a single difference. I want it to be 2 or 3 differences. The difference between it and the previously produced picture should not be the only one. That is, in the 300th NFT, the eye color is blue, and in the 301st NFT, the eye color is green. I said the numbers 200 and 300 as an example.

bolshoytoster commented 2 years ago

@codehakan in src/main.js ~line 277: https://github.com/HashLips/hashlips_art_engine/blob/d8ee279043d2d4a8de3bdfac0d89d0e966fb04a2/src/main.js#L277-L280

You could replace that function with:

const isDnaUnique = (_DnaList = new Set(), _dna = "") => {
  const MAX_OVERLAP = 8;
  const _filteredDNA = filterDNAOptions(_dna);
  return Array.from(_DnaList).find(
    x => x.split(DNA_DELIMITER).filter(
      y => _filteredDNA.split(DNA_DELIMITER).includes(y)
    ).length > MAX_OVERLAP
  ) == undefined;
};

Then change MAX_OVERLAP to be the max number of layers you want to be the same.

I haven't tested this and it's quite inefficient, but it might work.

codehakan commented 2 years ago

@bolshoytoster thanks. But im taking error.

(node:24012) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead

TypeError: _DnaList.find is not a function at isDnaUnique (C:\Users\hakan\Desktop\hashlips_art_engine-main\src\main.js:286:14) at startCreating (C:\Users\hakan\Desktop\hashlips_art_engine-main\src\main.js:377:11) at C:\Users\hakan\Desktop\hashlips_art_engine-main\index.js:6:3 at Object. (C:\Users\hakan\Desktop\hashlips_art_engine-main\index.js:7:3)

bolshoytoster commented 2 years ago

@codehakan if you add console.log(_DnaList) at the start of the function and run it again what does it say?

codehakan commented 2 years ago

@bolshoytoster

Output: Set(0) {}

bolshoytoster commented 2 years ago

@codehakan I think you could change the line:

  return _DnaList.find(

to

  return _DnaList.values.find(
codehakan commented 2 years ago

@bolshoytoster image

bolshoytoster commented 2 years ago

@codehakan sorry, It's meant to be

  return _DnaList.values().find(
codehakan commented 2 years ago

@bolshoytoster ☹️

image

bolshoytoster commented 2 years ago

@codehakan I've actually tested it this time:

  return Array.from(_DnaList).find(
codehakan commented 2 years ago

@bolshoytoster yup, its working. 👍 But not generating NFT. Console log always saying "DNA exists!". 🤔

I tried change MAX_OVERLAP with 1,2,3,4,5,6,7. But nothing happened.

bolshoytoster commented 2 years ago

@codehakan how many layers do you have?

codehakan commented 2 years ago

@bolshoytoster i have 12 layers.

bolshoytoster commented 2 years ago

@codehakan set MAX_OVERLAP to 11 and decrease it until you grt whst you want.

designoor commented 2 years ago

@bolshoytoster thank you, works like a charm!