Bay 12 Games Forum

Please login or register.

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

Author Topic: Region Manipulator, a pre embark region manipulator  (Read 28432 times)

PatrikLundell

  • Bay Watcher
    • View Profile
Region Manipulator, a pre embark region manipulator
« on: May 15, 2017, 08:31:23 am »

This tool allows you to manipulate 3 region level features pre embark:
- Elevation (change region tile elevation)
- Biome (change region tile biome to any of the neighboring 9, including the local one)
- Change river course, elevation, and width. Elevation allows creation of aqueducts, gorges, and water falls.
- Change whether a river is a brook or a stream.
- Control the amount of water in the caverns. Only tested to a limited extent. This functionality also depends on other parameters
  having compatible values elsewhere, plus the RNG.
- Manipulation of Features (Adamantine Spires, Volcanoes, Magma Pools, Passages, and Pits). The set of manipulations is limited to what the author finds reasonable. Limited testing has shown that adding Passages and Pits can result in cave-ins and draining of cavern lakes.

Note: all of these manipulations, except the brook/river one, are temporary. They are lost when another region is brought into focus, and they are likewise lost when embarking again in the same region as a previous fortress. However, the manipulations in effect when a fortress is created get "frozen" onto the fortress. This presumably can cause issues for adventure mode.
Also, changing river courses is messy, and only vaguely understood by the author, but some spectacular things can be generated.
https://www.dropbox.com/s/lap5tapg8if9p62/regionmanipulator.lua?dl=0 Version 0.15 2020-02-15.
The script can also be found here:https://github.com/PatrikLundell/scripts/tree/own_scripts

The tool is a Lua script that's intended to be stored in <DF folder>\hack\scripts and then invoked from the DFHack console by typing "regionmanipulator" into the console.

Change log:
0.15: Updated for 0.47.01 changes. Should be backwards compatible.
0.14: Fixed bug in river editing.
0.13: Reworked the UI and added manipulation of Features.
0.12: Added printing of help screen to DFHack console.
0.11: Added display of river entry/exit directions.
0.10: Replaced control scheme with command keys instead of tabbing through edit fields. Added mask to help screen to mask DF UI.
0.9: Added cursor starting on embark rectangle and "see through" view of the native DF region underneath the UI.
0.8: Added control of cavern water. This functionality is tested to a very limited extent.
0.7: Added description of the Biome reference coding DF uses to the help screen.
0.6: Fixed edit fields being one character too small.
0.5: Added ability to change a brook to a stream and vice versa.
0.4: No functionality change, just a better widget implementation internally.
0.3: Changed the UI to resemble a form with fields.
0.2: Allowed elevations to be negative down to -999.
« Last Edit: February 15, 2020, 10:03:20 am by PatrikLundell »
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #1 on: May 19, 2017, 12:08:04 pm »

ptw. I downloaded it... because I wanted to play with it... lol aqueducts and gorges.... I like DEEP gorges... but I wanted to see what a natural aqueduct would look like... than mess it up.
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #2 on: May 19, 2017, 01:23:58 pm »

There aren't any natural aqueducts: you'll have to change the parameters to get those...
I would recommend messing around with the tool on a copy of your save first. Once you think you have something interesting, embark, look at it to seem how it didn't measure up to the expectations, delete the save (or just retire and try elsewhere) until you've gotten something you like. Then you bring in the save (keeping a copy so you can try when thing go south).

