Worldgen allows you to generate random worlds.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install worldgen
# Create a 50x50 heightmap - this will be flat heightmap = Worldgen::HeightMap.new 50
Then dump it to an image file:
Worldgen::Render.heightmap heightmap, "output.png"
A plate map is a random construction of plates within a world (as in plate tectonics). Example:
# create a 256x256 plate map platemap = Worldgen::PlateMap.new 256 # generate 10 plates platemap.generate_plates! 10 # Output to a PNG - this will show each plate in a different colour Worldgen::Render.platemap platemap, "plates.png"
This feature is experimental and may be subject to change in the near future.
# Create the noise object noise = Worldgen::Perlin.new(256, 256) # Draw it Worldgen::Render.perlin noise, "noise.png"
- Fork it ( https://github.com/robbrit/worldgen/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request
Heightmaps are purely written in C for performance. If you're going to be writing code that interacts with heightmaps, you're going to have a much better time doing it in C since Ruby is a fair bit too slow once you get to larger maps (512x512 or higher).
- Diamond Square output seems to be rougher than it should be