Planetary Map Data Model


I think it will work - as long as points are small, then we can approximate arcs by chords.

For plates, we can simply have sets of points that use the same quaternion for rotation, and points ‘in between’ plates could interpolate the quaternions of nearby continents (for the bending of mountain ranges, etc).

As for making and breaking ties, the rules don’t have to be very complicated to be realistic:

  • There would be clumps of points (about the size of, say, France) which are always, always locked together – these are the cratons that form the cores of continents.
  • Other continental points would sit between and around cratons, in layers 1-2 points thick, to form full continents.
  • The rest of the points would be oceanic plate.

As for movement:

  • Every craton would have its own rotation quaternion (we’d probably have to compute them using some average of nearby forces added to a random bias)
  • If cratons are locked together in a plate, we average the quaternions, and use the result for all points on the continent
  • we can also use the difference between a craton’s quaternion and the plate to compute a stress value which we use to decide if and how the plate will fracture
  • I’m not sure how oceanic plates should be rotated – they tend to be more fluid, so we can’t just use the same quat for all. Maybe some interpolation would work, where an oceanic plate has a quat at the center and points near the edges have a falloff effect…

Anyway, I like the video, thanks for working on this!


I like what you’re saying, I think that all makes sense.

Going a bit further here is an interesting observation. Imagine a force A pulling a point at B over a sphere with friction which causes it to rotate around axis C. (Force A must always be tangent to the sphere). The force can be derived from the axis of rotation and the speed and the axis of rotation and speed can be derived from the force. See this diagram (I have had some trouble drawing it, I think this is clear).

Other important facts are that B is always unit length (as it lies on a unit sphere), the dot product of any two of these vectors (A,B or C) is always 0, and the vector triple product (for any A, B, C which are 3 vectors), A x B x C = B(A dot C) - C(A dot B), where dot is the usual dot product and x is the usual cross product for three vectors (which, for quats, is the last three components)

So set C = A x B. The speed is then the magnitude of A and is put as the first component of the quat C for the rotation. Then you can derive A = B x C = B x A x B = A(B dot B) - B(B dot A) = A |B|^2 = A.

When done with quats this will work out slightly different. The last three components of C should be unit length and determine the direction of the axis of rotation, the first component should be the speed. Then when you take B x C you use the last three components for C and then at the end multiply by the first component of C to restore the magnitude. So something like A = |C| (B x C), if that makes sense.

TL:DR; C = A x B and A = C x B and therefore we can easily swap between axes of rotation and forces on the surface of the sphere.


I’ve had some trouble with making a prototype (I don’t seem to be much good with collision detection, even 2d collision is non trivial) so I thought I would outline the method and we can discuss whether it is worth pursuing.

@moopli I wanted to check what you are thinking about layers. So I was imagining the model would be 1 layer deep, basically there would be no movement in the radial direction, everything would be tangential. However you said “Other continental points would sit between and around cratons, in layers 1-2 points thick, to form full continents,” which sounds rather different.

One of the issues about the spherical geometry is that points which start close together and which start moving parallel to each other can end up overlapping on the other side of the sphere. Now maybe that is not such a big deal (I imagine it would take a long time for a tectonic plate to orbit a sphere) but it is an issue, here is a diagram. So I’m not sure that simply interpolating quaternions will work very well, at least not globally.

So this is an algorithm which might work to avoid this problem (and allow for some nice dynamics).

  1. Cover the sphere in a vector field (interestingly this runs into the hairy ball theorem and so will need to vanish somwehere). This represents the motion of the magma underneath the plates. It would also be possible to have a temperature parameter for the planets core, so it can cool over time and the magma can slow.

  2. Plates are made of points and each point has a quaternion rotation axis and a speed, use this to move the points a small step.

  3. For each point switch from a spherical geometry to a locally euclidean 2d patch around the point. That is take a gradient of the function which defines the sphere = (2x,2y,2z) and find it’s value at the point of interest. Then work in the space with zero inner product with this vector.

  4. Add up the forces in this tangent space, so if the point is alone far from any other it will just the the force of the magma pushing from below. However if the point is connected to others, or if it collides with others, forces will need to be added for these interactions to prevent the points from overlapping. This could be done by a usual collision detection system, I am having trouble implementing one.

Also there is the issue of solving the equations simultaneously, so if A collides with both B and C then we need to make sure if we run the algorithm for A then B then C that somehow this does not require the equations for A to be re run.

  1. Convert the net force from this space back into an axis of rotation and go to step 1.

Anyway I am concerned this is pretty complicated. however it should provide some nice dynamics.


Isn’t the problem of overlapping trajectories entirely a non-issue if all the points involved are rotating about the same axis?

That should make it completely unnecessary to have to handle the dynamics, which I think would be much more work than it’s worth.

