Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 8 9 [10] 11

Author Topic: Stress & Psyche 47.05  (Read 27035 times)

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: Stress & Psyche 47.05
« Reply #135 on: March 17, 2021, 01:37:42 pm »

For science, could you try running this against that single dwarf, and see if they recover? (just have them selected in the UI)

After praying just once, stress immediately dropped from 18k to 16k. Arguments are now only "annoying". Down to 14k after nothing special.
« Last Edit: March 17, 2021, 01:51:10 pm 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)?

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: Stress & Psyche 47.05
« Reply #136 on: March 17, 2021, 01:40:17 pm »

Ok, so with enough.. adjustment 8) it's likely the limits of some of those values and their effect on each other can be determined.
Good test, thanks Bumber.

Moeteru

  • Bay Watcher
    • View Profile
Re: Stress & Psyche 47.05
« Reply #137 on: March 18, 2021, 02:24:54 pm »

My angry dwarf is now "haggered and drawn" with over 25k stress. His only negative thoughts are anger at getting into arguments, anger dwelling on getting into arguments, and a few frustrated thoughts related to unmet needs (pray, practice martial art, excitement, fight, etc). I previously tried assigning him to a squad but that resulted in even more unsatisfied needs since he prioritised individual combat drills over everything else.
I might try locking him in his own burrow with a glass furnace to keep him occupied, but I doubt his stress will decrease until his angry memories of arguments get overwritten by happier memories. He has no shortage of strongly positive thoughts (euphoric, blissful, enraptured, etc.) yet he keeps dwelling on arguments. Without a way to inspect the underlying data structures I can't really tell exactly what is going on or how to fix it.

EDIT: I just decided to expel him. He started throwing tantrums and I decided that the effort required to provide him with adequate food/drink/clothes/etc while isolated just wouldn't be worth it.
« Last Edit: March 18, 2021, 02:57:23 pm by Moeteru »
Logged

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: Stress & Psyche 47.05
« Reply #138 on: March 18, 2021, 03:06:02 pm »

... Without a way to inspect the underlying data structures I can't really tell exactly what is going on or how to fix it.
While not all the structures, this will provide a data point regarding personality traits of a dwarf.
Spoiler: show-traits.lua (click to show/hide)
or if you prefer, as it's just three commands.. (after selecting a dwarf in the UI)

[DFHack]# lua
Type quit to exit interactive lua interpreter.
[lua]# unit=dfhack.gui.getSelectedUnit()
[lua]# printall(unit.status.current_soul.personality.traits)
LOVE_PROPENSITY          = 71
HATE_PROPENSITY          = 20
...

and then just copy & paste the results into the thread.

Moeteru

  • Bay Watcher
    • View Profile
Re: Stress & Psyche 47.05
« Reply #139 on: March 18, 2021, 04:03:52 pm »

I know how to view personality traits. I was more talking about the data structures involved in recurring memories. It would be very helpful if there was a way to print out all the events which a dwarf currently has stored in both their short-term and long-term memory, along with metadata such as the strength of the memory.
Logged

Nilsolm

  • Bay Watcher
    • View Profile
Re: Stress & Psyche 47.05
« Reply #140 on: March 18, 2021, 05:58:44 pm »

I know how to view personality traits. I was more talking about the data structures involved in recurring memories. It would be very helpful if there was a way to print out all the events which a dwarf currently has stored in both their short-term and long-term memory, along with metadata such as the strength of the memory.

Try this terribly made, but seemingly functional script:
Spoiler: list-memories.lua (click to show/hide)

It shows a lot of "ANYTHING due to None" emotions. I don't know what those are about, but the rest seems to be accurate.
Logged

Moeteru

  • Bay Watcher
    • View Profile
Re: Stress & Psyche 47.05
« Reply #141 on: March 18, 2021, 09:56:46 pm »

Thanks for that. That's a really useful script.
Sadly it doesn't seem to show the strength properly, but it's certainly a good starting point for further experimentation.

For now, here's the output for my stressed dwarf. (I loaded a backup save from just before I kicked him out.)
Spoiler (click to show/hide)
And for comparison here are his thoughts as displayed in DF:
Spoiler (click to show/hide)
Logged

feelotraveller

  • Bay Watcher
  • (y-sqrt{|x|})^2+x^2=1
    • View Profile
Re: Stress & Psyche 47.05
« Reply #142 on: March 19, 2021, 01:52:18 am »

