Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Project idea: More realistic geology engine  (Read 2506 times)

GavJ

  • Bay Watcher
    • View Profile
Project idea: More realistic geology engine
« on: June 24, 2014, 12:55:25 am »

TL;DR version:

Make an engine that simulates actual dynamic geology from scratch. Have a much more realistic world with more variable and dynamic challenges and need for trading and politics and war, and also more strategic flexibility at the scale of single forts. Additionally, more interesting formations to inspire fort design, and the option for hardcore players to have the game not tell them about resources and deduce from actual geological principles where the goodies are. Such an engine might be able to be modded in third party (not sure), or could be presented to Toady as a gift that he could probably understand quite well and might be happy to include, if it's successful.

________________________________
Long version:

Basically: Making a much more realistic geology algorithm for world gen. Much more involved and dynamic than the current model. Something like (very briefly/broad strokes):
0) Everything starts as...some type of initial layer or simple rough approximate flat sandwich. Might require trial and error. Hard to say, since this is shortcutting past a ton of history we don't need to simulate.
1) Determine random plates by algorithm
2) Choose motion vectors for each, and flip coins at convergent boundaries for subduction.
3) Determine other boundaries randomly  (some through the middles as appropriate) as simulated older sites of convergence
4) Determine volcanic ridges and arcs from the above.
5) Initial elevations. Basically, simulating the tectonics for some amount of time of time. From volcanic activity, from subduction trenches and mountains. You want to run the simulation for a little while only. Maybe, say... 1/4th of a full cycle (cycle being from new rock all the way to it subducting under again). Enough to get some shape going. Includes making new rock (just extending the length of our planes) near ridges. This is a lot of math involving 3d massaging the shapes of planes.
5) Do a metamorphism pass based on depth pressure on rocks at this point. Also "melt" particularly deep stuff that's been subducted way down.
6) very roughly estimate a thin initial layer of sedimentary from coastal proximity and initial rain shadows, etc. Just enough to help with step 7:
7) Determine new and old near-surface intrusions (which will be active magma, pockets of intrusive stone, or caves). They branch and fill in between layers, which is why we wanted some initial layers to work with. More accurate sediments later. Some intrusions push up more mountains and further refine elevation.
8) More localized metamorphism from the intrusive heat and pressure.
9) Now go back and do more serious sedimentary calculations, with the major elevations fleshed out. Erosion simulations (wind and water) included, depositing sediments locally and also some global amounts. Have avoidance gradients near volcanic regions (where sediments are thin if any, haven't had much time to build up. If they do have a strong indication of buildup there, stick to higher % of soils than sedimentary rock). Erosion will also tend to expose other strata here, in areas where they've been pushed up by tectonics or intrusion. So you get some the realistic diagonal cuts across strata and stuff.
10) NOW go back to step 5! more tectonics. Repeat up to step 10. Then maybe once more. This way, you get interesting old scars from "old" geologic activity in the middle of plates, so nowhere on the map is overly boring. Skip step 6 for the second and third rounds through.
11) possibly glacial simulation.
12) The last pass on erosion is where the actual rivers stay for gameplay. Then also determine rain shadows and so on (similar to perfectworld's algorithms, which do a good job) for vegetation biomes, which also depend on sedimentation and would NOT have any correlation with sudden rock cutoffs like in DF currently (aside from plants obviously stopping at fault lines that drop into the ocean! lol)

Why? Lots of reasons:

* Partially for its own sake. DF is supposed to be a world simulator in large part.
* The current engine has a LOT of 2-dimensional only algorithms involved. Layers always suddenly shift at 2-D flat cutoffs in a biome. Which personally I find quite disillusioning for one thing. But also it (negatively, I think) affects the creativity with which we build forts, making you think more 2-dimensionally. "This layer is for mining, then 6 feet up it's totally not at all mining and is only bedrooms because there's suddenly no ore" etc. It generally makes everything more uniform too, for less varied gameplay, because you know basically what to expect and it's always the same layout more or less. If some places were geologically flat (like most of Russia) and others had lots of exposed outcroppings (or even flat, but with across the grain cuts, like glacial valleys, e.g. Iowa or Illinois), it could very interestingly affect NPC trade good availability, the feasibility of near-surface forts (which would matter more if mining deep were more difficult, too), etc. Humans can only dig so deep, dwarves a little deeper. Having more layers intersect the surface = richer variety of goods available to one civilization. These are areas to fight over.
* Much cooler cliffs and topography, surface overhangs, convincing rivers with attendant bluffs and such. All are more feasible to include when they make sense from the core engine, rather than band-aiding them onto a quick and dirty facsimile of geology after the fact.
* Site choosing could be more entertaining and skillful. Some rudimentary knowledge of geology (which the game could provide some of in tutorial form) is not strictly necessary, but if applied, would help you find better sites by using your NOGGIN, not free magical information from the embark screen. Do away with free hints about deep mineral composition (or restrict them to easy mode, rather), and deduce what the composition SHOULD be from the lay of the surface features, etc. If you do poorly, you have a more Fun (tm) game and learn better for next time.
* Caves aren't everywhere, although should be much more common than in real life still. Maybe 20% of randomly chosen embarks (but 60-80% of embarks if you look in the right places) have significant caves. This helps to make games more tense and interesting by NOT guaranteeing a source of free forests and animals and crops on every map no matter what (also, I'd suggest restricting that stuff to more "exotic" caves like deep earth intrusive caverns that are more mysterious in real life, not surface limestone type caves). When you do find them, they can take much more interesting shapes and sizes that offer inspiration for fort building ideas.
* Similarly, magma is not just in straight lines or big sheets. Far from it. Currently, it's not very dynamic, because you either have a dependable, known shape of magma source ahead of time that you can dig to and pump up allllllways, or you have a free tap that otherwise negligibly interacts with anything. If digging deep near volcanic areas, you would more likely be hitting all kinds of crazy tubes and underground pools (sills and dykes and laccoliths), you'd be able to come in from the sides for large depths, etc. Whereas far from tectonic boundaries, you'd basically never find magma, without digging absurdly deep (which again, should be much harder to do). Thus, harder to get candy and clowns or magma forges (BUT at the same time, more likely to have sediments, farms, iron). And again, inspiration for more dynamic fort building plans.
* Although between sites is more variable by far, within a given site, there's less variety than currently in this setup (at least for larger maps). This is very important, because as Toady adds world-relevance and more trading and politics, we need to have INCENTIVES for using those things. Not having all the resources you want all in one place means the political and economic map matters much more often. Armies and conquest for resources matter.
* Worlds would just look a lot cooler! =P
* I didn't mention them explicitly above, but minerals follow all these same rules. Coal can be deposited during phases of the worldgen tectonic loop based on random die rolls for ages when there was a lot of life abundant. Fire clay goes directly under coal usually. and so on and so forth. No random veins pasted in here and there in general layers with minimal rhyme or reason, but actual seams that fold between layers and sometimes expose on cliffs, in a more strategic, satisfying, realistic, fun manner. And like everything else, you can just go look for exposed iron or have the game tell you where it is if you want to play that way, or you can tell the game to give you less information and try to deduce where the iron or coal is from geological clues, to satisfy a gradient of casual to hardcore players.
« Last Edit: June 24, 2014, 01:01:25 am by GavJ »
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

Roses

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #1 on: June 24, 2014, 09:12:47 am »

This should probably go in the suggestions forum, since none of this is remotely possible with modding.
Logged

GavJ

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #2 on: June 24, 2014, 11:14:46 am »

1) How do you know it isn't possible to mod in third party? What are you basing that on? I know that in a fort game, dfhack can both read (fully) and write (to an extent) any tile. What about during worldgen? Or more precisely, right after the geological part of worldgen? If we have access to memory structures for the world then, they could simply be entirely replaced before civ placement. Then proceed as normal. This may very well be impossible, but do you actually know that for sure? (Note that it doesn't have to be possible IN DFHACK, just possible in any conceivable realistic memory editor)

2) Assuming it isn't possible third party, as mentioned in the OP, then it could be developed anyway by players and gifted to Toady. DF itself is not necessary to either write this or debug it, since it is a matrix manipulation problem, not a DF-specific problem. And Toady has, in the past, expressed willingness to include other code if it works well (check - would only offer if it did), furthers his agenda (check) and if he can fully understand it so that he doesn't have alien code in his game (also check -- this would all be easy-to-verify geological info + math, which is his specialty).

I did not put it in suggestions directly, because it is too big for the scale of that forum IMO and would probably be 15 years or never there. And I fully plan and am willing to do most heavy lifting myself.
« Last Edit: June 24, 2014, 11:16:57 am by GavJ »
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Project idea: More realistic geology engine
« Reply #3 on: June 24, 2014, 11:43:29 am »

1) How do you know it isn't possible to mod in third party? What are you basing that on? I know that in a fort game, dfhack can both read (fully) and write (to an extent) any tile. What about during worldgen? Or more precisely, right after the geological part of worldgen? If we have access to memory structures for the world then, they could simply be entirely replaced before civ placement. Then proceed as normal. This may very well be impossible, but do you actually know that for sure? (Note that it doesn't have to be possible IN DFHACK, just possible in any conceivable realistic memory editor)

2) Assuming it isn't possible third party, as mentioned in the OP, then it could be developed anyway by players and gifted to Toady. DF itself is not necessary to either write this or debug it, since it is a matrix manipulation problem, not a DF-specific problem. And Toady has, in the past, expressed willingness to include other code if it works well (check - would only offer if it did), furthers his agenda (check) and if he can fully understand it so that he doesn't have alien code in his game (also check -- this would all be easy-to-verify geological info + math, which is his specialty).

I did not put it in suggestions directly, because it is too big for the scale of that forum IMO and would probably be 15 years or never there. And I fully plan and am willing to do most heavy lifting myself.
1. He never said its impossible by third party. He said its impossible by modding. Thus is much more suitable in the utility section, since it would require an external utility to do.
2. Toady doesnt accept gifted code. Binary patches, yes. Raw changes, yes. Code, no.
3. There are far larger suggestions than this in the suggestions forum.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Miuramir

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #4 on: June 24, 2014, 11:47:42 am »


Make an engine that simulates actual dynamic geology from scratch.

This is harder than you think.  I've played around with these sorts of things off and on for a few decades, for purposes of RPG world generation, Civilization world generators, etc. and I've never found one that does either or a great job on geology, or a good job on geology and also a good job on playability.  The ones used by serious folk tend to be slow, as well; while some people (myself included) would be willing to gen a single world overnight on a powerful computer, the demand is likely to be low. 

There's also the problem that statistically and realistically speaking, most regions are both boring and without much useful mineral resources.  If one assumes that the DF region generator doesn't generate truly random regions so much as have a "Level 0 reject" built into the assumptions so that it generates random regions *likely to have interesting Dwarven civilizations*, that helps considerably. 

Remember, additionally, that eventually the global economy will kick in.  Right now one can brokenly trade nigh-unlimited no-quality rock mugs or lavish meals as the basis of an outpost; once the former become so common that they're not worth carting off site and the latter spoil, it will be much more of a requirement to locate your fort someplace that takes advantage of an unusual resource, just like dwarves do in most fiction. 

Putting all that aside, however, DF is a much *harder* problem; it aims for procedurally-generated mythology and cosmology.  Some worlds will be topologically flat and endless; some will be flat with an edge or domain boundary (ie, wrapping), and others may be 3D shapes embedded in space, possibly upon the back of (in the claws of, etc.) some randomly-generated animal. 

Even in the "default" DF cosmology we have currently, it's fairly clear that the world doesn't work in the way we're accustomed to thinking.  The bottom of the map is a super-dense material with properties beyond normal physics (slade), there are strange stringers of super-light tensile material (adamantine) loosely perpendicular to it, and then there are the eerie glowing pits.  Less exotically, the presence of a magma sea underlying most of the world very near the surface (in geological terms) has interesting implications. 

