Forgot password?


Password reset

Please enter your e-mail address and new password.

Planetary Annihilation Maths

By Bis18marck7012-07-2013

Are you ready for some maths? Nope, didn't think so. But let's have a look at it anyway.

Companies like interns. You know why? Well, for one they are cheap. However, that aside, they like to compliment the big boys which is always good for the ego but usually also work very hard on the jobs no one else wants. The developers of Planetary Annihilation, currently in Alpha, had one of these joyful minions at their disposal and this nice fellow gave us a little insight in what he was doing: Geometry. He wasn't work on this all the time of course but after some weeks of work that gained him the trust of his employers, they gave him something that is actually important.

So what's up with this geometry? As you might have seen, Planetary Annihilation doesn't give you the usual environment of a flat map but battles play on an actual round surface similar to the very planet your standing upon. What that means is that the developers use a technique with the intriguing name of Constructive Solid Geometry (CSG) to generate the planet and piecing together complex geometrical structures by using the simpler ones. I.e. out of a circle and two squares a new form is generated by addition and subtraction.

Using this technique, different brushes of varying complexity are used by the map designers to create a planet's surface. However, the mathematical fun doesn't end here as the brushes have to arch and bend naturally, aligned to the planets center, to truly deliver a believable image.

Now, the theory aside, how would this look in the game? Have a look at the screenshots below and see for yourself.

To do that, you'll need to take into account a few other things, for example, how you place the brush as the focal point needs to be on the radius of the planet's surface.

Vector magnitude which is the sum of the planets radius (R) together with the vertical difference between the above mentioned brush focal point and the vertex (d).

Rotational angle so that the distance between the vertex (heart) of the brush is the same as on the final arc (angel). The rotation angle would then equal (H+Local Origin)/Planet radius.

Finally, you have to take into account rotational axis which is obtained by the cross product of a vector going through the brushes local origin on the image and another vector going through the vertex image. Basically, think about putting the brush on to the planet without any distortion.

And to conclude all this with a grand finale, here is the code for the whole thing.

I feel pretentiously smart now after having written all that.

Comments (1)
You must be to post a comment.
Posts: 3290

You know, not only was this actually fun to read, it was kinda' fun posting it too. A lot more than I expected. I was like -.- then I was ¬_¬ then I was :D