By the way: a really silly experiment:
I changed the center tile of a 3*3 embark to an elevation of 1. I ended up with a hole in the ground that went a bit down into the SMR (I'm not sure if the bottom was at the level of the bottom of the magma sea or one below that. There was even grass at the bottom...). All 3 caverns were exposed, with their floors forming bridges across the hole. The embark wagon was deposited at the floor of the first cavern...
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #3 on: May 19, 2017, 01:39:29 pm »

Yeah see crazy sites like that.... I'd like something insane line that... The question is, after playing around for a bit and saving, if you say return to the side in adventure mode, or re embark at the site... does all the changes of this script get reverted?
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #4 on: May 19, 2017, 02:29:39 pm »

When it comes to adventure mode I can only guess.
My understanding of how DF handles regions and the embark level is that the region is generated based on some seed that hasn't been mapped yet whenever the region is loaded, which happens when you bring the pre embark cursor to a region or when an adventurer enters any of the 8 neighboring regions (I believe DF keeps 9 regions loaded, with fewer on edges and corners). When a region is generated, it's based on the seed, so it turns out the same every time (which is why the tool's changes have no lasting effect on the region).
The detailed (fortress or adventure) level is generated from seeds that are part of the region data (which I think are in turn generated from a seed, as per the above), together with the region data in effect at the time of generation (which can be modified by the tool prior to embark) provided the detailed level hasn't already been generated and saved (i.e. already been embarked upon or, I assume somehow been modified by an adventurer). For a fortress, returning to that fortress in fortress mode should return to the saved state. Similarly, an adventurer ought to visit the fortress in the state is was saved. However, I suspect performing region manipulation can have odd effects on an adventurer, such as e.g. flattening the region to say 3 lower than the region tile elevation was at the embark originally may result in an adventurer coming up on sheer drop for 3 levels at the embark boundary.

Embarking again at a different site within the same region as a previous fortress that did manipulate the region before embark starts with the region in the original state, only the effects on the detailed levels are frozen into the previous embark. If, for instance, you rerouted rivers, that won't be visible, as the region map shows the region as generated, and doesn't carry anything back up from the detailed level (if, in a vanilla game, you strip mined the center tile of a 3*3 embark down to the magma sea, the region would still show the level a generated for the region, not the one modified by the player).

I'm not quite sure if the rambling above makes complete sense...
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #5 on: May 19, 2017, 02:39:29 pm »

Understandable enough that I'm going to play with it sometime today or tomorrow.  I'll post the results!
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #6 on: May 19, 2017, 02:56:02 pm »

Posting to watch, also downloading to try it out.  I miss the old style surface level pits that went down into the bottom of the map and this could crudely recreate something like that. 

And just to be a pedant, natural aqueducts and gorges did happen at one point. :D  It was a very short lived quickly fixed bug. Rivers could generate with vastly different elevations than the surrounding terrain causing something akin to aqueducts, thin strips of hollow elevated river.  I recall reports of supercanyons too, but I only saw the elevated rivers myself.  I assume this tool just recreates that behavior for the local tiles.
« Last Edit: May 19, 2017, 02:59:36 pm by Greiger »
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #7 on: May 21, 2017, 02:46:31 am »

I wasn't aware of aqueducts having existed: it might have been before my time.
I can think of one way to easily get canyons and aqueducts through a bug, and that is to have rivers take their elevation from the world map elevation, rather than the region tile elevation.
Logged

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #8 on: May 21, 2017, 03:06:31 am »

It may have been, I sadly don't recall the exact year or version it happened with.  The bugs all kinda run together after a few years :)

Anyway just throwing out a 'it works great' for ya here.   

Just for information for folks around, it does not really do sheer cliffs when messing with elevations without rivers involved. It makes big mountains or big pits show up, and they are ramped and somewhat gradual like you see with steep hillsides in the normal game.  Though unlike the normal game make a pit deep enough (about 10 or 20 below surface level in my experience) it will indeed puncture and expose cavern layers.  Which is neat.  Though be warned that you might get some low fps for a bit after map loading doing that if you ended up digging out an underground pool or something, as the water will need to flow for a bit all at once to resettle.  Just so y'all know exactly what to expect after modifying terrain with the tool.  Still immensely useful for making the perfect embark.

Rivers will indeed create sheer canyons and old style bugged aqueducts though, and that's also neat.  Excellent work sir!

I wasn't aware of aqueducts having existed: it might have been before my time.
I can think of one way to easily get canyons and aqueducts through a bug, and that is to have rivers take their elevation from the world map elevation, rather than the region tile elevation.
Memory is foggy but I think the old bug was indeed caused by rivers using the wrong elevation info when generating.  That was probably it.
« Last Edit: May 21, 2017, 03:14:53 am by Greiger »
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #9 on: May 21, 2017, 04:08:30 am »

Thanks, Greiger. Getting feedback is always good.

Your caution as to what to expect is useful advice.

The tool doesn't really add anything that wasn't there, but provides a UI on top of the data DFHack has exposed. Since waterfalls and cliffs are oft requested features in the cookbook threads, it made sense to make it easier to make those yourself rather than asking someone else and/or pray to the RNG gods. It should also be mentioned that I've been influenced by the Dwarf Fortress Geological Survey http://www.bay12forums.com/smf/index.php?topic=164090.0 thread, stealing Japa's ideas (it's OK if they haven't been touched for a couple of months? ;) ). Japa is perfectly allowed to take them back when there's some spare time on that end...
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #10 on: May 21, 2017, 11:44:02 am »

I played with this a minute.  I was interested in your decision to block it from dropping a region below 0,  0 is generally 5 to 10 above the magma sea...  Nother interesting thing is that if a region drops through a ramp zone.... those ramps disappear completely, causing cavern 1 to crash apart.... also water is not guaranteed to stay inside of rivers or cavern layers.... they could very easily start flowing out of the zone all over the lowered zone... FPS 1 real fast, while an underground sea dumps into pit 50zs below.  interestingly I tested on an ocean tile... dropped it to 0, loaded, and the entire tile was already full of water and it leached through cavern layers until they was full... really low FPS but that was okay.  anyways... I wish the ramp issue could be fixed.
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #11 on: May 21, 2017, 01:17:17 pm »

The reason for not allowing elevations below 1 is that I thought they wouldn't work in one way or another, so if that assumption is incorrect it should be changed.

Unfortunatley, I can do nothing about ramps, as their removal or whatever is the result of DF applying the whacky elevation parameter entered into the RNG based embark generation. Those ramps don't exist until DF should generate them (and either removes them or fails to produce them at all) at the time of embark, so the tool knows nothing about their future existence state (it would require reverse engineering DF the embark generation logic, complete with RNG seed usage, to predict if you'd get such a problem).

