WTG (Wade Terrain Generator) v 0.2
This post continues the development of the WTG (Wade Terrain Generator).
A Few Notes Before I Get Started
- This demo uses Wade 4.0.1
- D3 is freely available here and is released under the BSD license.
- Azgaar’s blog is here. I have used many of his ideas and some of his code in this endeavor.
- I have also used ideas and code from, “Christophe Le Besnerais”, his island terrain implementation is located on github here.
Wade Terrain Generator v 0.2
So what’s new ? Well, you can now create a bit of terrain / map.
When you click the build button on the map tab:
- Create some noise on a canvas (Gio posted a blog about this on the Wade site – essentially doing the same thing).
- Give each polygon some elevation based on the noise
- Assign a biome based on the elevation
- Color the biomes based on a display color object
Final Results Preview
When you load the page, you see a blank grey screen with three tabs, (Geometry, Map, Export). The export tab is currently not implemented, so don’t bother with that. Click the geometry tab and you should see a menu to create a voronoi diagram (the map’s underlying geometry). You can drag the sliders to change the map’s x and y dimensions as well as the approximate radius between polygon centers. Based on your adjustments, the estimated number of polygons will be displayed . Click the build button to create the underlying geometry. You can draw or hide the geometry information as before. Open the map tab and click build to create an island with some terrain features. You can use the scroll wheel to zoom the map in our out.
Note: If you create a map without first creating an underlying geometry, nothing will happen (you’ll see an error if you have the console open). If you create a map, you can click the map button to erase it and create a new map. Once you create a map, if you change the underlying geometry you will have to rebuild the map to see the change.
So, some progress made from WTG v 0.1. Next up (in no particular order):
- Change coastline to just draw edges, not entire polygon
- Adding rivers
- Adding noise for moisture to extend biome list
- Change noise library to released version
- Add selectors to map parameters (noise octaves, noise frequency).
Not sure how much I will get to, but the plan is to post an incremental upgrade every week or so.
Download and extract the zip file, load wtgDemo.html in your browser to see it in action.
The code contains comments, so I hope it is easy to follow. Feel free to play around and use the code however you want.
cheers – Shri