1.1.0 • Published 1 year ago

tguesdon-island-generator v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

How to use

Generate with noise

import { generate } from "tguesdon-island-generator"

Generate returns a 2 dimensionnal array of points with x and y position normalized in 0, 1, and elevation normalized in 0, 1.

const island = generate(width, height, ?intensity, ?attenuation_type);

  • width, height: number of points that must be generated.
  • itensity: (optional) number which multiply noise ( default to 1 ). Should be between 0 and 1.
  • attenuation_type: (optional) Function used to transform noise into an island. Must be "gate" or "sin" ( default to "sin" ).

Points in the center will have higher elevation than points on the outside.

This package does NOT furnish any way of rendering the island.

Here is an example of render with React Three Fiber :

island render with react three fiber

Generate with Wave Function Collapse

import { generateWCFIsland } from "tguesdon-island-generator"

generateWCFIslland returns a 2 dimensionnal array of points with x and y position normalized in 0, 1, and elevation normalized in 0, 1.

const island = generateWCFIsland(width, height, allowedStep, ?possibleElevation);

  • width, height: number of points that must be generated.
  • allowedStep: step allowed between two tiles, must be in 0, 1.
  • possibleElevation: (optional) list of possible elevation for points. Default to 0, 0.2, 0.4, 0.6, 0.8, 1.0. You can put multiple times one elevation to make it happens more. I would advice to stay in 0, 1.

Here is an example of render with React Three Fiber :

island render with react three fiber

1.1.0

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago