Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Layer Maximum Repeatability Settings #16

Closed
thepeanutgalleryandco opened this issue Feb 2, 2022 · 3 comments · Fixed by #21
Closed

[FEATURE] Layer Maximum Repeatability Settings #16

thepeanutgalleryandco opened this issue Feb 2, 2022 · 3 comments · Fixed by #21
Assignees
Labels
enhancement New feature or request

Comments

@thepeanutgalleryandco
Copy link
Owner

thepeanutgalleryandco commented Feb 2, 2022

Summary

Add the ability to set the maximum number of times that a specific layer can repeat / be part of the collection.

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

Maximum layer repeatability: If I set my Glasses layer's maximum repeatability to 1, then only a single art work that gets generated will have one of the 3 glasses layer items. So with the layers, there would then be art work items generated:

  1. main.png + short.png
  2. main.png + long.png
  3. main.png + (short.png OR long.png) + (funky.png OR square.png OR oversized.png)

Motivation

Users would like to be able to force rarity on certain layers for their collections.

@thepeanutgalleryandco thepeanutgalleryandco added the enhancement New feature or request label Feb 2, 2022
@thepeanutgalleryandco thepeanutgalleryandco self-assigned this Feb 2, 2022
@thepeanutgalleryandco thepeanutgalleryandco changed the title [FEATURE] Layer And Layer Items Maximum Repeatability Settings [FEATURE] Layer Maximum Repeatability Settings Feb 3, 2022
@thepeanutgalleryandco
Copy link
Owner Author

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

It can be configured at a layer configuration level with the option maxRepeatedTraits which expects a numeric value.

Example:

const layerConfigurations = [
  {
    growEditionSizeTo: 5,
    maxRepeatedTraits: 2,
    layersOrder: [
      { name: "Background" },
      { name: "Eyeball" },
      { name: "Eye color" },
      { name: "Iris" },
      { name: "Shine" },
      { name: "Bottom lid" },
      { name: "Top lid" },
    ],
  },
];

If for example this value is set to 2, whenever the art engine generates a new artwork that contains 3 or more traits already present in one of the pieces already created for the collection, 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 increase the number of maximum repetitions 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.

@thepeanutgalleryandco
Copy link
Owner Author

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 maximum repeatability exclusion rule!"

@thepeanutgalleryandco
Copy link
Owner Author

Users can now make use of the maxRepeatedTraits configuration within their layer configuration set to allow the layers within that specific set to be generated only X number of times.

maxRepeatedTraits: 2

@thepeanutgalleryandco thepeanutgalleryandco linked a pull request Feb 4, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

1 participant