WTG (Wade Terrain Generator) v 0.35
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.35
I didn’t have a chance to get to many of the things I planned for this revision, so I considered it only a half step (0.35). What has changed:
- Rivers are now drawn with midpoint displacement to give them a more meandering look.
- Likewise for water polygon edges.
- Added transition triangles between biomes so color transitions are smoother
And look – pretty pictures
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.
Click the map tab and you should see a menu with two sliders. The generator always creates an island, but you can use the size slider to make the land mass bigger or smaller relative to the surrounding ocean. The second slider controls the amount of moisture that will be created on the terrain. Click the build button 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 change the sliders and then 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 changes.
At the end of my last post, the list of ideas to pursue was simply too ambitious. So, for a next step, I want to try adding just one thing, a political map. This in a nutshell means: figure out the best candidate location for cities, place a few cities and then divide up the terrain based on how far a city’s influence stretches.
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