#+title: Adding details to a sketched terrain #+date: <2017-07-24 Mon> #+begin_export html

Note: the /x/ series of posts on my site are mostly unpolished mini posts. I'm trying out a few different ideas for procedural map generation; this is one of them.

#+end_export The past few mini projects were: - [[../1723-procedural-river-growing/][Generating rivers from coastlines]] - [[../1724-elevation-from-rivers/][Generating elevation from rivers, part 1]] - [[../1725-procedural-elevation/][Generating elevation from rivers, part 2]] - [[../1728-elevation-control/][Sketching coastlines and mountain ranges]] This week I'm going to glue these together (in a hacky way for now): sketch coastlines and mountain ranges, and see what rivers and elevation are generated. The page may be a little flaky. I'm including the javascript from two separate projects and hacking them to work together. I'll fix it up later but for now I just wanted to see if it worked at all. * Sketch :PROPERTIES: :CUSTOM_ID: sketch :END: Sketch @@html:@@mountain ridges or @@html:@@coastlines: @@html: @@ #+begin_export html
Noise:
#+end_export The rivers will /mostly/ follow the guidelines, but I have some randomness in there to allow rivers to cut through mountain ridges occasionally. That parameter will need to be tweaked eventually. #+begin_export html
Crater lake image
#+end_export Bonus feature: To make an interior lake, draw the lake as a coastline. By default the interior will be land. Draw inside the coastline with @@html: @@ to make it a lake instead. Some of the algorithms work on non-island maps too. If you @@html: @@ of the map you can make a crater lake. * Export to elevation image :PROPERTIES: :CUSTOM_ID: export-to-elevation-image :END: The idea behind sketching was that you're drawing /lines/ which are then mapped onto a /mesh/. If I keep the original lines, I can map them onto a higher resolution mesh. For this project, it was quicker to draw the elevations to a bitmap and then build a new mesh from the bitmap. Here's the bitmap: #+begin_export html
Sharp:
#+end_export The parameter controls the elevation exponent, which I often use to sharpen mountain peaks. The bitmap is used for the next section. * Generate detailed elevation :PROPERTIES: :CUSTOM_ID: generate-detailed-elevation :END: From [[../1725-procedural-elevation/][two blog posts ago]], I came up with some algorithms to carve canyons and ravines into the terrain. (This renderer may not work across platforms… still need to look into that) #+begin_export html

#+end_export Try changing the sharpness slider above and re-rendering. It looks neat but I don't know if we're going to use it for our game. (Update: the game was cancelled, but I was able to improve the rendering significantly, and some of this ended up in [[https://www.redblobgames.com/maps/mapgen4/][mapgen4]] a year later.) * Next steps :PROPERTIES: :CUSTOM_ID: next-steps :END: This week was about a quick hack to combine the last few mini projects to see if everything would work together. It didn't at first but I found many bugs and fixed them, and now it seems to work reasonably. Now that I know these steps work together, the next step is biomes. Also take a look at [[http://entropicparticles.com/procedure-for-rivers-and-lakes/][this page]], which has a river algorithm that does a lot more than mine does: lakes, erosion, deposition, river deltas, water tables, snow, surface tension, capillary action. Cool! I didn't try those algorithms; our game doesn't need them. #+begin_export html