WTG (Wade Terrain Generator) v0.45
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.45
At the end of my last post, I said that I wanted to implement pathfinding. I managed get that done, but it is still buggy and slow.
So, while I try to sort that out, I thought I would post an update to the terrain generator, but only give it a half step (0.45).
The build and map menus have been updated:
Here is a generated map with different items displayed from the map menu:
Final Results Preview
When you load the page, you see a blank grey screen with three tabs, (Build, Map, Export). The export tab is currently not implemented, so don’t bother with that. I won’t explain how to use the various tabs again. If you haven’t seen it before, go to the previous WTG post to get the explanation. One note, It takes about 8 seconds to generate a map with 8k polygons, so after you click the build button give it a little time to generate.
What else has changed under the hood ?
- The draw functions have been pulled out of the code and implemented in a separate object (see WTGDraw.js).
- Reworked the gui stuff so the correct buttons and sliders are on the correct tabs (see menu images above).
- Cities are randomly assigned an, ‘influence‘, parameter on creation. This attribute is then taken into account when calculating which regions are assigned to which cities. This attribute is also taken into account when displaying the city dot. Cities with more influence get larger circles. This idea was from ‘Azgaar’s blog‘, and gives a better (less uniform) region distribution compared to using just the closest distance.
- Added border assignment. This allows you to see the region separation as well as the underlying terrain (see map images above).
I hope to get pathfinding sorted out in short order, so stay tuned. If someone wants to see something specific added/changes, drop me a line here or on the wade forum and I will see what I can do.
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