A1essandro / Diamond-And-Square

Algorithm for generating heightmaps on PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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();

About

Algorithm for generating heightmaps on PHP

License:MIT License


Languages

Language:PHP 100.0%