
Procedural Planet Generation - mxfh
http://experilous.com/1/blog/post/procedural-planet-generation
======
KeytarHero
Really cool - I, too, have long been bothered by the cylindrical map in Civ
and wondered what a spherical Civ would be like. (At least Civ V's switch to a
hex grid solved the biggest pet peeve I had with the game's geometry, since
with a square grid, moving diagonally was just as fast as moving
orthogonally.)

However, the irregular tiles actually bother _more_ than if it was a standard
geodesic sphere which only had 12 pentagons. For one, the fact that tiles are
different sizes looks kind of weird. More importantly, this tile layout could
actually make an important strategic difference (much more than if there were
only 12 pentagonal tiles). Assuming movement costs between adjacent cells are
constant, a straight line may not be the fastest way between points anymore!
Looking at the heavily distorted mesh example, I can see several places where
a path through a few large cells has the same movement cost as the straightest
path.

Also, a realistic simulation of global wind patterns isn't actually that hard.
Since it's only long-term trends that matter (at least when it comes to
shaping overall climate), it's not like you'd have to calculate detailed fluid
mechanics models. A simple model of Hadley & Ferrel cells (which is key to
having realistic deserts) would get you most of the way there. [1]

[1]
[http://en.wikipedia.org/wiki/Atmospheric_circulation](http://en.wikipedia.org/wiki/Atmospheric_circulation)

~~~
RickHull
> _However, the irregular tiles actually bother more than if it was a standard
> geodesic sphere which only had 12 pentagons. For one, the fact that tiles
> are different sizes looks kind of weird. More importantly, this tile layout
> could actually make an important strategic difference (much more than if
> there were only 12 pentagonal tiles). Assuming movement costs between
> adjacent cells are constant, a straight line may not be the fastest way
> between points anymore! Looking at the heavily distorted mesh example, I can
> see several places where a path through a few large cells has the same
> movement cost as the straightest path._

I would say there is nothing wrong with strategic differences, so long as they
are irregularly distributed. Regular or predictable distribution would cause
strategic ruts. Also, irregular movement costs are a _feature_. Ancient spice
trading routes and deer paths in the woods rarely follow straight lines
either.

~~~
KeytarHero
Irregular movement costs would be there anyway, due to forests, hills, and
other terrain. The fact that "this space is arbitrarily bigger" isn't really a
good justification, especially when the game is doing this in an effort to be
_more_ realistic.

I also think this could lead to a whole bunch of balancing issues that might
not immediately be obvious. Although some random-but-fair differences in
balance such as this are okay, they should be based on the terrain, resources,
and other features that mirror the real world, not "this tile is just bigger".

~~~
skybrian
It wouldn't be too hard to give it some justification. The smaller tiles could
have hills or forests that would naturally slow down movement. Or perhaps go
back and redistribute the smaller tiles after terrain generation?

------
bazzargh
Another idea for folk who want to generate equally spaced points on a sphere
for things like this - a while back I did an answer on codegolf.stackexchange:
[http://codegolf.stackexchange.com/a/24961/16869](http://codegolf.stackexchange.com/a/24961/16869)
for showing a daylight map of the earth. You need to store a map of the earth
to do this, but I didn't want to waste storage on the poles as you would with
most projections, and couldn't be bothered calculating tilings; so the path I
took was to use a spiral sampling of the surface of the earth giving
approximately equal area, then flood filling.

I hadn't seen this approach before, but guessed someone would have thought of
it so hunted down a discussion; The spiral I used is taken from here:
[https://groups.google.com/forum/#!msg/sci.math/CYMQX7HO1Cw/t...](https://groups.google.com/forum/#!msg/sci.math/CYMQX7HO1Cw/tFhJvkWHSjUJ)
(see the rest of the thread, their motivation is minimising the potential
energy of charged particles on the sphere).

------
divs1210
Hello, Slartibartfast! I look forward to playing a "race to the south pole"
rts. Brilliant work.

------
joewrong
google cache version:
[http://webcache.googleusercontent.com/search?q=cache:http://...](http://webcache.googleusercontent.com/search?q=cache:http://experilous.com/1/blog/post/procedural-
planet-generation)

~~~
opless
Thanks

------
icoder
Very nice! This goes into my (small) collection of proc-gen bookmarks. I've
taken a (side) interest into this field, which, inspite of classics like
perlin noise, still seems quite young. I've been reading about plate tectonics
last week and it's good to see it working for someone else. Maybe I should
give them a try as well.

~~~
robinsloan
Do you have that collection of bookmarks posted/shared anywhere? Always
curious to see more stuff like this.

~~~
icoder
[http://jsfiddle.net/rL0qmee9/](http://jsfiddle.net/rL0qmee9/)

------
lsjroberts
This is excellent, though I wonder what it would take to do a simulation from
the beginning and change over time as opposed to a fixed state. Then let the
features, biomes and weather patterns arise naturally from the given physics
(and perhaps some nudging).

~~~
thret
It would be pretty cool if the game actions could effect the environment too -
global warming, pollution, nuclear disasters, that kind of thing.

------
Symmetry
Awesome work.

I really sympathize with his "Why did they use Javascript instead of Lua"
point. Of course I mostly do embedded programming so this might be my biases
talking but every time I find myself using Javascript I keep wishing it was
more like Lua.

~~~
RobertKerans
Why Lua? I was just reading through the Red Blob Games articles, and on the
subject of scripting languages, he says something to the effect of 'if you
have to use a general purpose scripting language, just go for Lua', written as
if this is kind of self-evident. What is it about Lua that makes it
attractive?

~~~
Alphasite_
Isd assume it's because luajit is very lightweight when compared to javascript
systems, which tend to be very memory hungry.

------
forrestthewoods
It looks like there is supposed to be an interactive demo. Doesn't work on the
google cache. Is there a mirror of that anywhere?

~~~
mmanfrin
[http://experilous.com/1/planet-
generator/2014-09-28/version-...](http://experilous.com/1/planet-
generator/2014-09-28/version-1)

------
btbuildem
It'd be rad if you could elevate individual tiles proportionately to their
mean elevaton - kind of a Causeway of Giants effect, it would give a sense of
the elevation in any of the other modes (esp. in terrain mode!)

------
Figs
I was bugged by games not having proper polar regions too a while back. One
solution I thought of (but never got around to implementing) was to use a cube
map to represent the surface of the sphere. I thought it'd be easier to work
with six flat faces than to figure out how to index the tiles on a soccer
ball...

~~~
kakali
A similar but different idea is the TOAST projection. However here it starts
with an octahedron instead of a cube. The benefit is the texture can all be
stored on a square and is argued has a more uniform sampling that
equirectangular projection.

[http://www.worldwidetelescope.org/docs/worldwidetelescopepro...](http://www.worldwidetelescope.org/docs/worldwidetelescopeprojectionreference.html#TOASTProjection)

------
epscylonb
As a huge Civ fan the idea of having a game take place on a truly spherical
world is very appealing.

------
hypertexthero
Also check out [Elite: Dangerous][ed] for some awesome procedural planet
generation.

[ed]: [http://hypertexthero.com/logbook/2014/07/elite-dangerous-
edu...](http://hypertexthero.com/logbook/2014/07/elite-dangerous-education/)

------
touristtam
reminds me of this article:
[http://www.pyxisinnovation.com/pyxwiki/index.php?title=Mathe...](http://www.pyxisinnovation.com/pyxwiki/index.php?title=Mathematics_for_a_New_Grid_System)

And: "Climate Modeling with Spherical Geodesic Grids" from Sept/Oct 2002 -
Computing in Science & Engineering

