Taeir / ContextProject-MIGI2

VR Game
0 stars 0 forks source link

Feature advanced corridor beautification #519

Closed Diocruel closed 8 years ago

Diocruel commented 8 years ago

Here are the more cave like corridors.

This adds several methods, an enum and a class to deal improve the corridor generations. The new "algorithm" works as follows:

  1. The existing corridors from the breadth first search algorithm are carved as normal.
  2. Each corridor tile is examined one by one. The type of corridor is determined.
  3. Each corridor type has its own extension method, allowing for greater fine tuning.
  4. In each extension method, the number of extensions in a single direction is generated from an exponential distribution. This distribution was chosen because it has a high probability density near the lower values and can be fine tuned with a single parameter.
  5. An extension is saved in a hash set of extension as a 2d integer vector.
  6. An iterator is created from the hash set and each extension vector is checked if it is a valid location to place a new corridor tile in the maze.

As you can see this is quite a simple way to create some noisy patterns into the cave generation. There are four parameters that can be used to fine tune the corridor creation found in the CorridorExponentialExtension utility class.

There are no additional PMD, CheckStyle nor Findbugs errors in this PR and almost all lines are tested bar a single branch in a method and a private constructor.

This closes #485, closes #477, closes #478 and closes #479. This PR also closes #480 because this feature was deemed to create to much lag after implementation.

Geweldig commented 8 years ago

After my issues have been addressed I think this is good to merge!

ChielBruin commented 8 years ago

Looks good to be merged as all @BCrlrd 's comments are adressed!