Skip to content

relaxed failure limit#6

Merged
Marak merged 1 commit intomasterfrom
metroidvania-failure-limit
Feb 5, 2024
Merged

relaxed failure limit#6
Marak merged 1 commit intomasterfrom
metroidvania-failure-limit

Conversation

@khrome
Copy link
Collaborator

@khrome khrome commented Feb 4, 2024

This takes it from failing about half the time to failing less than ~5% of the time (anecdotally) while retaining performance.

@khrome khrome changed the title relaxed faailure limit relaxed failure limit Feb 4, 2024
@Marak
Copy link
Contributor

Marak commented Feb 5, 2024

LGTM. Thank you for your contribution.

In the production demo we are infinitely retrying in a loop using new random seed:

  function tryGenerate(generatorType, map) {
    try {
      generators[generatorType](map, {});
      if (LABY.terrains[generatorType]) {
        map.scaleToTileRange(4);
      }
      updateMapDisplay(map);
    } catch (err) {
      // console.log(err)
      //console.log('try again');
      map.seedRandom(); // new seed
      setTimeout(function(){
        tryGenerate(generatorType, map);
      }, 10)
    }

  }

@Marak Marak merged commit de3958a into master Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments