Dwarf Fortress > Utilities and 3rd Party Applications

Biome Manipulator, a world gen/pre embark biome region manipulation tool

(1/36) > >>

PatrikLundell:
This tool allows you to manipulate region biomes during world gen and pre embark:
- Change the Evilness of the biome (all world tiles included in the take on the entered value). Evil/Good plants and creatures no longer supported are removed from the population list. Evil weather is likewise removed if an evil region ceases to be evil.
- Add/remove plants and creatures on a per region basis. A toggle allows you to add things that doesn't belong (such as titans...) with largely unknown effects. Use at your own risk.
- Edit population counts for creatures.
- Flora/Fauna-diversity orders: set all regions to contain all plants and creatures respectively supported by each region. The toggle mentioned above does not affect these orders.
- The flora/fauna manipulations can be performed both on surface, cavern, and magma sea biome regions.
- Allows changing of cavern water, openness min/max, and passage density min/max parameters. Changing the water one
  can change the cavern biome type (Subterranean Chasm <-> Subterranean Water).
- Allows adding/removing/replacement of evil weather to regions regardless of actual region evilness, but no weather editing.
- Allows modifications of Geo Biomes, i.e. which minerals are present at different world tiles.
- Allows manipulation of world tile parameters, moving world tiles between regions, and creation of new regions.
- Allows manipulation of rivers, although their spaghetti course makes it a pain to do so.

The latest biomemanipulator.lua version can be downloaded from https://www.dropbox.com/s/bc7gxkmkk3mz1t6/biomemanipulator.lua?dl=0
It can also be found here:https://github.com/PatrikLundell/scripts/blob/own_scripts/biomemanipulator.lua (Note: it's a web page with the script on it, not the script itself, so don't try to save the page as a lua file).

To "install", copy the downloaded file into <DF>\hack\scripts and invoke it from the DFHack console with the command "biomemanipulator".

The author intends to update this first post without explicit change notes to reflect any changes in functionality. A change log should also be updated.

Change log:
0.44 2022-01-23: Dealt with unmapped creature_interaction_effect_type values.
0.43 2021-10-15: Fixed bug when veins occur in the first geo layer.
0.42 2021-08-15: Adapted to the identification of the plant_raw index field. Should be backwards compatible.
0.40 2020-03-04: Adapted to changed creature flag names. Should be backwards compatible.
0.39 2020-01-13: Fixed crashing when used with modded interactions.
0.38 2020-01-12: Updated to handle corrected field name when used during world gen.
0.37 2019-12-12: Fixed numerous bugs affecting biome generation.
0.36 2018-07-29: Fixed incorrect widget usage, causing text matching to fail.
0.35 2018-07-29: Fixed bug in the geo morph command that caused it to do nothing.
0.34 2018-01-15: Adapted to naming of the dead_percentage field.
0.33 2018-01-11: Corrected bug in evil weather reanimation detection causing reanimation to be reported where it isn't.
0.32 2017-12-27: Added new Geo Manipulation commands to assign all legal minerals to a layer, geo biome, or all geo biomes.
0.31 2017-12-25: Added beta and gamma DFHack version detection.
0.30 2017-12-22: Fixed geo biome panning.
0.29 2017-12-19: Fixed forwards compatibility bug in setting of whole region evilness.
0.28 2017-12-10: Modified new region creation to support 0.43.03. Fixed bug causing that to probably fail in 0.44.02.
0.27 2017-12-10: Added mostly untested support for 0.43.03, but river manipulation couldn't make it.
0.26 2017-12-09: Added printing help screens to the DFHack window to work around tile set illegibility.
0.25 2017-12-08: Adapted to DFHack changes in 0.44.02. It should be backwards compatible, though.
0.24 2017-11-25: Adapted to updated DFHack river structure. Remains compatible with the older DFHack version.
0.23 2017-11-24: Fixed region wide evilness changes and new region creation to set a region evilness field, allowing changes
                        during world gen to affect civ placement.
0.22 2017-11-18: Fixed display bug causing river sinks to be marked as disconnected erroneously. Also, DF doesn't seem to
                         recognize new rivers for unknown reasons, so avoid using that function.
0.21 2017-11-13: Added manipulation of rivers, added resizing of "maps", added fast movement keys.
0.20 2017-11-07: Added new page to allow manipulation of world tile parameters, shifting world tile region affiliation, and
                        creation of new regions from world tiles.
0.19 2017-09-24: Corrected geo manipulation "morph" logic that crashed on DF 64 bit Windows.
0.18 2017-09-10: Undone 0.17 as that was due do an incorrect understanding and updated the help text to describe the
                         current understanding of how the Cavern Water parameter works.
0.17 2017-09-08: Changed Cavern Water parameter to Cavern Muddiness due to better understanding of the parameter.
0.16 2017-09-03: Fixed display issue where "maps" are painted on top of the frame.
0.15 2017-07-30:
- No visible changes. It turned out I'd completely misunderstood the 'r' and 'b' parameters for "frames" in the API. Changed to use the 'w' and 'h' parameters instead, as well as correcting the internal "Grid" widget.
0.14 2017-07-25:
- Added Geo Biome manipulation.
- Restructured the help into several pages, as my rambling didn't fit on one...
0.13 2017-07-17:
- Fixed bug causing plant list not to be populated. It was caused by performance optimization that was done incorrectly.
- Shuffled the evil weather effects a bit to compress it while making it clearer (hopefully). No functionality change though.
- Implemented variant execution depending on whether the DFHack version is r2 or newer to use a newly identified field. More of an exercise than of any measurable benefit, though.
0.12 2017-07-16:
- Fixed biome profile calculation. The wrong parameter profile was passed in, so it's surprising that part seemed to work at all.
- Suppressed output of Evil Weather Probability when 100% (which seems to be always for generated weather).
0.11 2017-07-15:
- Expanded the evil weather info into an info dump (far from complete, though).
0.10 2017-07-10:
- Change region interaction identification from using string matching to using interaction source type = REGION. Only has an effect if you are creating your own region interaction raws.
0.9 2017-07-10:
- Fixed evil weather manipulation bug. I was able to assign the first one, but the second one didn't take. An incorrectly assigned variable caused the subsequent weather settings to be considered replacements (not sure why the first one worked at all...).
0.8 2017-07-06:
- Added addition/removal/replacement of evil weather for all regions. No weather editing is provided, as changes aren't saved. A
  crude indication of what the existing weather effects are is provided, however.
0.7 2017-07-05:
- Fixed design flaw casing it to fail to work with a reduced set of caverns. As I was in the middle of implementing some minor region interaction manipulation it's possible to bring up a partially implemented page on which you can do nothing (but nor break anything, I hope).
0.6 2017-06-30:
- Removed the minor hurdles to run the script during world gen. Only tested to a limited extent, though.
- Removed undocumented ability to pass a region parameter on startup. It will now start on region 0's first tile (0, 0) most probably) if started during world gen and at the current world tile if started pre embark (as before).
- Fixed an inevitable performance improvement bug causing animal/plant counts not to be updated on movement.
0.5 2017-06-29:
- Improved performance by not regenerating unchanged information all the time.
0.4 2017-06-29:
- Added cavern parameter editing.
0.3 2017-06-29:
- Replaced hotkeys for "map" display selection in favor of <TAB>/shift-<TAB> cycling
- Added an additional dimension by allowing manipulation of underground regions (the three caverns and the Magma Sea. HFS has been skipped intentionally [and is boring from this perspective anyway]).
0.2 2017-06-28:
- Added support for changing Evilness and Savagery of individual world tiles.
- Corrected initial panning bug, where the "map" didn't "center" on the selected world tile at startup.
0.1 2017-06-26: First version

PatrikLundell:
Additional comments, without cluttering the first post:
- I've tried changing a biome region from evil to good, adding good plants to it, and embarking. Good plants were found on the embark.
- In a version prior to the evil weather removal, I did embark in a good, formerly evil, region and encountered a rain of blood, showing that evil interactions are not blocked from affecting a region only due to no longer being evil.
- I tried embarking in a good region after having removed all plants except a number of evil ones, underground ones, and apple trees (which were not legal for the biome). The resulting embark had only generic "grass" as vegetation, indicating that DF verifies that plants are actually legal for the location.
- Based on the above, I speculate that there might not be any technical reason for evilness to be tied to regions, i.e. that DFHacking two adjacent world tiles belonging to the same region to have low and high evilness values respectively could result in an embark that belonged to a single region but had evil and good plants on different halves of the embark.

Fleeting Frames:
Heh. Nice, this was what you foreshadowed, right?

"Based on the above, I speculate that there might not be any technical reason for evilness to be tied to regions, i.e. that DFHacking two adjacent world tiles belonging to the same region to have low and high evilness values respectively could result in an embark that belonged to a single region but had evil and good plants on different halves of the embark."

Hm, but not *looks at code* different interactions.

Flora-Fauna diversity, combined with legality check (does creature spawning check if creature is legal? I would guess yes) basically enables one to also change biome type for embark biome, or entire region to any possible biome. Somewhat superfluous, with tweakmap, but an idea for further changes.

Fauna in particular...Neat, you added vermin handling. Since mussels are ubiquitous, I guess that means infinite shell industry on any river.

Though I suppose there are couple of advantages to handling things at worldgen - animal people populations and ogres in goblin civs in particular*, this doesn't require preemptive handling - and I foresee generated region files being shared instead of parameters becoming more common, what's with 32 and 64-bit df generating different worlds.

* And, oh, wouldn't have guessed CASTE_MEGABEAST being the flag for megabeast - and on that note, strictly speaking wagons and werebeasts and such don't need to be excluded, due not having a biome they can match to. Though, didn't GENERATED flag exclude them anyway?

PS: Code-wise, new change on using generator instead of zeroing is neat mental load change as well, though not sure if that behaviour wouldn't result in memory creep with tens of thousands of sequential instances (in which case, replacing make with fetch that zeroes would work).

PatrikLundell:
Yes, it's what I hinted at. Nice to hear you find it interesting.

I've tried to make some sense out of the mess that is interactions, and they DO have flags to specify biomes and evil/good/savage, but apparently the evil/good check is performed only when hooking the interaction up to the biome. I don't know if it performs biome checking on the fly either, but assume it likewise is done on hookup, given that the legality flags match the biome types. The Savage check has to be done per world tile, though.
It's not that hard to add script to allow you to add interactions to regions (assuming DF doesn't go belly up when adding one to the region: you never know when that will happen), but it's not trivial to describe what they do beyond the most basic level (Animate/Material_emission for DF generated interactions, where the latter can be expanded into various weather types [Creeping gas/vapor/dust and falling material]), and if you try to cater for people modding interactions it becomes even trickier.

I assume creature spawning to check legality, because regions can span several biomes naturally (forest can contain both taiga and dry broadleaf, for instance), and that probably blocks gigantic squid from spawning at the border of your mountain embark (only to air drown, of course, if they would appear). I haven't tested that, though.
I've thought about changing biomes at the tile level, but that gets messy when you either have to assume DF handles regions containing inappropriate biomes correctly (and then somehow have to adjust the biome populations in a nice way), or shuffle world tiles between regions (and possibly come up with new ones).
I've experimented with moving a two tile lake from being E-W to being N-S while swapping the regions for the two tiles. The lake looked OK when embarking on it, but the former lake tile was marked as ocean, so it seemed the elevation didn't adjust properly.
In another experiment I just marked a world tile as being a lake, and while it looked OK pre embark, embarking on it resulted in starting in the cavern on a sand floor (possibly because the lake surface defaults to -30000).

Vermin handling wasn't hard, once the info to use had been located, but that's always an issue (and I've since seen the 10000001 numbers are the default, so the code to setting them can be removed so the defaults are just kept in that case).

I tried running it during world gen, and there was some data that didn't exist at that time, so it failed. Have you checked that adding ogres and animal people actually take effect during world gen? When I looked at it the goblin civ was empty of everything (such as trolls and beak dogs) up at the end of world gen (before acceptance), but adding ogres at that time to their biome didn't seem to work (although I may have botched it).
Sharing region files would require the ability to read and apply them, which is possible for a single region that's applied to the current region, but a mess if you tried to do that for the whole world and then applied it to the wrong world (and even for a single region it will be a mess if the regions are of different types). Unfortunately, quicksave doesn't work pre embark: if it did, it would have been possible to tweak the world and then share the save.

I didn't bother checking if wagons etc. would be excluded due to biomes, so I just added those checks. As for GENERATED, I don't know for sure what that matches, so again, I thought it safer to just add that flag as well (but I did check that it didn't result in giant animals and animal people getting excluded). It can be noted that I haven't checked DOES_NOT_EXIST though, but I haven't seen any Chimeras or other critters I think have that flag.

I don't understand what you refer to in the P.S section. If you mean generation of profiles I think Lua works like Java, i.e. a garbage collector kicks in at random times freezing all activity while garbage is collected. If so, it's usually not noticeable at the human level. I wouldn't create and discard data like that when using a real programming language (or high level assembly, a.k.a. C).

Fleeting Frames:
The interaction thought was mostly about having both undead and live animals on same embark, from same region.

For your lake experiment, I suspect if you embarked on the swapped lake tile that didn't become ocean you'd get no lake water, but would get lake creatures that won't airdrown*, provided they're added in with region-pops. However, if elevation adjustment fail resulted in an ocean it'd suggest the biome is determined again when you embark - however, this doesn't quite work with region manipulator being fine with elevations below 100. It's possible, of course, that the two use normally not different, but separately stored elevation values.

*Assuming the new ocean tile had water. If it didn't, it's even stranger.

For world gen effects, I certainly have 10 new species of animals and 2 of animals people when using it a century before stopping, but haven't seen stoat men and one other (not sure which) join. However, given they're probably both from a single-tile biome the proposition of them joining is unlikely in the first place, when I see less than dozen animal people species in all sites total typically. And the ogres, well I switched my efforts to a gen that had them already present just because of that, but checking on an old one it doesn't seem they're found, at least on a gen where reanimation layout is different (with zombie ogres in legends at times.)

While both of these seem like indicators against it, the fact that megabeasts populations switch the world into age of myth nearly right away does suggest they're used at least in some manner - then again, there's around two magnitudes of difference between the two.

PS is as you said and pretty unimportant here, just a thought.

Navigation

[0] Message Index

[#] Next page

Go to full version