Friday, January 13, 2017

Plate Tectonics - 2

In yesterday's post, I mentioned my efforts to convert Lauri Viitanen's 2012 thesis project, an open-sourced plate tectonics simulator, into something with a GUI that would run on a Windows platform.  One of the items I thought still was required was a "centering" feature, to minimize the amount of land wrapping at the edges of the map.  I managed to do so tonight, though I will need to make some changes to integrate it better.  Still, you can see the results in the examples below. In my (not so) humble opinion, the centered maps on right look far better than the ones on the left, but the only difference is positioning.  

Anyhow, aside from integrating the centering code, I would also like to complete the JPEG export. And then I think I shall call this project complete and put it up on GitHub.  There's a lot more that could be done with this.  In terms of features, it could use some better erosion algorithms. As it stands now, "erosion" is simply a smoothing algorithm applied every so many iterations, and at the end of each cycle.  An erosion algorithm that operated on the islands and seacoasts periodically would help reduce some of the odd island growth that is sometimes seen.  Additional output formats (image and elevation) might be nice, but probably aren't essential.  A header file to accompany the current elevation export would be nice, specifying at minimum the map dimensions and sea level, but possibly the full set of parameters used to generate the map.  Really nice would be a different initial landmass generation algorithm, so as to allow non-square, non-power-of-two map sizes.    

In terms of the code itself, it could also use some work.  When I originally worked on port this program three years ago, it was only the second time I'd used FLTK, and the first time I'd used C++ in years.  I'd organize the code a bit differently, especially in terms of classes and how I integrated the output from FLTK's GUI designer, FLUID.  Maybe add support for running from command line, too.  It wouldn't hurt if I were to write some documentation for this, at least a readme file.  That's all for the future, if ever.

And as I wrote that previous sentence, another idea popped into my head.  These algorithms take a long time to run the simulation.  Perhaps if a large number of maps were generated, the resulting islands and continents (land masses) could be extracted and stored.  Then when a new map is required, it could be assembled by random placement of several random selections from the stored land masses.  Just thinking aloud here.

No comments:

Post a Comment