Releases: matthewstyler/ruby-perlin-2D-map-generator
Road Generation with Prim's Algorithm and MST
Updated connected pair generation of building in a town and centroids between town for road generation to use prim's algorithm with a minimum spanning tree. This was originally generating a full graph.
Time improved from O(n^2) to O((V+E)logV). Map generation with roads is significantly faster.
Towns
Towns
With Poisson Disk Sampling, towns can be generated randomly or with a provided x,y coordinate used as a centroid with radius. The result will be tiles that contain Building
items
. Buildings in a town are connected by roads, and additionally towns are connected to other towns by roads.
Roads !
Roads can be generated through the maps randomly or through a list of coordinates.
Roads can be generated by providing a positive integer to the roads= argument. Roads are randomly seeded to begin and start at an axis (but not the same axis).
A* pathfinding is used to generate the roads with a heuristic that uses manhattan distance, favours existing roads and similar elevations in adjacent tiles.
Roads can be configured to include/exclude generating paths thorugh water, mountains and flora.
Tiles containing roads are of type road, those without are of type terrain.
The --roads_to_make option allows you to specify multiple pairs of coordinates to attempt to build paths, subject to the heuristic and other option constraints. Expects a a single list, but must be sets of 4, example of two roads: --roads_to_make=0,0,50,50,0,0,75,75
v.0.0.4
v.0.0.3
bump version
Initial Release
v.0.0.2 bump version