Algorithm for generating heightmaps on PHP
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo Add default value for size, persistence and seed. Setters optional now. Jan 9, 2017
src Change the internal seed calculation algorithm. Jan 9, 2017
test Change the internal seed calculation algorithm. Jan 9, 2017
.gitignore Added visual demo. Fixed error in getOffset() Jan 14, 2016
.travis.yml Add Coveralls Dec 21, 2015
LICENSE
README.md Fix readme Jun 19, 2017
composer.json Fix travis-ci errors Dec 30, 2015
composer.lock Fix tests Jan 9, 2017
phpunit.xml.dist For version 2.0.0: remake API (like https://github.com/A1essandro/per… Dec 20, 2015

README.md

Diamond And Square (PHP)

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License

Algorithm for generating heightmaps on PHP.

See also Perlin-Noise algorithm with the similar API.

Algorithm

Steps

Steps

Image source

See more about diamond-square algorithm on wiki

Requirements

This package is only supported on PHP 5.3 and up.

Installing

Installing via Composer

See more getcomposer.org.

Execute command

composer require a1essandro/diamond-and-square ~2.0

Usage example

Standart

$gen = new DiamondAndSquare();
$gen->setSize(7); //real size equal 2 ^ 7 + 1, i.e. 129
$gen->setPersistence(1.7);
$gen->setMapSeed("1hCaHs5hZ");

$map = $gen->generate();