This is a library to simulate plate tectonics. It is written in C++ and it has Python bindings (as part of this project), as well as Haskell bindings (hplatec).
Being a library you want probably to use it inside some larger program. From example WorldEngine (a world generator) is based on plate-tectonics.
You can also use the examples to just run the code of this library and generate a few maps. However the examples do not unleash the full power of this library. For running the examples check section Running the examples (C++).
The library offers an API to generate heightmaps and some other data about the world resulting from the simulation. The example permits also to generate maps like this one:
You can see a video of simulation based on an old version of this library: http://www.youtube.com/watch?v=bi4b45tMEPE#t=0
We use CMake. Install it and then run the folowing commands
cmake . -G "Unix Makefiles"
make
cmake .
make
This should produce a library (libPlateTectonics.a).
cmake .
cmake --build .
If you want to build also the examples run:
# instead of cmake .
cmake . -DWITH_EXAMPLES=ON
Note that this command will build the library in the same directory where the source files are hosted. Some prefer to build out of tree the library (i.e., in a separate dir). For example in this scenario:
-- plate-tectonics
\- build-directory
You can enter build-directory and type:
cmake ../plate-tectonics
make
To compile on other platforms please run:
cmake --help
To run also the examples you need to install the library libpng.
From the root directory run:
cmake -DWITH_EXAMPLE=TRUE -G "Unix Makefiles"
make
cd examples
./simulation_rect
To run tests you need to install DevIL
We use googletest (which is included in the project). After building the library:
cd test
make
./PlateTectonicsTest
Currently the test coverage is still poor (but improving!_, tests are present only for new code and tiny portion of the old code that were refactored.
Supported versions:
- Python 2.6 (currently not supported on AppVeyor)
- Python 2.7
- Python 3.2 (currently not supported on AppVeyor)
- Python 3.3
- Python 3.4
To use it in your program you can either add a dependency use pip (pip install PyPlatec) or build and install it from source code.
python setup.py build
The library is quite simple:
import platec
p = platec.create(seed=3)
while platec.is_finished(p) == 0:
platec.step(p)
hm = platec.get_heightmap(p)
platec.destroy(p)
Or if you want more control:
import platec
p = platec.create(seed=3, width=1000, height=800,
sea_level=0.65,erosion_period=60,
folding_ratio=0.02,aggr_overlap_abs=1000000,
aggr_overlap_rel=0.33,cycle_count=2,num_plates=10)
- Improve the quality of the code and add some tests
- Support Google protocol buffer
WorldEngine, a world generator
A fork of platec http://sourceforge.net/projects/platec/ . That project is part of a Bachelor of Engineering thesis in Metropolia University of Applied Sciences, Helsinki, Finland. The thesis is freely downloadable from http://urn.fi/URN:NBN:fi:amk-201204023993 .
Kudos to the original author: Lauri Viitanen!