Tectonics.js is a 3d plate tectonics simulator written in pure javascript that allows you to create realistic fantasy worlds from your web browser.

Tectonics.js is a principled model. It aims to use simple yet scientifically defensible models that may be easily understood by nonexperts and modified by developers. A 3D framework is used to provide a solid foundation for modeling that is grounded in reality. Javascript is used so that the model is made available to anyone through a modern web browser.

The model is open source and licensed under version 2.0 of the Creative Commons Non Commercial Attribution License.

To see the model for yourself, click here


Why not use fractals?

Fractals generate superficially realistic terrain using processes that radically differ from reality. This enables them to operate many orders of magnitude faster than tectonic simulators, but this comes at a cost. A fractal world has no history - users cannot look at a landscape and say why or how that landscape formed the way it did, at least not in reference to real life processes. An author, for instance, would have a harder time breathing life into a fractal world because such details would have to be tacked on after the fact in a way that loosely conforms to what's already been generated.

Why 3D?

I like to fall back on a favorite quote of mine:

We need to make sure that... simulations and reality agree, because generally when they don't reality wins.-Elon Musk

2D models go a long ways towards reducing the code needed to express themselves. In a 2D model, grid cells can be represented in 2D arrays, and contents can be moved between them through a series of integer vectors. In a 3D model, decisions such as these are nowhere near as straightforward. Developers must answer basic questions concerning how grid cells are arranged and how cell contents move. The bright side of this scheme, however, is that reality fights on your side. Some planet features for instance form naturally since they're simple products of geometry. Island arcs are perhaps the best example - 2d models based upon similar principles appear to have difficulty forming island chains along anything other than straight lines, but properly shaped arcs form here as emergent behavior.

Why a Web Browser?

Tectonics.js seeks to be accessible to a wide audience of world building enthusiasts. Many aspring storytellers and world building enthusiasts in general like the idea of using models that can form realistic landmasses for their worlds but lack the skill to develop their own. A web application allows just about anyone to type in a site and create their own imaginary worlds.

Javascript is classically an odd choice for a simulator of any sort. It's a problem most have addressed in the past with faster languages like C or even FORTRAN. However, processing power continues to increase at an exponentiating rate. The speed problem is still tangeable, even today, but steps can be taken against it: parallel processing and graphics shaders already cut down processing time by many orders of magnitude, and as techniques such as transform buffers and general purpose graphics processing enter into the realm of web development, runtimes can be cut down even further. With some judicious optimization, planets with tens of thousands of grid cells are easily simulated, today. Instantaneous generation is currently out of the question, but you can still generate worlds in the time you'd be willing to sit in front of a computer. On occassion, I've fallen asleep and woke up to find a planet that's ten times older than the universe :)

If you're, say, writing a novel and want to emphasize the quality of worlds over quantity, then this project is meant for you.

How does it work?

The model tracks the age of oceanic crust.

Age is used to calculate density (since oceanic crust gets dense with age).

When crust density exceeds a threshold, the crust is marked for subduction.

Velocity lines are calculated so that crust will be drawn towards subducting regions. This is done using vector calculus.

An image segmentation algorithm identifies regions where velocity lines are similar. These regions represent plates in the real world.

The weighted average of the velocity lines become the velocity of the plate.

Because plates are drawn towards subducting regions, overlaps will occur in the subducting regions. When subducting crust overlaps, it gets deleted from the model.

Gaps also form as the crust moves. New crust is created to fill these gaps. This new crust represents a planet's mid ocean ridges.

Can I build off your model?

Yes. Tectonics.js is licensed under version 2.0 of the Creative Commons Non-Commercial Attribution license. This means you are free to share and modify the model in most any way you please. There are however two restrictions:

  1. You must give credit. Don't worry, I'm not militant as to where.
  2. You must not charge people for it (ads and donations, however, are notwithstanding when used external to the program).

If you do wind up building off the model I'd like to hear it, if only to know someone finds the work useful. Along the same lines, if you feel there's something you'd like to contribute without making your own distribution, give me a pull request - I'll work changes in and make sure your name appears on the credits list.