What I mean about ‘continental points surrounding cratons’ is that not every piece of continental plate is part of a craton – for example, if a small continent consists of two cratons, there is some continental plate between them, and around them, which is not cratonic. The model would definitely be 1 layer deep, we shouldn’t bother modelling overlapping (well, at most, fudge something for convergent plates and high plateaus).

If we were to handle magma convection and thus model plate tectonics as crust being dragged around, then we’d have to create a pattern of upwelling and downwelling, with convection cycles of a good size, and I sincerely think that’s more trouble than its worth.

As for collision detection: For starters, create 8 ‘bins’ (sets), one for each octant of particular +/- x/y/z. Each point is associated with a few bins, and when a point moves, remove it from all bins its in, then add it to all bins the new location intersects, taking care to include overlaps due to nonzero point size. Then, iterate through each bin to test every member against the others. I think, once we can ensure that certain points rotate about the same axis, we’ll be able to manipulate those sets to further reduce the number of direct collision checks, but this would be a good start.


It would be nice if we could do everything with quats, that would really make things a lot easier.

Can I just check what dynamics we are looking for? We want all the plates to move in different directions and slam into each other, creating mountains, and get torn apart, creating volcanic chains. We also want to be able to have long time, pangea -> many continents, style drift. Is that what you’re thinking? I think it would be cool for the player to watch the continents drift and mountains be formed during the multicellular and aware stages.


Okay, well, fair warning - I haven’t even touched a line of code in four years, and I never learned my way around the inner workings of data. This is sheerly my geological thinks combined with a bit of fudging. Stop me if this line of thought is straight up not possible. There are huge holes in this I’m already aware of and will address toward the end.

My immediate impulse is: Ditch the sphere, and the polygons.

Here’s what I’m going to call a “rock column” for my purposes:

It’s nothing more than what appears there - an ordering of rock layers of different varieties (I just tossed out some examples in that image) with their thicknesses. Rock columns could be generated to resemble many different crustal regions, based on what rock layers are present.

A certain number of rock layers (depending I guess on what works in terms of manageable simulation) could be distributed at points equidistant to a point and collectively resembling a sphere (Alternatively with distances from the core varied to resemble real planets’ oblate shapes) and serve as rock data for that region.

In addition to the rocks present in each column, they could carry other information - like mass, momentum, and ‘horizontal’ volume. Their ability to move freely would be constrained when their volumes contact other columns, and in theory that should be at all times. Circumstantially, their momentum may cause them to push against other columns and cause -

A: A decrease in one or both columns’ horizontal volume (depending on hardness)
B: an associated increase in columns’ vertical thickness, and, if severe enough, metamorphism of existing material (replacement of layer/s with a metamorphic rock based on the parent material)
C: ‘subduction’ of a column, if one is heavier and thinner (like oceanic crust) than the other. This would remove the column from the planet and maybe add dissolved volatiles into the neighboring column’s information?

Columns could also ‘stick’ to each other and separate the way real plates do, to form larger plates, maybe collectively sharing momentum/velocity?

Finally, I think it should be possible to generate a ‘surface’ over the planet based on column thicknesses, locations, and upper rock layers?

This wouldn’t be a solution for more local issues like weathering/erosion, drainage basins, flora cover, volcanism, or uhhh anything smaller than a huge chunk of land. Even mountain ranges would appear simply as single, huge mountains rather than ranges of individual normal-sized mountains. Nor can I guess at how ugly the seams between columns with different rock layer information would have to be.

Am I on a reasonable line of thought?

EDIT: On a second look through the thread, it looks like this is rehashing what has come up more recently. I’ll leave this up regardless, but it’s less novel than I originally thought


Interesting ideas.

So each rock column will, presumably, have a pair of angles in spherical coordinates which denote the direction it points in. For example a rock column at the north pole might have coordinates (0,0) whereas one at the equator might have (0, pi/2) or something like that.

The problem is then to work out how these coordinates evolve over time. That was the whole thing with the polygons and the quaternions, to try and work out how to have a load of bits of rock all moving and colliding on the the sphere.

You have all the right ideas (columns being linked together into plates, them influencing the movement of their neighbours, creation and destruction) which is really cool! You’re certainly going along an interesting and worthwhile track.

However the challenge is the details of how this info will be stored and how to write out the rules for how columns interact. Keep going! (Maybe try working out what would happen if your planet had 2-3 columns only?)


I think the raft idea is simpler to visualize, so I will speak on that.

I’m not saying the column idea is bad, I’m just not getting it.

With the raft idea, we could have two layers of the rafts, one continental crust, one oceanic crust (because they are geologically different). The Oceanic crust moves and pushes the continental crust, but continental crust would start small, and as the oceanic crust moves, it would collect it into landmasses, and when those collide, and points become dense, they form mountains.


I think the raft idea would be easier to implement, and would allow for easier simulation of tectonic movement.

The column idea could work as an expansion on the rafts, for mining purposes.