I guess combining a river with an extremely low embark tile elevation might cause DF to fail to generate aqueduct walls where cavern floors get in the way.

Cutting away the walls of cavern lakes will of course cause them to empty into the shaft generated. Again, the tool does nothing to the generation itself, but only changes a few starting parameters for DF's embark generation. Silly parameters can lead to silly results.

Edit: Changed to version 0.2 and allowed elevations down to -999.
« Last Edit: May 21, 2017, 02:22:57 pm by PatrikLundell »
Logged

krisslanza

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #12 on: May 23, 2017, 10:59:05 am »

I'm gonna give this a try, since if I'm reading it right, I could flatten out some volcano embarks... messing with surface magma is fun, but the insane elevation levels for them 99% of the time, makes settling on a volcano a pretty unlikely affair.

Since I like aboveground settlements. I need my flat level ground to build on!

Altaree

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #13 on: May 23, 2017, 03:17:07 pm »

Wow! You really like messing around with the region lua.  I have been adding comments like this when I save your files so that if I ever add them to a personal github repo you are given credit.
Code: [Select]
--http://www.bay12forums.com/smf/index.php?topic=164136.0
--PatrikLundell
Logged
Dan Pearson:
This is a game which calculates the volume of blood in every creature it generates so it knows how much alcohol it would have to consume to get drunk, an update which, remarkably, ended up covering people's fortresses in cat vomit.

krisslanza

  • Bay Watcher
    • View Profile
Re: Region Manipulator, a pre embark region manipulator
« Reply #14 on: May 25, 2017, 12:15:27 am »

This is probably a bad question to ask by this point but uh, how do I actually get this to run? I figure its using DFHack's console to run it, but I can't figure out how to add it to get DFHack to read it or anything....
Pages: [1] 2 3 ... 5