Bay 12 Games Forum

Please login or register.

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

Author Topic: DFHack plugin embark-assistant  (Read 100537 times)

PatrikLundell

  • Bay Watcher
    • View Profile
DFHack plugin embark-assistant
« on: February 22, 2018, 04:16:39 am »

This plugin is included in DFHack but is actively invoked by the player and is used during pre embark to find desirable embark locations using an enhanced embark finder.

The plugin provide transparent overlays over the World, Region, and Local maps, an embark finder, an info/help screen, and a list of resources within the current embark rectangle under the Local map.

The plugin now takes "incursions" into account where deemed relevant, i.e. bits of biomes belonging to neighboring Mid Level Tiles that carve out a bit of area in a tile. This means that a single tile can have more than one biome on it, for instance.

The embark finder acts as a replacement for the vanilla finder and allows you to find embarks that match a combination of criteria:
- X/Y dimension of the embark
- Low/Medium/High savagery with values N/A, All, Present, Absent. Incursions are accounted for.
- Good/Neutral/Evil with values N/A, All, Present, Absent. Incursions are accounted for.
- Aquifer with values to handle all combinations of No/Light/Heavy aquifers.
- Min/Max River with values N/A, None, Brook, Stream, Minor, Medium, Major
- Waterfall with values N/A, Yes, No
- Flat with values N/A, Yes, No. Incursions are accounted for.
- Clay/Sand/Flux/Coal with values N/A, Present, Absent
- Min/Max Soil with values N/A, None, Very Shallow, Shallow, Deep, Very Deep
- Min Soil Everywhere with values All/Present
- Blood Rain, with values N/A, Yes, No. Incursions are accounted for.
- Syndrome Rain, with values N/A, Any Syndrome, Permanent Syndrome, Temporary Syndrome, Not Permanent Syndrome, No Syndrome. Incursions are accounted for.
- Reanimation with values N/A, Reanimation & Thralling, Reanimation or Thralling, Thralling, Reanimation, Not Thralling, None. Incursions are accounted for.
- Min/Max Adamantine Spire Count with values N/A, 0-9
- Min/Max Magma with values N/A, Third Cavern, Second Cavern, First Cavern, Volcano
- Min/Max Biome Count with values N/A, 1-9. Incursions are accounted for.
- Region Type 1/2/3 with value N/A plus all the Region types (e.g Jungle). Incursions are accounted for.
- Biome 1/2/3 with value N/A plus all the surface biomes. Incursions are accounted for.
- Min/Max Tree coverage with values N/A, Very Scarce, Scarce, Woodland, and Heavily Forested. Incursions are accounted for.
- Metal 1/2/3 with value N/A plus all the ore derived metals
- Economic 1/2/3 with value N/A plus all the economic stones
- Mineral 1/2/3 with value N/A plus all the minerals (which includes the economic ones)
- Min/Max necro neighbors, with values N/A and 0-16
- Min/Max civ neighbors, with values N/A and 0-number of civilized entities - 1 (your own entity isn't counted)
- Each potential civ neighbor, with values N/A, Absent, and Present.

Each criterion forms a requirement that has to be met by an embark. The terminology above is:
- N/A: This criterion is not used
- All: Every tile of the embark has to fulfill this criterion
- Present: The condition has to be met by at least one tile of the embark
- Absent: The feature mustn't be present in any tile of the embark
- Partial: The feature has to be present on the embark, but mustn't cover all tiles
- Not All: The feature mustn't cover all tiles, but may be completely absent

Soil is a bit convoluted. Min Soil Everywhere is a modifier of Min Soil. If Min Soil is N/A it has no effect, but if Min Soil has a value it specifies whether the Min Soil criterion has to be met by every tile in the embark, or if it's sufficient that it's met by at least one tile.

All criteria that exist in a Min and Max version obviously result in a complete failure to find any compatible embark if Max is less than Min, but a N/A value for one (or both) of them is OK, as that value does not add any additional restrictions.

The Savagery and Evilness criteria are designed to allow for selection of combined embarks, e.g. an embark that has some Good and some Evil on it.

One a selection profile has been set up, "find" starts a search, which takes some time (which is the reason it has to be a plugin rather than a script: it's slow enough when compiled). The results are overlays on the World and Region maps showing where matching embarks exist, plus an overlay on the Local map that shows the embarks within that region that fulfill the criteria (represented by the top left corner of the embark). A search can be canceled while underway, resulting in a partial search result, in case you don't want to wait for the complete one.

As a minor bonus functionality, the Local map overlay also shows any sites DF doesn't display that happen to be present on the Local map. Neighbors are also shown, mainly because it allows the listing of Kobolds, which are hidden by the vanilla display.

It can be noted that the resources indicated by Embark Assistant for embarks can differ from what DF displays for two reasons:
1. DF displays resources for the region displayed, not the combined resources of the embark, so switching regions (F1-F9) shows different subsets of the available resources.
2. DF does not take elevation based erosion into account, nor does it handle resource cutoff due to the location of the magma sea. This means that it can display the presence of clay or aquifers where none is present, as well as flux and deep metal(s) that are not present because they would have appeared deeper than the magma sea.

Note that the plugin uses 47 lines to display all search criteria, but the list is scrolled, so a shallower window can still be used.

Usage:
The plugin is actively invoked from the DFHack console window by typing "embark-assistant" (minus the quotes) when the pre embark world is displayed. It can be exited at any time using 'q' from the main view (in which case it can be restarted from the console), although you abort the finder and the info screens with ESC to get back to the normal level.
Embarking will also dismiss it, as will exiting the pre embark screen from the vanilla DF menu reached with ESC.
Note that the info/help is spread over several pages cycled over with TAB/shift-TAB.

The author intends to edit this post without explicit change marks to reflect changes in the functionality/improved descriptions.
« Last Edit: March 21, 2020, 02:52:30 am by PatrikLundell »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #1 on: February 22, 2018, 01:24:51 pm »

Looks great, I'll have to test it out this weekend.
Logged

xyzzy

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #2 on: February 23, 2018, 12:19:26 pm »

I tried this last night and it works great and is very useful.   Thanks!
Logged

jecowa

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #3 on: February 23, 2018, 12:43:59 pm »

Does it tell you what specific type(s) of metal is in the embark, or is that kept hidden to make it a surprise?

If I search for a partial aquifer, would that give me an embark rectangle with at least 1 aquifer square and at least 1 non-aquifer square? That sounds pretty cool.
Logged

xyzzy

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #4 on: February 23, 2018, 12:50:41 pm »

I only used it briefly, so there may be more options I haven't seen yet, but the specific types of metal ores seem hidden - i.e. you can search for iron and it highlights the map where it's found but it doesn't specify whether it's hematite, magnetite, or limonite.   

I'm very excited that it finds waterfalls - I've been wanting to do a waterfall embark but I have trouble finding them on the map on my own.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #5 on: February 23, 2018, 01:57:59 pm »

The current embark rectangle info shows a list of exactly the metals and economic stone (plus clay and sand) available in that rectangle (assuming it works as intended: I haven't found any bugs [that I haven't fixed], apart from the reanimating one (which is going to be corrected within the next few days, although being a plugin means it won't be available until the next DFHack release after the update has been accepted): the Biome Manipuator can be used to check if a match is correct or not), and the search allows you to search for specific metals, their ores, or a mixture, so there's no hiding. The embark info shows the metal, though, not the ore, as that's usually not of interest, and it just shows a generic clay indicator, so you'd need to search to narrow it down to fire clay.

And yes, Partial means 1 .. (All - 1) tiles (Present means at 1+ tiles), intended in particular for aquifers.
Logged

xaldin

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #6 on: February 23, 2018, 07:20:27 pm »

This is a really nice utility. I don't suppose there is a way to add volcanos/magma within a certain range of surface into it?  I miss being able to search on criteria with volcanos from the older versions of DF. Particularly I recall finding surface or near surface magma more frequently with that.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #7 on: February 24, 2018, 02:31:15 am »

One of the purposes of this thread is to pick up suggestions for improvements...

I haven't played DF before 0.40.X, so I have little idea of what they looked like. I don't know off hand how to locate volcanoes, but it ought to be doable. Magma pipes can probably be located, but I don't know how precise the info on depth is. A guess would be that the info is what the highest cavern reached is, rather than an actual depth in Z levels.
Logged

xaldin

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #8 on: February 24, 2018, 10:43:07 am »

One of the purposes of this thread is to pick up suggestions for improvements...

I haven't played DF before 0.40.X, so I have little idea of what they looked like. I don't know off hand how to locate volcanoes, but it ought to be doable. Magma pipes can probably be located, but I don't know how precise the info on depth is. A guess would be that the info is what the highest cavern reached is, rather than an actual depth in Z levels.

A true designated volcano I would think would be like finding streams or other map level objects since they show up on the world map themselves.
 
Non designated volcanoes and instead looking for high magma would be the hard one. Caverns and magma aren't always linked it appears. Some of that may be the weird world gen parameters I put in so needs validation from others. I can find magma below the 3rd cave system on some maps and above the first on others. Volcanoes can sometimes be way above the ground level and other times top out below it. Once in a blue moon it used to be possible to find one that opened at the surface level itself but that has gotten super special rare now if they even happen anymore. 

Obsidian surrounds the magma pipes; that may be a detection method if the magma itself is hard to detect. That may be easier to target than the liquids.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #9 on: February 24, 2018, 12:14:53 pm »

I believe I've found the missing pieces for locating volcanoes, magma tubes, and adamantine spires (as well as pit and connections between cavern levels, but those are probably not of interest).

You can't detect volcanoes or magma pipes by looking for the obsidian sheath, because the sheath is generated by the volcano/tube, and none of the in game map level features have actually been generated prior to embark.
Magma tubes are defined to reach cavern 1, 2, or 3, as I thought.

To get technical, the volcanoes etc. are stored in a structure called feature map, but that info only tells you which world tile they reside in (plus the level some things, such as magma pipes and adamantine spires reach), but not where within the world tile they are to be placed. The region_details structure, however, contains references to all features (in the feature_map) present for each mid level tile (plus caverns and the magma sea), so it's a matter of putting this info together. I haven't yet verified that it's actually correct, but the candy spires showed up in the correct pattern when mapping it out on paper, so it's a fair bet it works.
Logged

xaldin

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #10 on: February 24, 2018, 12:57:24 pm »

Awesome sounds like you have everything for the old volcano search function that used to exist.  Now for another idea: Is it possible to add nearby feature to the finder? Meaning say only show me sites that show goblins near, or sites that show a necromancer tower near?
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #11 on: February 24, 2018, 02:59:26 pm »

It's technically possible, but it would require quite a lot of additional code for it to be useful, which might slow things down further. This kind of info doesn't use any of the data currently used, so it would be some kind of final filter after everything else is done, and going though each site in the world for every world tile isn't that appealing. Add the need to check that there is a path (not on another continent or a mountain range in the way, and compute the path to ensure it's short enough), and probably that the site actually contains a reasonable number of warm/cold bodies to throw at you and it gets messy. It's probably something better done with the old Mk I Eyeball and Legends Mode info.
I go for the dark fortresses and ensure they the closest gobbo site to my embark, that no other of my civ's site are within their range (easy, as I play dead civs), and that there aren't other civ sites that are closer. Also, Legends info is needed to check the gobbos actually are in control and have reasonable numbers.
Logged

xaldin

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #12 on: February 24, 2018, 04:31:00 pm »

Ok fair enough on that. How about these ideas: 

Saving your search criteria for import that way I don't have to redo all the various criteria each time? 
Marking the tiles with auto created notes so that the results are effectively saved if you embark once? It'd keep one from having to redo the search or manually go mark all possible spots first before embarking.  Only one would be needed per 16x16 I think.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #13 on: February 24, 2018, 05:26:45 pm »

Import/export of the search profile might be possible (with the usual headache of juggling different versions).
Notes is probably not a good idea, because in the general case you need to know exactly where the embark locations were; being told that somewhere within this world tile is one or more locations that matches your previous criteria isn't that useful (in particular if you don't remember what those criteria were) and would cause a lot of clutter. Also, if you found the previous embark to be lacking, you may want to embark in a copy of the original world rather than retiring and re-embarking.
Logged

xaldin

  • Bay Watcher
    • View Profile
Re: DFHack plugin embark-assistant
« Reply #14 on: February 24, 2018, 07:06:59 pm »

Amusingly the scenario you outline is kind of what I do just with world copies. I build a copy with Scout on it that I embark, look around, abandon then do again until I find a spot I like then go and embark on the pristine world.

So yeah notes probably a bad idea, thought more about it myself and went 'oh that could go horribly wrong'. Still I kind of like the ability to import/save queries. Even if it is just 'remember last one done' would be excellent in my opinion.
Logged
Pages: [1] 2 3 ... 24