Iris icon indicating copy to clipboard operation
Iris copied to clipboard

Jigsaw - require piece(s)

Open astrsh opened this issue 4 years ago • 1 comments

The concept is fairly simple - require a structure to contain certain pieces (and maybe require a minimum amount of times that piece must show up). Not 100% on this idea due to performance concerns, but the premise is you include a list of pieces within the structure config that the structure is required to contain. When finished generating a structure virtually, Iris could check if it contains every piece defined in the 'requiredPieces' list, and if not, then it would try generating a new structure layout. The amount of times Iris tries to generate a layout could also be configured, as well as a couple options in the case that a genned structure doesn't meet the criteria. These could include placing the structure anyway (this way there is a better chance of those required pieces showing up but the structure will still generate regardless), or discarding structure generation. Iris could also prioritize placing required pieces if they haven't shown up yet to further increase the chance of a successful structure layout.

Here is what it might look like in the configuration:

{
  "maxDepth": 30,
  "pieces": [
    "stronghold/room/entrance"
  ],
  "requiredPieces": {
    "stronghold/room/portal-room": 1,
    "stronghold/room/library": 1
  },
  "placementAttempts": 5,
  "failureMode": "PlaceAnyway"
}

astrsh avatar Jan 13 '21 17:01 astrsh

Due to how it generates, the only way i can think of is

  1. try to shove those required pieces into literally anything first if possible (at least once), then continue generating.
  2. If it fails, literally keep retrying up to X times, then fail and basically dont place the structure.

cyberpwnn avatar Jan 15 '21 12:01 cyberpwnn