Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5 ... 7

Author Topic: The World is Just Awesome - Advanced Terrain Generation Thread  (Read 21574 times)

Normandy

  • Bay Watcher
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #30 on: February 03, 2011, 06:21:29 pm »

I'm not bothering with distortion or mapping currently. I dislike working in non-euclidean space, thank you very much.

My previous method for plates proved to be problematic, to say the least. I've mostly been working with stuff under the hood, cleaning up classes and adding a few useful functions, so I'm anxious to move forward. If I can't get plate tectonics working by Sunday I'm probably going to drop it for now and move onto the next section, which will be adding oceans and precipitation.

I'm using 4d simplex noise to generate wrapping magma temperatures, looks something like this:

I definitely prefer Perlin noise, but there isn't much I can do about it, so Simplex noise will have to do for now. I broke plate stresses, so I don't have those for show right now. I'm probably going to end up doing a stepwise simulation of plates - I didn't want to, since that would take a very long time, but I don't think there's any simple algorithm I could use to calculate plate velocities, stresses, and boundaries all at once.
Logged

Captain Mayday

  • Bay Watcher
  • A Special Kind of Terrible
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #32 on: February 03, 2011, 10:54:41 pm »

I definitely prefer Perlin noise, but there isn't much I can do about it, so Simplex noise will have to do for now. I broke plate stresses, so I don't have those for show right now. I'm probably going to end up doing a stepwise simulation of plates - I didn't want to, since that would take a very long time, but I don't think there's any simple algorithm I could use to calculate plate velocities, stresses, and boundaries all at once.

If it's any consolation, this will probably be the best and most natural random map generator that has been written.
Logged
Why not join us on IRC? irc.newnet.net #bay12games

Akhier the Dragon hearted

  • Bay Watcher
  • I'm a Dragon, Roar
    • View Profile
    • My YouTube Channel
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #33 on: February 03, 2011, 10:57:41 pm »

   After you finish it you can always go back and play
with it some more to try and get it working with Perlin
noise. I advise though moving on to something else at
the moment. Your mind is still working on it so go do
some other part and let it think in peace. Later you
may look back and be surprised that you know how
to fix it!
Logged
Quote
Join us. The crazy is at a perfect temperature today.
So it seems I accidentally put my canteen in my wheelbarrow and didn't notice... and then I got really thirsty... so right before going to sleep I go to take a swig from my canteen and... end up snorting a line of low-grade meth.

Kogut

  • Bay Watcher
  • Next account: Bulwersator
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #34 on: February 04, 2011, 02:30:26 am »

Is it planned to release source code?
Logged
The worst bug - 34.11 poll
Tired of going decades without goblin sieges? Try The Fortress Defense Mod
Kogut, the Bugfixes apostle of Bay12forum. Every posts he makes he preaches about the evil of Bugs.

Normandy

  • Bay Watcher
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #35 on: February 04, 2011, 08:38:38 pm »

Well, I kinda just want to do this as a personal project, but if there is enough interest, sure, I could definitely clean up the code and release it. There are a bunch of coding conventions and peculiarities that I follow when I'm programming for myself, so it's kind of useless to release my code in such a state.

Also, I'm taking a lot of inspiration from SimEarth, such as the magma convection currents. SimEarth had a fairly realistic terrain simulation as well, as well as climate, erosion, etc... However, given its age, they couldn't take advantage of the processing power we have today. I plan to rectify that.
Logged

Kogut

  • Bay Watcher
  • Next account: Bulwersator
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #36 on: February 05, 2011, 05:12:11 am »

It would be nice - even to check what can be used to show map like this in first post. It will save a few hours of checking possibilities.
Logged
The worst bug - 34.11 poll
Tired of going decades without goblin sieges? Try The Fortress Defense Mod
Kogut, the Bugfixes apostle of Bay12forum. Every posts he makes he preaches about the evil of Bugs.

Normandy

  • Bay Watcher
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #37 on: February 07, 2011, 07:50:03 pm »

