Forced combinations is not working as expected #305
Replies: 3 comments 2 replies
-
It seems I'm experiencing the same thing. Any updates on this @nftchef ? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi @spike-hue given your example: const forcedCombinations = {
"Service Shirt": "Service Visor",
}
Solution: const forcedCombinations = {
"Service Shirt":[ "Service Visor"],
} Notes: 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! |
Beta Was this translation helpful? Give feedback.
-
@nftchef Thank you for response! Though this is still not clear. To make it easier I am using your sample project. Sample ProjectIn your sample project, I have this setup. I deleted some layers to make it simpler: const layerConfigurations = [
{
growEditionSizeTo: 10,
namePrefix: "Series 2",
layersOrder: [
{ name: "Clothes" },
{ name: "Shirt Accessories" },
],
},
]; I want to force const forcedCombinations = {
"gray tee": ["Golden Sakura"],
}; But this does not work the other way around. I expect The next thing I tried was adding the reverse inside const forcedCombinations = {
"gray tee": ["Golden Sakura"],
"Golden Sakura": ["gray tee"],
}; How can we make sure that const forcedCombinations = {
"gray tee": ["Golden Sakura"],
};
const incompatible = {
floral: ["Golden Sakura"],
"shirt one": ["Golden Sakura"],
"shirt two": ["Golden Sakura"],
}; Complete Config.js FileHere is my full "use strict";
const path = require("path");
const isLocal = typeof process.pkg === "undefined";
const basePath = isLocal ? process.cwd() : path.dirname(process.execPath);
// see src/blendMode.js for available blend modes
// documentation: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
const { MODE } = require(path.join(basePath, "src/blendMode.js"));
const buildDir = path.join(basePath, "/build");
const layersDir = path.join(basePath, "/layers");
/*********************
* General Generator Options
***********************/
const description =
"This is the description of your NFT project, remember to replace this";
const baseUri = "ipfs://NewUriToReplace";
const outputJPEG = false; // if false, the generator outputs png's
/**
* Set your tokenID index start number.
* ⚠️ Be sure it matches your smart contract!
*/
const startIndex = 0;
const format = {
width: 512,
height: 512,
smoothing: true, // set to false when up-scaling pixel art.
};
const background = {
generate: false,
brightness: "80%",
};
const layerConfigurations = [
{
growEditionSizeTo: 10,
namePrefix: "Series 2",
layersOrder: [
{ name: "Clothes" },
{ name: "Shirt Accessories" },
],
},
];
/**
* Set to true for when using multiple layersOrder configuration
* and you would like to shuffle all the artwork together
*/
const shuffleLayerConfigurations = false;
const debugLogs = true;
/*********************
* Advanced Generator Options
***********************/
// if you use an empty/transparent file, set the name here.
const emptyLayerName = "NONE";
/**
* Incompatible items can be added to this object by a files cleanName
* This works in layer order, meaning, you need to define the layer that comes
* first as the Key, and the incompatible items that _may_ come after.
* The current version requires all layers to have unique names, or you may
* accidentally set incompatibilities for the _wrong_ item.
*/
const incompatible = {
floral: ["Golden Sakura"],
"shirt one": ["Golden Sakura"],
"shirt two": ["Golden Sakura"],
};
/**
* Require combinations of files when constructing DNA, this bypasses the
* randomization and weights.
*
* The layer order matters here, the key (left side) is an item within
* the layer that comes first in the stack.
* the items in the array are "required" items that should be pulled from folders
* further in the stack
*/
const forcedCombinations = {
"gray tee": ["Golden Sakura"],
};
/**
* In the event that a filename cannot be the trait value name, for example when
* multiple items should have the same value, specify
* clean-filename: trait-value override pairs. Wrap filenames with spaces in quotes.
*/
const traitValueOverrides = {
// Helmet: "Space Helmet",
// "gold chain": "GOLDEN NECKLACE",
};
const extraMetadata = {};
const extraAttributes = () => [
// Optionally, if you need to overwrite one of your layers attributes.
// You can include the same name as the layer, here, and it will overwrite
//
// {
// trait_type: "Bottom lid",
// value: ` Bottom lid # ${Math.random() * 100}`,
// },
// {
// display_type: "boost_number",
// trait_type: "Aqua Power",
// value: Math.random() * 100,
// },
// {
// display_type: "boost_number",
// trait_type: "Health",
// value: Math.random() * 100,
// },
// {
// display_type: "boost_number",
// trait_type: "Mana",
// value: Math.floor(Math.random() * 100),
// },
];
// Outputs an Keccack256 hash for the image. Required for provenance hash
const hashImages = true;
const rarityDelimiter = "#";
const uniqueDnaTorrance = 10000;
/**
* Set to true to always use the root folder as trait_type
* Set to false to use weighted parent folders as trait_type
* Default is true.
*/
const useRootTraitType = true;
const preview = {
thumbPerRow: 5,
thumbWidth: 50,
imageRatio: format.width / format.height,
imageName: "preview.png",
};
const preview_gif = {
numberOfImages: 5,
order: "ASC", // ASC, DESC, MIXED
repeat: 0,
quality: 100,
delay: 500,
imageName: "preview.gif",
};
module.exports = {
background,
baseUri,
buildDir,
debugLogs,
description,
emptyLayerName,
extraAttributes,
extraMetadata,
forcedCombinations,
format,
hashImages,
incompatible,
layerConfigurations,
layersDir,
outputJPEG,
preview,
preview_gif,
rarityDelimiter,
shuffleLayerConfigurations,
startIndex,
traitValueOverrides,
uniqueDnaTorrance,
useRootTraitType,
}; |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
Forced Combinations
Output 1 Does't Work
Output 2 Works
I also tried adding incompatible layers as a test and it still does not work always as expected (only sometimes)
Thanks for the help!
Beta Was this translation helpful? Give feedback.
All reactions