His only negative thoughts are anger at getting into arguments, anger dwelling on getting into arguments, and a few frustrated thoughts related to unmet needs (pray, practice martial art, excitement, fight, etc). I previously tried assigning him to a squad but that resulted in even more unsatisfied needs since he prioritised individual combat drills over everything else.

Sending that squad out to kill something, maybe poor defenseless animals, would satisfy many of his frustrated needs.  Not sure that will make a difference here but a tip for the future.  :)
Logged

Moeteru

  • Bay Watcher
    • View Profile
Re: Stress & Psyche 47.05
« Reply #143 on: March 19, 2021, 09:38:45 pm »

Research is still ongoing, but I thought I'd share a useful lua script I wrote for dfhack based on the one by Nilsolm.

Spoiler: "list-memories.lua" (click to show/hide)

This should display all the memories of a dwarf, even ones which aren't present in their thoughts page. It also lists a non-zero strength value for every memory, although I'm still not 100% sure how those are calculated or how they relate to stress.
If the colours look weird in your terminal, try changing the color_A and color_B values.

Interestingly a lot of my dwarves seem to have very few long term memories and many even have empty slots in their short term memory. It explains why my strategy of trying to fill up their long term memories with positive thoughts wasn't working. Memories get removed from long term memory much faster than I had previously believed.

It shows a lot of "ANYTHING due to None" emotions. I don't know what those are about, but the rest seems to be accurate.
Those seem to be leftover data from memory slots which have been cleared. The game overwrites the emo.type and emo.thought fields with -1, but leaves all the other data in place.
I added a check to my script to filter them out since they don't provide much useful information and can be confusing.

EDIT: Added an -all option to the script which will display the contents of the cleared/uninitialised memory slots.
« Last Edit: March 20, 2021, 09:41:47 am by Moeteru »
Logged

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: Stress & Psyche 47.05
« Reply #144 on: March 20, 2021, 10:19:36 pm »

Ran "list-memories -all" on a few of my dwarves:
Spoiler: Most stressed dwarf (click to show/hide)
Spoiler: Second most stressed (click to show/hide)
Spoiler: Recovered necro dwarf (click to show/hide)

The script doesn't work on intelligent undead, though they must store their thoughts somewhere (not necessarily memories.)
« Last Edit: March 20, 2021, 10:21:24 pm 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)?

Zemalf

  • Bay Watcher
  • Be excellent to each other
    • View Profile
    • Zemalf's Let's Play Videos and DF Tutorials
Re: Stress & Psyche 47.05
« Reply #145 on: April 20, 2021, 03:14:53 am »

Some observations from 47.05:
* Two dwarves went from Fine to Very Unhappy/Tantrum after promoted as captain of the guard due the stress from lack of chains/cages (4 justice chains in 80-100 dwarf fort)
* Another one of them went from 30k+ stress to -5k after tantrum, being taken off from the captain of the guard position and served about 30 days in prison - Seems high stress peaks are possible and recovery too, if the dwarf doesn't dwell on the bad thoughts.
* Two "doesn't handle stress well" spiraled into continuous tantrums and depression. Other from trauma from an attack and reliving that attack by the dead, and the other from compounding of trauma from rain and multiple gods to pray
* Two nearly fortress ending spirals: One from tantrum throwing dwarf dying after picking too many fist fights with the elite soldiers and another from a tavern brawl started by a goblin poet where everyone started killing everyone (animals and kids included) for seemingly no reason.
« Last Edit: April 20, 2021, 06:49:13 am by Zemalf »
Logged

QuQuasar

  • Bay Watcher
    • View Profile
Re: Stress & Psyche 47.05
« Reply #146 on: April 29, 2021, 08:25:54 pm »

Research is still ongoing, but I thought I'd share a useful lua script I wrote for dfhack based on the one by Nilsolm.

Hey Moeteru, would it also be possible to output the total stress with that script?

It would be interesting to have a system where we run the script on repeat, every in-game day perhaps, so we can detect when a new thought occurs and correlate it to the stress bump or drop it causes. You'd still have to filter out the effect of facets and beliefs, but if we knew how much each individual thought had affected the stress total, we'd have a much more complete view of stress as a whole.

(Edit) Okay, this is untested, but I think it should work...

Code: [Select]
-- Prints out the stress level of the selected dwarf.

local help = [====[

Prints the current in-game date and the stress level of the selected
unit in dwarf fortress.

The date format is "YYY-MM-DD HH:TT", where TT runs from 0 to 50.
There are 50 ticks per hour.

Options:

    -help   show this help screen

]====]
utils = require('utils')
local validArgs = utils.invert({'help'})
local args = utils.processArgs({...}, validArgs)
if args.help then
    print(help)
    return
