Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Fractal Planet Generator

This thread is locked; no one can reply to it. rss feed Print
Fractal Planet Generator
Johan Halmén
Member #1,550
September 2001

{"name":"world1.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/8\/782744cf609b258966eeeb2295dccf59.jpg","w":512,"h":384,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/8\/782744cf609b258966eeeb2295dccf59"}world1.jpg

This is an early development image of a spheric map that I'm working on. The idea is that I start off with an icosahedron (3d shape with 20 regular triangles). Each of the triangles I divide into four by adding one vertex on each side of the triangle and pushing the vertex outwards so that it is on same distance from the middle point as the original vertices of the polyhedron (there are 12 vertices in an icosahedron). Then I add or subtract a random value to the new vertex "radius". Then I repeat this procedure recursively on each new triangle. The image above has 20480 triangles (half of them not showing). The random dithering of each new vertex gives a bumpiness to the sphere-like polyhedron that takes form. Actually the structure will be fractal.

So far the bumpiness is minimal, only the colour scheme shows the fractal structure of the "coast lines". I haven't developed a face culling thing yet, which would render the triangles correctly, I only sort them and render them all. You see some errors at 11 o'clock due to bad sorting. I'd like to have a planet with hundreds of thousands of triangles, but there's a lot of sorting and searching in some <list> things that has to be optimized yet.

Items that I want to implement:

  • light source

  • shadows

  • rotating

  • fractal dimension control

  • colour scheme control

  • mountain height control (visible height would look cool)

  • sea level control

  • number of iterations control

  • random seed control

  • saving settings and images
  • [EDIT]
    The main idea in this approach is that the result truly is a spheric like map. If you just take a rectangular map and twist it to a sphere, the texture won't be evenly twisted. This spheric polyhedron will have an evenly fractal texture all over the surface.

    [TYPOS EDITED]

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

    Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

    Thomas Fjellstrom
    Member #476
    June 2000
    avatar

    That is damned cool :)

    Makes me want to get to work on my "Sekrit Projact"(tm, various #allegro'ers) again :o

    If that is capable of generating info you could use to "map" that to an actual game "world", wow.

    --
    Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
    "If you can't think of a better solution, don't try to make a better solution." -- weapon_S
    "The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

    Evert
    Member #794
    November 2000
    avatar

    Looks very sweet! :)
    Adding snow on the pole caps and whisps of cloud would make it almost perfect. By the way Johan, did I ever tell you I've used your random terrain generator a dew times?

    Mordredd
    Member #5,291
    December 2004
    avatar

    You forgot that the earth is not a sphere. It is flatter on the pole caps...

    Johan Halmén
    Member #1,550
    September 2001

    This is not a sphere either. It consists of 20*4^n triangles, where n is the number of recursive levels. There's a formula, which I've forgotten. It is about the number of vertices, edges and polygons in a polyhedron. Anyway, it is kind of interesting that the original icosahedron has 12 vertices where five triangles meet. Each new vertex that I add will be a vertex, where six triangles meet. We all know that regular triangles can be tiled to fill a plane. At every corner six triangles meet. The planet in the image has 20480 triangles, none of them is regular, most of them meet six and six at thousands of vertices. But somewhere on the planet you find the original 12 vertices, where only five triangles meet. They enable the roundness of the planet. Of course, some would object to that.

    Glad you liked the flat earth map generator :)
    Trezker did some good things to it.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

    Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

    imaxcs
    Member #4,036
    November 2003

    That "Flat Earth Society" must be a joke.
    Have a look at their "links" ... Hitler vs. The Pope. :o

    Hilarious! ;D

    gnolam
    Member #2,030
    March 2002
    avatar

    http://en.wikipedia.org/wiki/Flat_Earth_Society

    The flat earth society is somewhere far away,
    With their candlesticks and compasses
    And the bright ship humana is well on it’s way
    With grave determination
    And no destination, lie, lie, lie...

    Anyway, neat work! I can probably use something like this in the near future. :)

    --
    Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

    Kirr
    Member #5,060
    September 2004
    avatar

    flat earth forum said:

    You know they don't spend their time looking into space with that telescope--so what do they do all day long? get really good at photoshop.

    flat earth forum said:

    nobody lives on the bottom of the flat earth--at least nobody without good mountaineering skills.

    Jeez, they really believe earth is flat! :o That site made my day!

    --
    "Go to the NW of Stonemarket Plaza to the Blue Glyph Keeper Library door and enter."
    - Lunabean's Thief Deadly Shadows Walkthrough, day eight

    Evert
    Member #794
    November 2000
    avatar

    Quote:

    That "Flat Earth Society" must be a joke.

    And a rather poor one at that. No one at the time of Columbus had the idea that the Earth was flat, certainly not the Church. Columbus underestimated the size of the Earth, which was apparently not well known despite Aristarchos' measurement.

    That being said, I have seen a religous zealot magazine which said things like those on that page and meant them in full earnest. Anyway, the logic is so backward that it'd better be a joke in this case:

    Quote:

    Now imagine, if only for the sake of argument, that the person on top and the person on bottom can both manage to remain attracted to the ground "below" them. What would happen if the person on one side decided to visit the other? Since the man at the North Pole has a different idea of what is down and up (and in fact experiences an opposite pull from the Earth's gravity) than the person at the South Pole does, when the denizen of the frozen Arctic visits his Antarctic counterpart, they will experience gravitational pulls exactly opposite of each other! The human from the North Pole will "fall up", never returning to the ground, and will continue falling forever into the deep void of outer space!

    This one is funny though:

    Quote:

    Conspiracies and Coverups

    <This page is currently under construction. Please come back when we have our act together.>

    Dennis
    Member #1,090
    July 2003
    avatar

    Micah said:

    You forgot that the earth is not a sphere.

    and Johan said:

    This is not a sphere either. It consists of[..]

    And besides that, why would one want to inherit reality's imperfections into a computer programm?
    I don't understand the math but it looks nice.

    about FlatEarthSociety:
    It just has to be a joke. The whole site is made up in a way to imply that.

    Trezker
    Member #1,739
    December 2001
    avatar

    Where's the downloadable "google earth"-like GUI that Miran is surely making? ;D

    Torbjörn Josefsson
    Member #1,048
    September 2000
    avatar

    hmm.. what shape should the tiles be on a spherical map? Do they have to be triangular?

    ..I admit - I'm not that into geometry/maths :)

    --
    Specialization is for insects

    Johan Halmén
    Member #1,550
    September 2001

    A sphere can be divided into 20 identical spherical triangles, meaning each side of each triangle is not a straight line, but an arch on the sphere periphery. If we are thinking of tiles in a game that takes place on the surface of a sphere, 20 is not enough. We need to divide each triangle in smaller triangles. Each triangle divides into 4, as I described above. One could think of doing the same with a hexahedron (a cube), by dividing each face into four squares and push the middle point outwards to the periphery of the sphere, but one would get very twisted squares as tiles. In any case the tiles get twisted unevenly on the sphere.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

    Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

    Go to: