Bay 12 Games Forum

Please login or register.

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

Author Topic: Tip for getting desired soil layers on embark (sand, clay etc)  (Read 7702 times)

DG

  • Bay Watcher
  • Pull the Lever
    • View Profile

It's been a while since I've contributed to dwarf exploits science. I discovered this on my own and I doubt it's common knowledge so I've decided to share.

I found a nice volcano embark which had silty clay and no sand. I really like to have sand on map (who doesn't?) so I took note of an unimportant soil layer, in this case it was a section of peat. I then went to the inorganic_stone_soil.txt file in the raws and swapped the order that the peat entry appears with a sand entry, while I was there I swapped the position of my current clay entry with the one for fire clay. To be clear, I didn't delete or alter the wording of anything in the file, I just swapped the positions of the exact layers that appeared on my chosen embark with what I'd rather they were. I then re-genned the word with the exact parameters. Upon embarking again I now have fireclay and white sand.

I haven't tested whether this works for stone and ore layers. Here's a pic comparing the same section of the embark area as proof.



So to recap:
  • make sure you have the exact worldgen parameter details of your chosen world
  • take note of the exact soil type on your chosen embark site that you want to swap with another
  • find the entry for that soil type  in inorganic_stone_soil.txt
  • swap the entire paragraph of that entry with the entire paragraph of the desired soil type
  • regen the world with the exact same parameters
  • churn out eternal glass goblets for profit with technically no modding required

No map need ever be "almost perfect" again.
Logged

Godlysockpuppet

  • Bay Watcher
  • [Insert wit here]
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #1 on: August 27, 2013, 01:46:24 pm »

If youre going to that extent just use the dfhack command changelayer/vein :/
Logged

Broseph Stalin

  • Bay Watcher
  • Dabbling Surgeon, Proficient Butcher.
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #2 on: August 27, 2013, 02:20:06 pm »

^^
I don't even consider soil types anymore. My first act is changelayer CLAY/SAN_TAN

Godlysockpuppet

  • Bay Watcher
  • [Insert wit here]
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #3 on: August 27, 2013, 02:30:59 pm »

^^
I don't even consider soil types anymore. My first act is changelayer CLAY/SAN_TAN
I'm the exact same. Peat is shit. (Except for masterwork mod peat, which can be useful as a source of fuel)
Logged

mek42

  • Bay Watcher
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #4 on: August 27, 2013, 03:17:29 pm »

Here I was all excited about learning the hidden secrets of drainage variance in conjunction with volcanism variance. 
Logged
"Is that the game with the blinky characters and no pictures?  Maybe you do have Asperger's." - My wife after I mentioned my excitement over the elves bringing by caravan a whole bunch of wood after my deforestation project was neglected due to a near-tantrum spiral and total loss of my initial seven and a bunch of immigrants.

Godlysockpuppet

  • Bay Watcher
  • [Insert wit here]
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #5 on: August 27, 2013, 03:22:22 pm »

Here I was all excited about learning the hidden secrets of drainage variance in conjunction with volcanism variance.
When all you needed was really a memory hacking program. Novice mistake ;)
Logged

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #6 on: August 27, 2013, 04:39:13 pm »

This is in one way better than a memory hacking program, because you can do it without having to wait on DFHack updates.
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #7 on: August 27, 2013, 05:03:48 pm »

I think many of you are overlooking the utility of this approach, and what it reveals about the internals of DF.

For starters, it shows quite clearly that Toady does not sort the data read from the raws prior to using it, and that the algorithms used to generate features are dependent upon where in the array data is physically stored.

It Toady sorted the data prior to using it, this trick wouldn't work.

What does this mean?

It means that you can generate highly improbable worlds simply by reordering the raws to exploit this fact, and that this is a set and forget exploit. All worlds genned will have the new curious layer placements. This negates the need to run changelayer each and every time you embark. The layers you prefer will already be present.

It also suggests that you could swap the entries for say, copper and iron, and end up with better iron availability.
Much science could be had here, if the mechanic is conserved for all minerals. (Swap diamond with red spinnel, see what happens, etc.)

This is a very interesting bit of information indeed. Thanks DG.
Logged

Trollhammaren

  • Bay Watcher
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #8 on: August 27, 2013, 05:21:15 pm »

I think many of you are overlooking the utility of this approach, and what it reveals about the internals of DF.

For starters, it shows quite clearly that Toady does not sort the data read from the raws prior to using it, and that the algorithms used to generate features are dependent upon where in the array data is physically stored.

It Toady sorted the data prior to using it, this trick wouldn't work.

What does this mean?

It means that you can generate highly improbable worlds simply by reordering the raws to exploit this fact, and that this is a set and forget exploit. All worlds genned will have the new curious layer placements. This negates the need to run changelayer each and every time you embark. The layers you prefer will already be present.

It doesn't reveal that much and it doesn't reveal that. If it worked like that then there would have to be hardcoded rules for having more or fewer materials on how to use the extras and how to compensate for missing ones, and tags on layering would be just for show and superfluous. More like
1. Material # in file are read from raws into a vector (it's obviously not the material name, and it's not the position in the file since then it would break upon reordering)
2. The vector is saved in world.dat
3. Materials on map are stored as values of the vector such as material[3]
4. When starting dwarf mode, these materials are assigned in accordance with whatever the map generation algorithm is, and the tile material is saved similarly
5. The actual values for that material such as name and appearance are read from the raws according to the # and file when starting dwarf mode

If you then change what it says in the raws where material[3] points to, the embark will change.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #9 on: August 27, 2013, 05:34:07 pm »

I disagree. The impact of a simple mod being present at worldgen with the same seed data is well known.

Eg, look at the discrepencies found when using Lazy Newb Pack, or the Linux version, against windows vanilla raws.

It's more likely that the data is not sorted in the array, as that would explain the incongruities that simply adding a graphics pack can introduce between identical worldgen files.

It looks to me like toady makes some 'unwise' assumptions about the data in the array.

Try it yourself and see. Very different worlds come out of the same worldgen parameters data if the raws are reordered. If the data was sanitized by sorting prior to worldgen, this wouldn't happen, because the order in the array would always be conserved no matter what order the raw entries were in. (The sorting would always put them in the "proper" order.)




« Last Edit: August 27, 2013, 05:39:33 pm by wierd »
Logged

Trollhammaren

  • Bay Watcher
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #10 on: August 27, 2013, 05:42:12 pm »

I don't see how sorting matters at all or how this even tells you anything about that. Either the materials are initialized according to their tokens and pointed to by position afterwards as I suggested, or used according to their position in the raws as you suggested. In the latter case tokens are irrelevant, you will have soil layers where stone should be if you switch their places, and the game needs to have special hardcoded rules to have extra modded materials.

Whether you use material[1] or material[15] to point to the location of iron in the raws (sorting) is insignificant and can't be deduced.

And very different worlds always come out of worldgen even using the same raws as is known. However, if you get mountains made of peat by switching positions of soil and layer stone, I stand corrected.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #11 on: August 27, 2013, 05:53:17 pm »

Sorting by tokens for layer doesn't garantee order in the array, for defining vectors.

Eg, if we have 15 different kinds of sedimentary stone, and our sorter just looks for the [sedimentary_layer] tag, then just apppends the entry to the bottom of the list, then doesn't do some other post-sort on that data (say, alphabetical), the reordering the raws can have exactly the effect I mentioned, because the seed data will pick the same physical entries, but they will be populated differently. Since they are still sedimentary layers, the game won't bat an eye.

I propose a test:

Make a rejection free world parameter set. Gen the world. Swap red sand with white sand. Regenerate. Compare.


Booya.
Spoiler (click to show/hide)

Same worldgen data. Complete regen. Swapped red and white sand entries.

The array is NOT post sorted.
« Last Edit: August 27, 2013, 06:13:22 pm by wierd »
Logged

Trollhammaren

  • Bay Watcher
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #12 on: August 27, 2013, 06:03:54 pm »

If you have static pointers to particularly numbered sections in the raws (e.g. material[3] is 3rd material of inorganic_x and material[7] is 5th material of inorganic_y), it doesn't matter whether or how those pointers are sorted by the program to get this result since they'll point to the same thing anyway, provided the algorithm knows how to find the ones it's looking for.

That test will tell you nothing since those sand types can replace each other anyway if you just regen a world.

Gentlefish

  • Bay Watcher
  • [PREFSTRING: balloon-like qualities]
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #13 on: August 27, 2013, 06:19:11 pm »

Er, actually, if you "just regen a world", you'll get the same colored sand. They are different raw entries after all. So swapping them does actually make a difference.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: Tip for getting desired soil layers on embark (sand, clay etc)
« Reply #14 on: August 27, 2013, 06:27:23 pm »

*edit

Sorry, misunderstood what you wrote.  Yes, the order in the raws list matters, as the entry number that corresponds to the red sand entry will be switched with the white sand entry.

If the array was post sorted after being populated, there would be no difference, because the same entites are in the list, just differenly ordered. Entry X would always be value Y, because the sort algo would always put it there.

Eg, the list "abe, apple, aquel" will alphabetically sort to "abe, apple, aquel", regardless of the input order.

Alphabetical post sort with the same 3 members results in member #3 always being "aquel". The fact that the above test shows that switching the inputs results in a change, shows that the array is not post sorted. Just appended as read.

That is why red and white sand were switched, and stayed that way over worldgen.

Next, I will switch gabbro with obsidian. Obsidian is clearly "special", since it specifically lines magma tubes. If I get gabbro lined tubes instead of obsidian after swapping the entries, and regenerating, then I think I win.

I conjecture that toady's algorithms favor certain sections of the array for "common" minerals (copper, for instance), over uncommon ones (iron ore, both igneous intrusive members), and may even hard call member entries in certain cases (obsidian).

Hence the revised test above.  If I get gabbro lava tube walls, it's game over.

*edit again

Nope. Obsidian must be specially tracked. Swapping gabbro with obsidian and regenerating had no effect. Good for toady!

I will switch gabbro with some other igneous intrusive stone.

Success.  Swaping Granite for Gabbro successfully swapped the layers over worldgen.

« Last Edit: August 27, 2013, 06:54:32 pm by wierd »
Logged
Pages: [1] 2 3