end

function get_date_string()
    local year = df.global.cur_year
    local tick = df.global.cur_year_tick
    if year == -1 then return "None" end
    if tick == -1 then
        return string.format("Before year %d", year)
    end
    local month = math.floor(tick / 33600) + 1
    local day = math.floor((tick % 33600) / 1200) + 1
    local hour = math.floor((tick % 1200) / 50)
    local minute = math.floor((tick % 50))
    return string.format("%d-%02d-%02d %02d:%02d", year, month, day, hour, minute)
end

sel = dfhack.gui.getSelectedUnit()
if not sel then qerror("No unit selected.") end
if not sel.status.current_soul.personality.stress_level then
    qerror("The selected unit doesn't have a stress level.")
end
stress_level = sel.status.current_soul.personality.stress_level
print(string.format("\n[%s]Stress Level: %s", get_date_string(), stress_level))

If we follow a dwarf around for a month with this script running on repeat, then run list-memories on that dwarf, I'm hoping we'll be able to see the effect of each thought on that dwarf as it happened.
« Last Edit: April 29, 2021, 09:14:34 pm by QuQuasar »
Logged

QuQuasar

  • Bay Watcher
    • View Profile
Re: Stress & Psyche 47.05
« Reply #147 on: April 30, 2021, 02:34:01 am »

Okay, so...

list-memories. This is from a brand new fort, so they only have short term memories here.
Spoiler: list-memories (click to show/hide)

Unfortunately, the dates on the thoughts are incorrect. This is most likely because they have been combined with previous thoughts of the same type that happened earlier, and the timestamp doesn't get updated when that happens. But there's also some thoughts that are missing: it's only now occuring to me that we're looking at short term memories when we should probably be looking at thoughts.

(Edit) This is accurate. Short term memories are not thoughts. You can display all the current thoughts by adding sel.status.current_soul.personality.emotions to list-memories, but the dates still don't match due to identical thoughts getting combined, so it's difficult to correlate the creation of thoughts with the stress impact they cause unless you actually see them happen.



As for display-stress... well, the good news is, the idea is sound. A graph of stress data can be extracted by following around a dwarf.

Spoiler: display-stress (click to show/hide)

The bad news is, stress changes are applied over time rather than instantly, and a lot of them can happen in quick succession. It can be hard to spot exactly when a new effect is applied. For instance, *something* happened at [125-05-26 10:00] to make Dodok super happy, but I'm not certain what it was. I believe it was rapture, but he experienced that three days earlier by the time stamp and stress didn't change then.

Might need to keep experimenting. I think the idea is sound, it just needs to be implemented properly.
« Last Edit: April 30, 2021, 02:48:30 am by QuQuasar »
Logged

Moeteru

  • Bay Watcher
    • View Profile
Re: Stress & Psyche 47.05
« Reply #148 on: May 01, 2021, 08:44:37 am »

I tried to do something similar, albeit manually, and reached the same conclusion. Stress changes don't happen instantly when a thought first enters the dwarf's mind, but instead get applied slowly over the course of several hours or days.

My idea for tracking it in more detail was to record a log of not just the stress values, but also the changes to their list of thoughts. The main events to record would be when a thought first appears and when it changes from "active" (present tense in the description, has values for strength and unk2) to "stale" (past tense in description, strength and unk2 are both zero).
There may be a way to detect when a thought gets merged because the date should change, but I'm not certain about that. There are also the variables "stress_boost" and "stress_drain" in the unit structure but I don't really know what they do.
I haven't written any code to do any of this yet though. I'll be sure to post here if I do.
Logged

Immortal-D

  • Bay Watcher
  • [Not_A_Tree]
    • View Profile
Re: Stress & Psyche 47.05
« Reply #149 on: May 04, 2021, 08:49:10 am »

My testing is less sophisticated (though I am loving the data), and so have drawn a simpler conclusion.  Over the long term, most Dwarves will eventually reach the state of "Doesn't care about anything".  The primary difference between this and the previous ending depression is that the former can still work.  I have not noticed any differences in speed or efficiency between normal Dorfs and the black-hole apathy ones.  In fact, I have observed the DCAA Dwarves enjoy partying and praying per usual.  It seems like the last patch was effectively a Xanax for the stress system.  This is admittedly an improvement due to said Dwarves still being able to contribute after the fact, but definitely feels like a temporary solution.
Pages: 1 ... 8 9 [10] 11