Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 191 192 [193] 194 195 ... 244

Author Topic: DFHack 50.14-r1.1  (Read 893227 times)

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2880 on: April 01, 2021, 09:44:25 am »

What exact version of IDA are you running? I've got 7.0.191002 and it runs that script just fine, though I'm not running it from within IDA's "idc" directory - I'm running it directly from where I cloned the df_misc repo, which is on a different drive and is right next to my DFHack and DF directories.

Also, what is the exact file size of the script, and what sort of line endings does it have? Mine is 27,133 bytes and has DOS line endings, but IDA still seems to handle it just fine even when it has UNIX line endings (and is 26,049 bytes long).

Didn't know I needed the whole df_misc repo. Looks like that fixed it.

Now how do I find my way into DF's game loop?
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2881 on: April 02, 2021, 11:42:15 am »

Spoiler: quotes (click to show/hide)

Note: Solved.

Was talking of regular software updates to whole system. I don't really keep track of system updates for, say, past month, though there's probably a way to find the log for them somewhere - but I'm unsure how I could tell something is meaningful. And yeah, I can imagine introducing a bug - ah what the heck, let me recompile with debug setting on, see what I find....

...Well never mind, I find PEBCAK for ➂ >///< - When I was narrowing down what was causing the crash, one of the first things I did was removing init files. These init files which included things like workshop transparency. Which I forgot isn't enabled by default and is required to keep track of workshop building tiles. Oops.

As for crash issue, seems it's been lurking in code since May 2020 going by testing. Pretty rare, but I do know what code I added back then -

Quote
"While your at it, make it not randomly crash :P" - Rose, back then.

- but a better solution was using the tip you provided some months ago to run with -g. Turns out, this time it told me exactly in which function the crash was in.

Anyway, 1/2 turned out to have been caused by rare plant_growth items (a cherry, a desert lime, a bayberry - harvested after falling, perhaps?) had anon_1/print_type set to -1 (which makes them take the withered leaf symbol). Since this was used as an array index that would ordinarily start from zero, well....it'd hit undefined behaviour whenever unit walked on a tile where freshest item was one of those.


Anyway, seems that was it. Ah, DF, will you ever stop providing new things to learn about you?

Buckley

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2882 on: April 06, 2021, 05:25:21 pm »

Back to playing DF after a few months.  Sometime in the last few releases of DF Hack someone took time to tweak the exportlegends behavior (I think) to dump files into a file instead of loose.  It also appears they added a message in the console when it's done. "Done exporting."

Thanks.  Little quality of life thing that made me very happy.  I'm often updating my legends file as a play and it's so much easier moving the files to where I keep them now.

 ;)
Logged

Moeteru

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2883 on: April 08, 2021, 12:25:44 pm »

My most recent fort has suffered from some very severe military equipment corruption (thankfully not the crash-causing kind) which has left half my military unable to dress themselves. The basic problem is that DF will assign the same item to multiple dwarves.

I've made some significant progress towards writing a dfhack script to fix the problem. The script searches through the global list of all items, builds up a list of candidate items sorted by quality, then matches them to the uniforms assigned to each squad position. After overwriting the item assignments in both position.assigned_items and position.uniform, the dwarves happily drop any incorrect items and pick up the new ones. 69 out of 70 military dwarves will now dress themselves properly without any fiddly micromanagement.

The one thing I couldn't figure out is how to deal with different sized armor for my single human squad member. How do I check if a particular piece of armor will fit a particular unit? Toady gives the numerical constraints in this FOTF reply, but I can't find where those size values are stored in the item_armorst (or similar) structures.
Logged

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2884 on: April 08, 2021, 01:24:03 pm »

The one thing I couldn't figure out is how to deal with different sized armor for my single human squad member. How do I check if a particular piece of armor will fit a particular unit? Toady gives the numerical constraints in this FOTF reply, but I can't find where those size values are stored in the item_armorst (or similar) structures.

The maker_race value of an item marks it as being sized for a particular creature race. This size is numerically the adultsize of the race in question. In other words:

Code: [Select]
local size = df.creature_raw.find(item.maker_race).adultsize
(Confirmed this by spawning a dragon equipped with a helm in arena mode, taking control of a dwarf, and viewing the helm before and after changing the adultsize of dragons to that of dwarves; the helm lost its "large" descriptor after the change).
Logged
As mentioned in the previous turn, the most exciting field of battle this year will be in the Arstotzkan capitol, with plenty of close-quarter fighting and siege warfare.  Arstotzka, accordingly, spent their design phase developing a high-altitude tactical bomber. 