To my mind, the closest model is to assume that a DF Region is a small segment of something like an Alderson Disk, probably with actively cooled "stripes" similar to those from Stross's "Missile Gap".  (Or, to put things in terms from Niven's Known Space setting, slade is equivalent to scrith, and adamantine is equivalent to shadow square wire.)  The bottom layer of largely-physical material is heated (by induction, or perhaps that's what the demons are *for*), and the "pole stripes" (radiators, or something equivalent using sufficiently advanced technology / magic) remove heat; the flow between the two is what ultimately drives the biosphere and local igneous geology.  Sedimentary geology is a comparatively thin and recent series of layers.  Most of the visible rock was initially laid down in simplistic layers, presumably by a script, divine fiat, or something like the giant strata machines from Pratchett's "Strata".  "Normal" erosion has been allowed to kick in for a comparatively short time, cutting canyons here and there and softening cliffs but not much beyond that. 

Eventually, one hopes that we will have procedurally-generated cosmology which would then call one of several different pseudo-geology generators, and that the generators are moddable; by then Moore's Law will have hopefully ticked over a few more times and we will be able to have quite a variety, even one for such unlikely combinations as a ball of mildly radioactive hot rock spinning through space that was hit by another large ball of rock some years ago, which after cooling slightly and a few comet impacts has developed an interesting thin crust on which strange things happen :) 
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #5 on: June 24, 2014, 11:49:11 am »

Well you would basically need to write a terrain simulation engine, completely separate from DF or DFHack (basically all of your suggestions in an external program). That program would then need to spit out an entire map/world's worth of squares.

Each square would need to be linked to a biome, a tile type, a material type (if necessary), and groups of tiles of the same type and mat type (i.e. veins and such) would need to be grouped in 16x16 squares and then linked together (so that you know something is a continous vein).

You would also need to read from the raws to make sure you get all of the materials that the world is made of, and for the classification used in game. I suppose you could use the natural classification for most things, but all of the fantasy stuff would need it's own stats.

Now that you have a program that can read in the raws and generate billions of squares of data, now comes the hard part.

In order to link it into DF (if it is even possible, I know DFHack can change individual tiles to a small extent, but even that is difficult and prone to errors) you need to create groups of 16x16 blocks, creating arrays that are exclusive for each block, but tied to the neighboring blocks (what I mean is that DF doesn't store a simple tile type, mat type tuple for each map tile. It actually stores a biome number, a tile type, and a mineral instance, which means for a certain block the mineral instance for copper might be the first mineral instance while the neighboring block it is the third, etc...). Now you also need to be careful not to overwrite any native features like adamantine spires and underground fortresses, but I suppose that is an easier problem in all of this.

So while technically not impossible (very few things in this universe are actually impossible), it is more difficult than I think you imagine it being.

That being said, a utility like PerfectWorld goes a long way to at least make reasonable topographical maps (i.e. people have done maps of the US and such). So you could start with that and pair it with your utility for custom maps.
« Last Edit: June 24, 2014, 11:54:30 am by Roses »
Logged

GavJ

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #6 on: June 24, 2014, 03:37:41 pm »

Quote
3. There are far larger suggestions than this in the suggestions forum.
But implemented ones? People writing down big ideas there doesn't mean much if none are implemented. Just like the existence of an auction that starts bidding at $1,000,000 for a pencil on ebay doesn't mean much if nobody has bid yet...

Roses: Yes there are certainly some very difficult things here. I'm not so sure I would agree that merely dividing the map into a 16x16 grid or reading text files is amongst those things, but it's a moot point, because I agree some things certainly are, like modeling plate crumpling and subduction in 3D. I am not pretending it's easy, which is part of the reason I was assuming an alternative route might be needed to ever actually see it done in my lifetime.

Quote
The ones used by serious folk tend to be slow, as well; while some people (myself included) would be willing to gen a single world overnight on a powerful computer, the demand is likely to be low. 
It's not like I'm proposing to model individual gem type formation conditions, or to link the density/bouyancy of plate rock to the angle and speed of subduction, or things like that that an academic model might care about. My target is more like "many minutes" (8? 10?) for a medium world, which I think most players would swallow, considering it being a marginal increase on total history running and embark preparing time and all that.

Quote
Remember, additionally, that eventually the global economy will kick in.  Right now one can brokenly trade nigh-unlimited no-quality rock mugs or lavish meals as the basis of an outpost; once the former become so common that they're not worth carting off site and the latter spoil, it will be much more of a requirement to locate your fort someplace that takes advantage of an unusual resource, just like dwarves do in most fiction. 
I can't see how this wouldn't be a BENEFIT to global economy simulation, and indeed that's one of the main motivations for doing it. Right now you have basically 3 types of embarks that matter: iron-y sediment ones, extrusive ones, and ones that have nothing useful in their sedimentary layer and are thus basically just rocks and low value metal(s). Other than that, little else matters at all. Crops don't matter. Trees don't matter, you can get them in caverns. Water doesn't matter, you can get it in caverns or aquifers almost anywhere in infinite supply, and you can desalinate it and remove all cysts and bacteria with a simple wooden screw somehow. Magma is equally available everywhere. Gems are everywhere, clay and sand are pretty much everywhere, etc.

A system that creates much clumpier worlds creates the "unusual resources" you mention as something that exist in the first place, instead of everything basically being everywhere. It's almost a basic necessity to make a wilder geology for a sensible or interesting global economy. Trading in such a world would be tenfold more common. Everyone has lots of X but no Y or Z. As opposed to everybody having their own amount of X,Y, and Z.

Quote
1. He never said it's impossible by third party. He said its impossible by modding. Thus is much more suitable in the utility section, since it would require an external utility to do.
2. Toady doesnt accept gifted code. Binary patches, yes. Raw changes, yes. Code, no.
Fair enough. Can I move it myself somehow?
Also, if Toady wouldn't accept such a thing, fine. But even so, the most efficient sounding suggestion IMO is more like "give us explicit points in world gen where the game accepts external binary files in such and such format as optional replacements of what it's done so far, then moves on." I will ponder how best to suggest that and possibly post something along those lines.
« Last Edit: June 24, 2014, 03:48:59 pm by GavJ »
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

deepfreeze78

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #7 on: June 24, 2014, 10:58:31 pm »

Would it be possible to just make it so the program/utility borrows the history generation from Toady, so it creates the full thing, and then ou just import it as a full save instead of finishing worldgen in-game? I would love to see this happen. I'm not sure if it will help, as it is a completely different game, but Europa Universalis 4 has a utility/mod/thing that does much of what you are suggesting, so maybe you could contact the person who made that about it. I'll try to find the right link if you want.

Here it is: http://forum.paradoxplaza.com/forum/showthread.php?751689-MOD-CoP-Haftetavenscrap-s-Realistic-Map-Generator&highlight=realistic+map+generator you might need an account on the paradox forums to see it, can't remember.
« Last Edit: June 24, 2014, 11:04:36 pm by deepfreeze78 »
Logged
Nothing's truly dwarfy until it's been weaponized to kill elves with magma.

Miuramir

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #8 on: June 26, 2014, 02:20:27 pm »

But even so, the most efficient sounding suggestion IMO is more like "give us explicit points in world gen where the game accepts external binary files in such and such format as optional replacements of what it's done so far, then moves on."

Note: for purposes of this post I'm largely talking about "Earth-like" generation; IMO that's actually likely to be a small fraction of typical DF cases, but it's the one of most direct relevance to the OP's intent as far as I can tell. 

Thinking about this some more, the main issue seems to be that DF uses a "staged" procedural generation.  Using something like PerfectWorldDF (henceforth PWDF) allows precise control of the outermost / topmost layers of generation, but the details as you stage downward are still deep in the DF closed code.  At some level, this is probably performance-driven; a tectonics-aware script needs to track a lot more info in time and space outside the region of interest at the moment. 

For example, let's say you write an external "living world" tectonics sim that outputs a final result in the same way PWDF does.  With good programming it may be able to generate something that the game will correctly interpret as a fairly flat lowland with thicker sedimentary layers and meandering drainage; but knowing the difference between "this was filled in by eroding off a rapid-upthrust granitic mountain chain, and should be full of sandstones with occasional larger or smaller mixes" and "this was filled in by gradual bottom deposition in a shallow intermittent sea, and should be full of thick layers of carbonates and siltstones with occasional salt layers" requires passing forward into the local terrain generators far more history about the regional background than we have the ability to do.  Then actually having the salt layers at roughly the right level in multiple sites to correspond to specific dry / upthrust periods is another step beyond that. 

Basically, we have the ability to work with and nearly replace the world generator; but very little control about the regional or local generators that spawn off of that as needed.  It's also not clear if the underlying structure of DF is capable of supporting the level of global detail tracking needed; the staged levels is presumably at least partly so that generating local geology *doesn't* need to know the entire history of the continent, just procedurally generate "something reasonable" based on a fairly small number of cues from the next level up. 

Additional wrinkle: the largest region DF works with is 257 x 257; at most that's likely a quadrant of a world, and I think is probably an octant or less.  Generating a world with proper spherical tectonics will presumably involve working with a much larger framework, out of which a DF region has to be picked. 

That said, if you're serious about working in this direction, the logical place to start is to look at something like PWDF, but replace the Perlin noise starting point with actual plates that careen about for several hundred million years.  As a very rough guess, I'd think generate a super continent, break it, run plates until mostly a supercontinent again, break that, run forward until interesting mix would suffice; obviously Earth has had several more cycles.  (In other words, generate something roughly analogous to Pannotia, break, reassemble into Pangaea, break again and run forward a bit.)   Occasionally slamming a really big rock into things will help create interesting regions, see the Sudbury Basin complex for a good real-world example. 

That way, you can generate output to feed into DF currently; but if Toady ever gives some more parameters into the smaller-level generators, or even lets outside programs be called (or at least their output loaded), your code knows what is "really" going on and can generate the additional data easily. 
Logged

GavJ

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #9 on: June 26, 2014, 03:43:45 pm »

Quote
passing forward into the local terrain generators
This is where I lost you. The suggestion you quoted was to have the options for players to fill in the ENTIRE WORLD custom. I.e., no need for any "local terrain generators." It just cuts off an embark sized slice of exactly what you gave it, with no interpretation.

All DF has to do, at all, is read a matrix of final info about tiles, which should take seconds, if that.  If DF currently has local on-the-spot terrain generator algorithms, then it merely needs to put them all in a big condition IF block and bypass them in the event that the world was custom-supplied.

I'm not saying that's a trivial update. Toady might have to move around a lot of stuff to make a clean cutoff point for inserting custom worlds. But it should surely be vastly, vastly easier to code than him making an entirely new more realistic geology generator. Thus much more likely to get to the final destination of gameplay sooner.

Quote
Generating a world with proper spherical tectonics
I'm not aware of anything particularly special about spherical tectonics that would make any noticeable difference over 2D tectonics of randomly generated plates that just extend off the edge a bit during algorithm.

Worst case scenario, you just make the top edge roll over to the bottom edge and the sides to the sides, and then I would be absolutely floored if anybody short of a PhD could look at the final product and say which came from a sphere.
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

Miuramir

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #10 on: June 27, 2014, 01:56:06 pm »

Quote
passing forward into the local terrain generators
This is where I lost you. The suggestion you quoted was to have the options for players to fill in the ENTIRE WORLD custom. I.e., no need for any "local terrain generators." It just cuts off an embark sized slice of exactly what you gave it, with no interpretation.

All DF has to do, at all, is read a matrix of final info about tiles, which should take seconds, if that.  If DF currently has local on-the-spot terrain generator algorithms, then it merely needs to put them all in a big condition IF block and bypass them in the event that the world was custom-supplied.

I think you're either drastically underestimating the storage and access time for a planet's geology at the level you are interested in, or you're assuming some level of abstraction that you are not making clear.  Your OP seemed to be talking about simulating geology down to at least the 10-meter scale, over a large enough area to reasonably include the influences on an embark site (100 km would probably not be enough, so at least 1,000 km?) over substantial chunks of geological time (admittedly at very coarse time ticks).  With traditional techniques that's going to be daunting at best. 

The logical way to do this is a variable-resolution grid of some fashion; but still, getting the sim accurate enough to simulate bedding and mineral deposits means you can't back off much. 

Remember that as DF goes forward, you don't just need the geology of the embark site; there's the Hill Dwarf communities around it, the towns beyond that, your mountainhome, other mountainhomes, and so on.  If meaningful trade based on what local minerals and conditions each town has access to is going to be important, the towns need to know what they have access to.  The seed-based detail generation of DF is in effect a highly effective compression tool, and getting anything even remotely as effective with arbitrary data will be exceedingly difficult. 

Quote
I'm not saying that's a trivial update. Toady might have to move around a lot of stuff to make a clean cutoff point for inserting custom worlds. But it should surely be vastly, vastly easier to code than him making an entirely new more realistic geology generator. Thus much more likely to get to the final destination of gameplay sooner.

All my comments aside, there's nothing particularly stopping you from trying this.  Set up a repo and write your open-source geology simulator with an low-res output mode that just happens to be DF-compatible in the current fashion, and that has well-documented medium- and high-res output formats, and present it to Toady and the community.  I think the odds of having the output from an *existing* product loaded are considerably higher than getting Toady to include a complex feature for a hypothetical input, whatever the base likelihood is.  Bonus points if the high-res output can be loaded into something like Stonesense for visualization even if it can't (yet) be loaded into DF itself; being able to *show* people how much more interesting and/or realistic it looks than the default DF local generator will likely go a long way toward acceptance. 

Quote
Quote
Generating a world with proper spherical tectonics
I'm not aware of anything particularly special about spherical tectonics that would make any noticeable difference over 2D tectonics of randomly generated plates that just extend off the edge a bit during algorithm.

Worst case scenario, you just make the top edge roll over to the bottom edge and the sides to the sides, and then I would be absolutely floored if anybody short of a PhD could look at the final product and say which came from a sphere.

"Asteroids"-style wrapping is probably adequate for most purposes, agreed.  My comment was more directed at attempts I've seen over the years to do a non-wrapping window, which never seem to give good results.  IMO the "if you push something here, it wraps around" aspect is important to get reasonable and good looking results. 
Logged

GavJ

  • Bay Watcher
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #11 on: June 27, 2014, 02:29:30 pm »

Quote
(100 km would probably not be enough, so at least 1,000 km?)
??

The largest world in DF is 257 world tiles, which is 400km. Don't know where you're getting 1,000 from. Also, people who gen large world already expect it to take a whole day or whatever, and so on down the line, so the expectations start out reasonable. A lot of people play on smaller worlds that are as small as 13km across (pocket world)

Just like mountain ranges and biomes and everything else in DF are to a different scale, so would plate sizes be. And then, as you mention, not every game tile has to be simulated in world gen. probably more like 3x3x3 (the 10m mentioned) would be reasonable, yes, saving 27x speed.

So for a 50 tile deep plate with 25 tiles to subduct down in calculations and 125 to move up, a large would would be 1.5 million total geology voxels. In other words fewer than the number of pixels on a 1080p screen, for the whole largest size world.

Which is nothing. I've made a lot of 3d "paintbrushes" for smoothing and doing translations and rotations and stuff in minecraft in the past, and a server computer was easily able to handle major 2 million block operations in seconds (as in rotating all of them. Easier things like simply adjusting layers from such and such a depth or whatever to be metamorphic or applying a mask can be almost instantaneously). Also this was on a computer with like 30 other people playing minecraft in the meantime, also using up processor and memory.

(Edit: You do need a final smoothing pass at the end so everything doesn't look like 3x3x3 chunks. But not with every step.)

Quote
The seed-based detail generation of DF is in effect a highly effective compression tool, and getting anything even remotely as effective with arbitrary data will be exceedingly difficult. 
Not really. Dfhack's "prospect" tool already does this perfectly well in well under 1 second for a standard embark - It scans and counts either all resources visible from the surface (which might be how you want to do non-dwarf trading materials) or in the whole map.

Quote
All my comments aside, there's nothing particularly stopping you from trying this.
What's stopping me is a concern about sinking 6 months of coding into a project and then having people go "Oh, we can't actually put that in the game in any way... sorry bout that dude"

If anybody can tell me for sure a way that it could be made playable if created, then I will give it a shot. I don't know enough about dfhack or the extent to which we know Toady's code to know if that's possible or not. But yes, I can make a binary file for you with tile type and material and biome and whatever else is needed, in some conveniently readable format.
« Last Edit: June 27, 2014, 02:47:06 pm by GavJ »
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Project idea: More realistic geology engine
« Reply #12 on: June 27, 2014, 02:30:30 pm »

While completely disregarding everything said here before, I'd be much more interested in custom underground sites. Open chasms, camps of animalmen, self-defined curious underground structures, ruins with traps, ruins with undeads, left items, underground rivers, crystal geodes, and magma rivers. If these could be hacked into the normal rock layers, I'd be perfectly happy.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

TheFlame52

  • Bay Watcher
  • Certified geezer & only man to win 0.40.24
    • View Profile
Re: Project idea: More realistic geology engine
« Reply #13 on: June 30, 2014, 04:52:36 pm »

If you go through with this, you have to find a proper way to generate adamantine spires, as well as a reason for why everything doesn't just collapse into the underworld.