http://www.mediafire.com/?v00bkive1tvmhv1
Well, that's all I have currently. It's an eclipse project archive, so if you can import it directly into Eclipse. It needs toxiclibscore (http://toxiclibs.org/), for the 4d simplex noise function. If you can replace this 4d simplex noise function with an alternative 4d noise function, then you don't need the library.

(EDIT: Actually, I came up with a better idea; since the current map is only wrapped as a torus in 3 dimensions, it should be possible to use only 3d noise to generate smooth wrapping; I'll put up a fixed version in a bit).
(EDIT2: Scratch that. The map doesn't actually wrap in a torus. It's impossible to have the edges of the map wrap in only 3 dimensions without stretching.)

I haven't done much since the last update, due to getting swamped with school-related activities. Good luck reading it, I haven't had a chance to comment any of it, as most of it works on personal conventions I have assumed. Mind you, I don't intend to run this project like an open-source project, or as any sort of collaborative project at all, so please don't ask me to format my work any more than I have already.

I got sidetracked with more under-the-hood stuff. I decided to take a change in plans and implement a spherical map now, so I now have the underpinnings of an icosahedral map (that took a long time). This was after the realization that all the work I've been doing with squares would basically be irrelevant once I moved to a spherical mapping, since there's pretty much no way to tile squares on a sphere. Instead I've begun the process of retooling everything to work in terms of equilateral triangles. If the triangles are "small" enough, geometry says that I'm basically working on a Euclidean plane. Triangles will give me the flexibility to work both on 2d and 3d maps simultaneously, without having to do weird transforms or other interpolations.

This opens up a few avenues but also restricts other ones. I can no longer work with vertexes, as not all vertexes will have the same number of neighbors (to be precise, exactly 12 vertexes will only have 5 neighbors, as opposed to 6). This means I'll have to retool my magma movement mathematics. Also, direction can become confusing; rather than having a simple (x,y) coordinate system to work with, I have to work with an (r,c) system that looks like this:
Code: [Select]
           -     -----------------
       0  /0\  0  \1/2\3/4\5/6\7/  0
         -----     -------------
     1  /0\1/2\  1  \3/4\5/6\7/  1
       ---------     ---------
   2  /0\1/2\3/4\  2  \5/6\7/  2
     -------------     -----
 3  /0\1/2\3/4\5/6\  3  \7/  3
   -----------------     -
With paired triangles and passing between triangles, it can get pretty confusing. It also screws a bit with my multivariable calculus (i.e. no more easy ∫∫ dx dy T.T), but that's just a minor concern.

On the other hand, this opens up the possibilities of all sorts of maps, both 2d and 3d; it's possible to build a wide variety of contours using equilateral triangles, very few of which can be achieved with squares. It also gives finer-grained control over the values themselves since each cell has less neighbors. 3d rendering also becomes a snap, no weird mapping involved.

Probably though I'll end up writing a convert between triangle and square data at the very end, since most people expect map data to be in grids (exactly why, I'll never know). However, I intend the internal workings to be fully in triangle grids, to make everything consistent. With that in mind, the next update might take a little bit longer while I get used to the new system and write the new code, but updates will gradually speed up.
« Last Edit: February 07, 2011, 08:05:09 pm by Normandy »
Logged

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #38 on: February 07, 2011, 09:15:10 pm »

I have done a little work in that kind of mapping. You don't really have to abandon "squares" completely. You can create a mapping between an N sized square and a triangle of N depth. Adjacency is preserved except on the squares diagonal from lower left to upper right. The Nth level of the triangle maps to the bottom and right positions of a size N square. Adjacency going from triangle going to square does get a little warped at places though

Code: [Select]
00 01 02 03

10 11 12 13

20 21 22 23

30 31 32 33

           /\
          /00\
         /____\
        /\    /\
       /10\11/01\
      /____\/____\
     /\    /\    /\
    /20\21/22\12/02\
   /____\/____\/____\
  /\    /\    /\    /\
 /30\31/32\33/23\13/03\
/____\/____\/____\/____\
« Last Edit: February 07, 2011, 09:22:08 pm by Nadaka »
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Normandy

  • Bay Watcher
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #39 on: February 08, 2011, 11:36:15 pm »

Haha, now that I look at it, that is a much simpler and cleaner way to represent triangles in memory. However, I'm not interested in mapping square grids to triangle grids or vice versa until the very end (i.e. the output). When you mess with distances between points like that, you're always going to end up with distortion.
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #40 on: February 09, 2011, 03:33:32 am »

If you're going to map it to a sphere anyway, why not work in spherical coordinates in the first place? If you need to work on a plane you can just pin r to a constant and work with phi and rho as your variables (true, that would be impossible to project in 2d without distortions though).
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #41 on: February 09, 2011, 04:11:51 am »

I don't know... As far as terrain gens go, I like the strange object that wraps seemlessly across the top and sides, more then the sphere that you either need to show in 3d, or bend into strange shapes.

Normandy

  • Bay Watcher
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #42 on: February 09, 2011, 06:30:10 pm »

The one thing I need more than anything in a coordinate system is for (u,v) to be precisely 1 unit away from (u+1,v) and (u,v+1), regardless of where it is. This is not true for spherical coordinates.

I'm still going to have the strange object that wraps seamlessly across the top and sides (by the way, it is in fact not a 3d torus; it is two 3d cylinders with perpendicular heights in 4d space). Just that I'm going to represent it with triangles so there's more consistency between that and a sphere. I dislike square grids, and it's always completely possible (and relatively trivial) to convert between the two, so don't worry about that.
Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #43 on: February 09, 2011, 07:36:41 pm »

you can cheat to just show it as a spinning "3d" sphere without to much effort.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Project: The World is Just Awesome - Advanced Terrain Generator
« Reply #44 on: February 11, 2011, 09:12:23 am »

Posting to follow :)

I abandoned the idea of using tectonics for terrain generation, for the simple reason that the result can easily be abstracted (fault here, subduction there, lala finished), and the later erosion/metamorphic/intrusive phases are way more important to realistic geology (Disclaimer: I'm reading about geology for about a few months now, so I don't know jack sh*t yet). That is not to say that I don't wish you the best, I'm still interested to see if it can be done...
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))
Pages: 1 2 [3] 4 5 ... 7