Moeteru

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2885 on: April 08, 2021, 08:18:22 pm »

Awesome, thanks a lot.
My code is still rather brittle and probably doesn't handle edge-cases properly, but it seems to work. For the first time in a very long time I have a fully equipped military even down to the correct flasks and backpacks.
Here it is in case anyone is curious. I wouldn't recommend running it without making a full save backup first. I really can't guarantee that it won't cause corruption. https://ghostbin.co/paste/qwph54
Also there are a bunch of TODO notes for functionality which I don't personally need. Things like quivers, the partial match setting, individual choice weapons, etc.
Logged

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2886 on: April 11, 2021, 12:56:56 am »

Do we know how to make an item fall? Writing a script to deal with floating webs.

Edit: Looks like it involves creating a projectile entry. Might be simpler just to erase them, although I think Rumrusher has a script for launching stuff.
Edit II: Looks like "dfhack.items.makeProjectile" does what I need.
« Last Edit: April 13, 2021, 10:02:42 am by Bumber »
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

vettlingr

  • Bay Watcher
  • Þjóðalfur
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2887 on: April 12, 2021, 02:06:54 pm »

I have been using 3dveins for a long time, it being my favourite plugin.
It has gotten so bad that I can't almost bother playing on a map without it. I love Geology, and DF is one of those games which has great potential in representing geology in an interesting way, that is why I wish to address some hickups with 3dveins, mostly regarding its stability.

Usually, several parameters dictate if 3dveins will be able to complete or not, if a faulty parameter is detected, the plugin terminates, such as with the code below.
Foward Vein Placement:
Spoiler (click to show/hide)
I am wondering what this does? is it that the vein extends or originates in tiles outside of the map?

If I for example add the tag in bold, 3dveins will terminate pre completion. Removing [SOIL] works, but then the layer will act as a rock in purposes for digging and will produce boulders.
Code: [Select]
[INORGANIC:CLAY]
[USE_MATERIAL_TEMPLATE:SOIL_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:clay][DISPLAY_COLOR:7:7:0][TILE:23]
[SOIL][b][ENVIRONMENT:SOIL:CLUSTER:100][/b]
[SOLID_DENSITY:1210] SCS = 20/60/20
[MATERIAL_REACTION_PRODUCT:FIRED_MAT:INORGANIC:CERAMIC_EARTHENWARE]
[DISPLAY_UNGLAZED]

3dveins will not run since Inorganic->Soil is not viable for veins(and clusters) according to this line. Is there a way to circumvent this. How about just removing the line, would that work?

Code: [Select]
if (!isStoneInorganic(key.first))
            {
                out.printerr(
                    "Invalid vein material: %s\n",
                    MaterialInfo(0, key.first).getToken().c_str()
                );

                return false;
            }

Lastly, when using a map with extreme mineral frequency, the "Parent vein not placed" usually terminates 3dveins.
I'm not familiar with the -> markers, but I believe that it says if QUEUE[j] has parent and the QUEUE[j] parent is not placed.
Code: [Select]
for (size_t j = 0; j < queue.size(); j++)
    {
        if (queue[j]->parent && !queue[j]->parent->placed)
        {
            out.printerr(
                "\nParent vein not placed for %s %s.\n",
                MaterialInfo(0,queue[j]->vein.first).getToken().c_str(),
                ENUM_KEY_STR(inclusion_type, queue[j]->vein.second).c_str()
            );

            return false;
        }
[...]
I would like to know what makes a parent vein not placed? I'm guessing it is somewhere in void "VeinExtent::place_tiles()"

myk

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2888 on: April 12, 2021, 04:14:44 pm »

I have no familiarity with the 3dveins plugin, but I looked through the code for a few minutes and I think I can answer some of your questions.

Parentage: some veins appear within other, larger veins. The parent of a vein is the vein that encompasses it. Veins that are just surrounded by basic layer material don't have a parent (that is, the parent field is set to -1).

Forward vein placement: parents have to be defined before they are referenced as some child vein's parent. if the veins are declared out of order in in vein_nested_in array, you get this error.

Soil not allowed as a vein material: I'm not sure if this should be circumvented. changelayer has a warning about not trying to make non-soil layer rock into soil. DF might not be able to handle it properly.

Parent vein not placed: There's a lot of logic here that I haven't fully traced out, but in absence of another error message that tells you something more specific, it appears that a vein can fail to be placed if the allowed global tile count for the vein's material has fallen to 0.
« Last Edit: April 12, 2021, 04:46:43 pm by myk »
Logged

vettlingr

  • Bay Watcher
  • Þjóðalfur
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2889 on: April 13, 2021, 01:21:28 pm »

I would like to modify 3dveins to be more reliable when redrawing 500+ veins. Usually it terminates after not being able to place "CLUSTER_ONE" in absent parent, even though these are least common in the raws, but terminations due to *Parent not being placed due to "x" "CLUSTER_SMALL"* is also common, though less so.

I could add some printing out variables to the code to see what is going on. I'm guessing it is trying to place the certain Mineral before its parent has been placed. Rather than the parent having run out of "bricks". A possible fix if this is the case is to sort the veins better. Either that or put the parentless mineral in the back of the queue and continue.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2890 on: April 13, 2021, 04:30:40 pm »

@vettlingr: Note that some minerals can occur within different environments, so if you want to make sure all the preconditions have been placed before you try to place those, you ought to go through all the possible parents, not only the first one. An alternative would be to generate each level from the outside inwards, i.e. placing e.g. a small cluster within a large cluster is made after the parent large cluster has been placed, while placing the same mineral within a vein would be done after that vein had been placed, and not really care whether the inclusions happen to be the same mineral or not.
I would expect e.g. blue diamonds to fail to find any potential hosts reasonably often, though, as they only occur in faint yellow small clusters (if I remember the type correctly), and if all the small clusters to generate happened to be of other types of small clusters (or the kimberlite veins the small clusters would have been potential candidates for didn't win a place in the race because all veins were of different minerals), there would be zero available places for them.

I haven't looked at 3dvein, though, so the above may be irrelevant.
Logged

vettlingr

  • Bay Watcher
  • Þjóðalfur
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2891 on: April 13, 2021, 04:40:59 pm »

Blue/green/black Diamonds are notorious in my testing for terminating 3dveins or any vein which is at least 3 parents deep. CLUSTER_ONE in CLUSTER_SMALL in VEIN in CLUSTER in LAYER.

Wether it is possible to sort it depends on if it is possible to extract it's 3rd in line parent and treat all subseries of parents as the minerals original parents for the purposes of sorting. If not, putting it in the back of the queue could solve it (?)

Best solution would be placing all clusters first, then veins, then small clusters, then single clusters.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2892 on: April 13, 2021, 05:01:18 pm »

Yeah, I think some sort of sorting improvements might help, based on what I'm reading here. Do you have a set of worldgen/embark parameters that tends to reproduce this? e.g. does it tend to happen more often on larger/smaller embarks, with more/fewer minerals at worldgen time, etc.?
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2893 on: April 14, 2021, 12:55:26 am »

My 2 cents: while i love 3dveins, i would love to have more variety of vein generations models. One of the top of my head and easy to implement: biased random walk. You could set a cluster center and random walk with some "gravity" towards center (or if you want a tighter cluster, some spring force).

As for the issues here: easiest way to 'fix' them would be to place everything you can and then report what you couldn't. Imho few lost diamonds are not that big of an issue.

vettlingr

  • Bay Watcher
  • Þjóðalfur
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2894 on: April 14, 2021, 04:41:29 am »

Yeah, I think some sort of sorting improvements might help, based on what I'm reading here. Do you have a set of worldgen/embark parameters that tends to reproduce this? e.g. does it tend to happen more often on larger/smaller embarks, with more/fewer minerals at worldgen time, etc.?
Usually the problems stated arise when playing on a world with Minerals:Everywhere. In vanilla DF, it is usually Anhydrite that is the main culprit, since it's a CLUSTER_ONE in Satinspar (CLUSTER_SMALL) in Gypsum (CLUSTER). If that doesn't terminate 3dveins, Forward vein in "" usually does.

With Minerals:everywhere, 3dveins will only work around 1/8 times it is run

Embark size does not seem to matter, since any embark that uses the same biome will have the same problem.
« Last Edit: April 14, 2021, 09:35:59 am by vettlingr »
Logged
Pages: 1 ... 191 192 [193] 194 195 ... 244