Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions  (Read 8194 times)

SalfordSal

  • Escaped Lunatic
    • View Profile

I promised a write up once I'd reached some concrete conclusions and here it is! This is probably as far as I'll get with my own play style as I'm finding that the results keep repeating. I'm interested to hear from others, particularly if you find things that affect core memory that I haven't listed here. I built on the amalgamated knowledge of many, I tested the assumptions on several fortresses on stream and was lucky enough to be able to clarify a few points with Toady during Q&A sessions.


How memories work

Dwarfs have thoughts based on their experiences, those thoughts provoke emotions of varying degrees of strength, creating memories. Each type of memory falls into a group. [note 1] Each dwarf has three memory storage systems: short term memory, long term memory and core memory. You can see what has recently been in a dwarf's memory by looking at their thoughts and preferences screen. If an experience is immediate "She felt satisfied at work." it has affected their short term memory, if an experience is recalled "She felt satisfied remembering work." it has affected their long term memory. Core memories are shown in detail, alongside the year of the event and a personality change that came as a result. "She can easily fall in love or develop positive sentiments, after gaining a sibling in 351."

Short term memories

A dwarf has 8 short term memory slots. When a dwarf has a thought a check is made to see if a memory of that group already exists in a short term memory slot. If the thought doesn't fall into an existing group the new thought will fill an empty slot, or if no slots are empty, overwrite the weakest memory (the one with the weakest emotion) in the 8 short term memory slots - even if the overwritten memory is stronger than the new one. If the thought already has one of its group in a memory slot the strongest memory of the two, the new thought and the existing memory, will be kept and the other discarded.

For example, a dwarf gets caught in the rain and is dejected (strength 1/4). If they haven't seen rain in the last year, this will be written to their memory, overwriting the weakest existing memory of a different group. If they have seen the rain in the last year, it will overwrite the previously weaker emotion of being annoyed by the rain (strength 1/8), or ignore the new experience if the old emotion was the stronger being dismayed by the rain (strength 1/2).

This mostly leads to a constant cycling of the weakest of the 8 memory slots as new thoughts overwrite each other. An overwritten thought is a forgotten thought. You can see this in the dwarf's thoughts and preferences screen, they'll mention more than 8 things that they have recently experienced, but they are only being affected by 8 of those things. The list is not a reflection of what is in their current memory, but is a reflection of what has been in their memory recently. The consequence of this cycling is that short term memories are mostly fleeting, with a maximum of 7 short term memories having a lasting effect on a dwarf's mood.

Long term memories

Once a memory has remained in a short term memory slot for one year [note 2] it will attempt to be promoted to a long term memory slot. There are 8 long term memory slots and the procedure works similar to short term memory allocations, with one important difference.

When the attempt to promote is made, a check is first made to see if there is an empty slot, if there is an empty slot the memory will be promoted to that slot even if a memory of that group already exists in another long term memory slot. It is possible (but very rare) to have more than one memory of the same group in long term memory. This cannot happen in short term memory. If there are no empty slots a check is made to see if an existing memory of the same group exists. The promotion will fail [note 3] if the existing long term memory is stronger, or will overwrite if the existing long term memory is weaker. If there are no empty slots and no existing memory of the same group, then the weakest of the other existing memories in long term will be overwritten.

When a short term memory is promoted (or possibly fails to promote [note 3 again]) to long term memory it leaves an empty slot in the dwarf's short term memory. Due to the cycling of the weakest short term memories, it tends to be the stronger emotions that cause memories to remain in short term memory for long enough to be promoted. The effect of the promotion on the dwarf's short term memory is that it 'purges' a slot, allowing for a relatively weaker emotion to stick around without being overwritten by the cycling.

Long term memories are important and can be particularly impactful on a dwarf's mood because: 1) if a dwarf is frequently experiencing the same thing, good or bad, the same emotion can easily exist in both short term and long term, effectively doubling its impact; 2) long term memories are often revisited long after an experience has ceased to occur; and 3) long term memories can become clogged with thoughts that can't be promoted further - more on that below.

I haven't been able to determine what causes a dwarf to think about something in their long term memory, whether it's random or predictable, but it seems to be frequent. Across a sample size of 300 dwarfs all of whom had been in one of several 'happy' fortresses for more than 2 years, the median number of revisited memories was 9, with 83% of dwarfs revisiting 8 or more long term memories. This suggests that all of their long term memories had been revisited at the point of sampling, with some cycling of long term memories having occurred within the recent months.

Core memories

When a dwarf thinks about a long term memory it has a 1:3 chance of being promoted to core memory and causing one or more personality changes, if the memory is of a group that can be promoted to core memory. There is no limit on the number of core memory slots and it is common to have several core memory slots populated by memories of the same group, for example, several experiences of seeing dead bodies in different years are common in core memory.

Core memories are less impactful than long term memories, as they are rarely, if ever, revisited. However, the change that is made to the personality of the dwarf is permanent and this can be for good or for bad.

The majority of long term memories that will be promoted to core memory are negative thoughts. The ones that I have found are: seeing a dead body, seeing somebody die, having a loved one die, being uncovered, experiencing trauma, experiencing miasma, rain, freakish weather or being made nauseous by the sun; and on the positive side: becoming a parent and gaining a sibling. I questioned Toady about this tendency to promote only certain long term memories to core memory and he confirmed that he thinks that there is an exclusion list, but couldn't recall what was on it at the time of the Q&A.

The effect of mostly negative memories being promoted to core means that the long term memory slots of a dwarf can become clogged with relatively positive emotions, if care is taken. Only the weakest long term memory will be cycled out by short term memories being promoted, meaning that it is possible to maintain dwarfs in an ecstatic state.

Long term memories that are written to the core memory are removed from long term memory, thereby leaving an empty slot.


How stress works

First to bust a myth: discipline is not an indicator of how well a dwarf copes with stressful situations, but there is a correlation that I will explain.

When a dwarf experiences an emotion, whether from an immediate experience or from revisiting a long term memory, a certain number of points, which I'll call "stress points" are added to that dwarf's "stress score". The dwarf keeps a running tally of their stress points, determining their mood. Unhappy thoughts add to the stress score, happy thoughts subtract from the stress score. Toady checked his code for me and confirmed that there are only two things that affect stress: the emotions that a dwarf experiences, each of which are shown on the thoughts and preferences screen, and a return towards a neutral point over time.

There are three key personality traits which determine a dwarf's propensity to experience stress: bravery, which determines how fast a dwarf accumulates stress; stress vulnerability, which determines how much stress a dwarf can experience before breaking [note 4]; and anxiety, which determines how fast a dwarf dissipates stress. A fourth trait, depression propensity, seems to be related to the difficulty of recovering an unhappy dwarf, but I'm working with a very small sample size of unrecoverable dwarfs, so I can't be certain.

There are some experiences which have a constant and predictable effect across all dwarfs and others that are much more variable. In assessing the impact of an experience on a dwarf's stress score, a key measure is whether or not the resulting emotion was promoted to a dwarf's long term memory, as these tend to be the stronger emotions and are those that are revisited.

The results below are taken from a sample of 300 dwarfs across 3 fortresses, where all dwarfs had been in their fortress for more than 2 years. The fortresses were designed to 'molly-coddle' the dwarfs, shielding them as much as possible from rain, death, corpses and miasma, and promoting happy thoughts as much as possible (after year 2, because it took 2 years and 5 migrant waves to reach that point with the infrastructure). The fortresses each had 150+ dwarfs and had been run for 7 years. The overall mood of the fortresses after 7 years was 45% happy to ecstatic, 55% fine, less than 1% unhappy (4 dwarfs in total).

Stress reducers

Bedrooms More than 99% of dwarfs had short term memories of feeling blissful sleeping in a bedroom like a personal palace, 89% were also experiencing long term memories of remembering feeling blissful about their bedroom. This was achieved by giving them a 3x3 engraved bedroom.

Dining room 88% of dwarfs had short term memories of feeling blissful eating in a legendary dining room, 70% were also experiencing long term memories of remembering feeling blissful about their dining room. This was achieved by digging out a 15 x 20 room and designating it as a dining room, it doesn't take much to impress them in this regard, but to force them to eat there you have to restrict placing unallocated tables anywhere else in the fortress.

Meaningful work 93% of dwarfs were satisfied at work, 62% had long term memories of being satisfied at work. Curiously a number of dwarfs had two memories of being satisfied at work. Satisfaction is a low strength emotion, so I suspect that this is the result of a long term memory being overwritten by a stronger short term memory of a different group, then cycling back in again because it was a frequent experience always ready to be promoted back from short term memory. From what I've seen, hauling is not a satisfying job, but any job which enables a skill increase can be satisfying work, so long as it doesn't conflict with a dwarf's personality (for example a butcher will get unhappy thoughts if they have a deep respect for nature).

Military training Military training is HUGE. After year 2 in each fortress, I put all dwarfs into squads (no armour, no weapons) and scheduled each squad for one or two months of military training in a year. 93% of dwarfs had happy long term memories of something relating to their military training, with 34% having more than one positive long term memory. Gratitude or pleasure from sparring was the most common, with interest in improving a military skill (wrestling, dodging, biting, kicking, etc.) and pride in teaching a military skill also widely present. Additionally several dwarfs were satisfied remembering improving discipline and/or observation. The effect of military training in clogging long term memory with happy thoughts correlating with an increase in discipline is why I think there is a common association between high discipline dwarfs suffering from low stress. No dwarfs had negative long term memories, despite some not liking warfare or not respecting military skills. I also happened across a fairly reliable method to turn around unhappy dwarfs using military training, which I'll discuss further below.

Other things All dwarfs had access to masterwork clothing, walked past an indoor waterfall frequently, were able to acquire an item, read books, and walked past fine furniture frequently, but less than 25% of dwarfs retained their thoughts about these things in long term memory. I was particularly surprised by the waterfall, I had expected it to have a much greater effect.

Stress increasers

The median number of unhappy long term memories across the sample of dwarfs was only 1, most of the things that they were unhappy about in the long term were things that would eventually be promoted to core memory, death, miasma, trauma, etc. Their other stress increasers were less than 1% of dwarfs: being annoyed or irritated remembering being accosted by vermin, 1 dwarf was uneasy remembering becoming a parent (lol), 1 dwarf was annoyed remembering drinking without a mug, which I suspect has been a lingering long term memory clogging their thoughts for several years, another was worried dwelling on not being able to help somebody and another was frustrated remembering the lack of traditions.

Mixed and/or variable effects on stress

Praying 77% had long term memories of wonder or enrapture from praying, 10% had negative long term memories from being unable to pray, some dwarfs had both positive and negative long term memories about praying. All dwarfs had multiple positive and negative short term thoughts about praying and not being able to pray. The balance of positive to negative long term memories shows the effect of dwarfs being unable to hold more than one thought of the same group in their short term memory. As long as they get to pray more than once a year they'll have a strong positive short term memory about a deity and won't have room in their short term memory to retain the negative thoughts from not being able to pray to the multiple gods that they wanted to.

Performances All dwarfs had multiple short term memories about watching a performance or performing, however a minority of thoughts were negative (about 5% were bored or embarrassed). Only a few dwarfs had long term memories related to performances/performing, all positive.

Arguments Short term memories about being upset getting into an argument were ubiquitous, and most dwarfs had multiple short term memories about arguing. However, only 3 dwarfs were angry remembering getting into an argument (although 1 dwarf was exhilarated remembering this).

Things that didn't matter

Some things were ubiquitous in dwarfs' short term memories, but didn't appear at all in long term memories, these are often the things that worry players seemingly more than the dwarfs themselves. These were: being away from family, being away from friends, being sad at being separated from a loved one, not having decent meals, being unable to craft an item, and being unable to wander.


Recovering unhappy dwarfs

From time to time I had dwarfs that would get stressed. In one fortress we had an accident with a 'malfunctioning' atom smasher, which rained rotten body parts and gore all over the farmers. I accidentally caused a dwarf in a strange mood to go berserk after the misapplication of a burrow command, several dwarfs and their pets died of old age - usually in the middle of high traffic corridors, and there were the usual unavoidable mishaps with visitors turning werebeast, trying to stage a coup, etc. Typically I'd have around 10% of dwarfs registering positive stress scores, with around 3% being unhappy that I would be actively trying to recover.

My first approach to trying to recover the stressed out dwarfs was to give them special attention and try to satisfy any unmet needs in an attempt to overwrite some low strength unhappy memories with happy memories. This had mixed results, was slow and took a lot of micromanagement. It would typically take about 2 years to turn around a mildly stressed dwarf.

I accidentally tripped across a far more reliable and quick method to turn around stressed out dwarfs, using military training. I made a special "Therapy" military squad which was assigned to train all year round, and the squad was set to active/training on the squad menu, however the squad was not assigned any barracks to train in. Any dwarf that was getting a bit down about things would be put into the Therapy Squad for a while. When a dwarf is scheduled to train, but has nowhere to train, they will actively seek to satisfy any needs. Rather than hang around with the "no job" label, they'll dash off to the tavern to socialise, the library to learn, the temple to pray or guildhall to increase their skills. It is far more effective, and easier to manage, than removing all of their tasks and hoping that they'll do something to cheer themselves up. It seems that they replace their duty to train with a duty to fulfil their needs!

After deploying this method and expanding it so that all dwarfs got one month a year in which they were scheduled to train, but had no barracks, positive stress scores dropped to around 5%, with only 1 dwarf ever reaching the point of being unhappy (and I had subjected that particular dwarf to quite a lot of cycling up and down the stress levels to see what happened).

Of the 4 dwarfs that became unhappy enough to be seemingly unrecoverable (3 from before the Therapy Squad method was discovered), all 4 dwarfs had a depression propensity state that was extremely low, meaning that they "were often sad and dejected". There were other dwarfs in the fortresses with extreme depression propensities that didn't become unhappy, so I'm not sure if this was a coincidence or whether it's just hard to turn around these dwarfs once they reach an unhappy state.


Combat hardness and immunity to corpses/stress

There is a very old piece of code which measures the 'combat hardness value' of a dwarf. This is a tricky one to track as it doesn't appear in dwarf therapist and is independent of any other value. I asked Toady about this and he said that when a dwarf sees guts and stuff, including seeing people die, it increases their combat hardness which will eventually lead them to become immune to seeing corpses. This code predates the current stress system and is still active. I have heard anecdotal reports of dwarfs becoming immune to seeing corpses due to constant combat, which is why I'd asked about it. I attempted to bring some dwarfs to the maximum state of "doesn't really care about anything anymore", but after 10 years of running a fortress with one squad dedicated to fighting goblins released from cages, I only reached the intermediate level of "is a hardened individual". I was fighting indoors, so it required frequent breaks to remove corpses to prevent miasma. I was attempting to discover which aspects of the stress system would be overridden by combat hardness, which things would a dwarf become immune to? Would it be everything? Do they not feel happiness or unhappiness about anything anymore? Can a dwarf still go berserk? Trying to test that concurrently with the rest of the experiment didn't sit well alongside the molly-coddle approach, so I didn't pursue it further, but I'd be interested in knowing the effect on all aspects of stress.


Conclusion

To keep stress down, keep the things that end up in core memory to a minimum, or at least restrict the variety of strong unhappy memory groups that dwarfs are exposed to in any particular year. In particular, seeing corpses, sentient things die, being exposed to miasma, rain and vomiting because of the sun. If you plan on fighting rather than turtling, plan to battle underground so that the dwarfs aren't exposed to sun and rain at the same time as death and corpses. If a dwarf sees a corpse, get them hauling all of the corpses, as they'll only remember the first one. If they're exposed to rain, get them to do all of the outdoor work quickly and keep the rest of the dwarfs dry. If you have to pick somebody to do unsavoury work, choose the dwarf(s) with the best mix of bravery, stress vulnerability and anxiety.

Clog a dwarf's long term memory slots with happy thoughts that can't be promoted. Give them a big room to dine in very early on, even if they only have one table and chair to eat on, it'll still count, but get them enough chairs and tables as soon as possible. Give them a wide variety of things to have happy thoughts about, as multiple low strength short term memories have a chance at cycling out low strength unhappy memories and prevent them from sticking. Put everybody in a military squad as soon as you can afford the labour, don't worry about weapons and armour, just get them training in any old dirt hole of a barracks for at least one month of the year (you might want to make sure that your mayor and trader are training over winter when there's no caravans or delegations). As soon as you can give everybody a 3x3 engraved bedroom, that's a sure fire mood enhancer. Make sure that you have at least one temple and that the dwarfs have a bit of down time to pray.

It didn't come out in my experiments, because I'd taken care of it, but make sure that your dwarfs don't end up wearing tattered clothes, that tends to upset them :)


Notes
[note 1]: It is uncertain how many groupings there are for memories, or how granular the groupings are, for example it is unknown whether admiring a fine weapon trap falls into the same group as admiring a fine door.

[note 2]: Although it was Toady himself who said that a short term memory has to exist for a year before being promoted to long term, I witnessed a memory being promoted after 6 months (a dwarf who gave birth to their first child and was blissful remembering giving birth to a daughter after 6 months).

[note 3]: I haven't been able to determine whether if a short term memory attempts to promote to long term and fails, it remains in short term or is discarded.

[note 4]: I'm not certain on the exact mechanic of stress accumulation versus stress vulnerability, my hypothesis is that dwarfs who have a high score on stress vulnerability (e.g. "can handle stress") trigger tantrums, etc. at higher levels, similar to how Rimworld handles breakpoints.


References
http://www.bay12forums.com/smf/index.php?topic=169696.msg8185557#msg8185557
http://www.bay12forums.com/smf/index.php?topic=170698.15
https://dwarffortresswiki.org/index.php/DF2014:Emotion
https://youtu.be/G-FRm78L3kc?t=2934
https://dwarffortresswiki.org/index.php/DF2014:Memories

Interim updates on the experiments, with some incorrect hypotheses disproved
https://www.reddit.com/r/dwarffortress/comments/ivjvyp/science_experiments_with_memories_stress_and/?utm_source=share&utm_medium=web2x&context=3
https://www.reddit.com/r/dwarffortress/comments/j2n053/science_experiments_with_memories_stress_and/?utm_source=share&utm_medium=web2x&context=3
https://www.reddit.com/r/dwarffortress/comments/j3mojs/science_experiments_with_memories_stress_and/?utm_source=share&utm_medium=web2x&context=3

EDIT: grammar
« Last Edit: November 25, 2020, 02:35:04 am by SalfordSal »
Logged

Nilsolm

  • Bay Watcher
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #1 on: November 24, 2020, 10:22:54 am »

This is some great info. Thanks for the work!

I was wondering about something related the other day. I noticed that in all my forts, miners are almost always disproportionately happy compared to most other dwarves. Engravers too, if they have a lot to do. I don't know the exact reason, but I have a hunch that miners might get a satisfied after finishing work thought every time they mine out a tile; or at least they do so often enough to reduce their stress to the minimum given enough time (and enough work). I remember having a having a highly stressed dwarf once with all that comes with it. Constant tantrum, depression and what not. I mostly gave up on him, but then I sort of absentmindedly assigned him to be a miner during some job reorganisation and when I checked back on him a few months later, he was completely fine and stress-free.

So I've been wanting to test if you could give someone a pick and send them to the mines as a way to quickly de-stress them. I haven't gotten around to it yet, unfortunately. It might be interesting to know if that really works.
Logged

SalfordSal

  • Escaped Lunatic
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #2 on: November 24, 2020, 10:56:35 am »

The things that come to mind about miners:

They are generally away from the surface, so away from sun and rain, two of the biggest stressers. They are away from the hustle and bustle, so usually away from corpses and miasma, trauma and out of the way if there's any strife in the fort. You set miners to a task and then check back on them later to see if they've done it, there's no workflow or manager constantly nagging them to do more, so they get more downtime to fill their heads with happy thoughts. Mining is a skill that is easy to raise, so they experience a happy thought on improving a skill more frequently. Miners can't wear military uniforms without a bit of finagling, so people generally leave them out of the military, meaning that they're less likely to see battle - no death, no corpses. It's a dream job for a dwarf really. :)
Logged

Salmeuk

  • Bay Watcher
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #3 on: November 24, 2020, 02:24:29 pm »

Quoting the most relevant bit ("the results") for those who are TL;DR:

Quote
Clog a dwarf's long term memory slots with happy thoughts that can't be promoted. Give them a big room to dine in very early on, even if they only have one table and chair to eat on, it'll still count, but get them enough chairs and tables as soon as possible. Give them a wide variety of things to have happy thoughts about, as multiple low strength short term memories have a chance at cycling out low strength unhappy memories and prevent them from sticking. Put everybody in a military squad as soon as you can afford the labour, don't worry about weapons and armour, just get them training in any old dirt hole of a barracks for at least one month of the year (you might want to make sure that your mayor and trader are training over winter when there's no caravans or delegations). As soon as you can give everybody a 3x3 engraved bedroom, that's a sure fire mood enhancer. Make sure that you have at least one temple and that the dwarfs have a bit of down time to pray.

Great research, SalfordSal! You also have a wonderfully succinct writeup here, well done. I think the notion that military dwarves are not only happier because they train and gain skill, but also because they take better care of themselves while they are on break, is something very interesting indeed. It seems like it was still an unidentified correlation, so I'm curious what exactly causes this change in behavior. Who knew the military was the best place to learn about self-care?

Quote
I was wondering about something related the other day. I noticed that in all my forts, miners are almost always disproportionately happy compared to most other dwarves. Engravers too, if they have a lot to do.

I can report I experience the same thing, though honestly I am not very efficient w/ my miners so they get plenty of downtime. My engravers, however, work non-stop, so I wonder what keeps them ticking.

In any case, well done, and I hope more people read through your findings, which confirm what everyone knew about this version anyways: yes, dwarven emotions are different now, but that doesn't mean they're broken!
Logged

Uthimienure

  • Bay Watcher
  • O frabjous day!!
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #4 on: November 24, 2020, 08:09:18 pm »

My typical forts also see the happy miners, but it's not always that way.

The current fort (15 years running, pop: 145) involves constant above-ground channeling work and construction work on a castle.
It is also a barren volcanic location that rains constantly.
The 15-20 miners also participate in hauling and construction.
They are also in "civilian" military squads (no uniform) and train 2 or 3 months/year in the rain.
I'm trying this as an experiment to keep cave adaptation low.
There have been miners that tantrum in that fort.

I'm only adding this to show that even mining (which I agree is probably the happiest dwarf vocation) can't overcome everything.

The 13 happiest (-5k or better stress) in that fort are:
  10 veteran military (8 with no cave adaptation, 2 with total cave adaptation)
  1  baron (who is also veteran military) (no cave adaptation)
  1  captain of the guard (also the mayor) (no cave adaptation)
  1  glass maker (no cave adaptation)
  1  hunter (partial cave adaptation)

Some get over the rain, sun, and seeing hundreds of bodies, some go crazy.

The 20 most unhappy (+5k or worse stress) are:
  5  miners with skill levels 2 to 10 (varying cave adaptation)
  5  ex-military (non-veterans who cracked) (no cave adaptation)
  10 civilians (varying cave adaptation)

I've sent about 5 dangerous loonies to the magma bridge over the 15 years, some military veterans, some civilians.
Had some go crazy and kill other dwarfs, but never a tantrum spiral, so maybe those are past history in 0.47.04 as I've heard tell.
Lots of dwarfs have had jail time in luxurious engraved cells containing food, drink, and a mini-temple... some thrive, some nosedive.

In the end, it pretty much seems tied to their personality traits and personality shifts/changes due to rain & sun & bodies.

(edit: Forgot to mention I'm using a below-ground "vacation" burrow for anyone +10k stress or worse: again, some some thrive, some nosedive.)
« Last Edit: November 24, 2020, 08:11:00 pm by Uthimienure »
Logged
FPS in Gravearmor (925+ dwarves) is 2-5 (v0.47.05 lives on).
"I've never really had issues with the old DF interface (I mean, I loved even 'umkh'!)" ... brewer bob
As we say in France: "ah, l'amour toujours l'amour"... François D.

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #5 on: November 25, 2020, 01:51:38 am »

Quote
If there are no empty slots a check is made to see if an existing memory of the same group exists, the promotion will fail [note 3] if the existing long term memory is stronger, or will overwrite if the existing long term memory is weaker.

I found this sentence really difficult to parse and had to read it a few times. That first comma should probably be a period.
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)?

SalfordSal

  • Escaped Lunatic
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #6 on: November 25, 2020, 02:31:40 am »

dwarven emotions are different now, but that doesn't mean they're broken!

Maybe not broken (although there are aspects that are not working, not being able to get happy thoughts from eating masterwork meals, not being able to be with non-existent family, for example), but a bit unbalanced and some things don't feel as though they're working quite the way that Toady intended. Something doesn't feel quite 'as intended' about the way that the long term memory gets clogged, with the weakest memories cycling in and out. The dwarf that I have who has been mulling over the time that he was annoyed drinking without a mug for example, that was probably 6 or 7 years earlier. It can't move to core memory, and unless I find 8 stronger emotions that also can't be promoted to core, it will bother him for the rest of his life. It also feels a bit exploity that now that I know how the mechanics work I'm able to clog dwarfs long term memories with relatively asinine happy thoughts to keep unhappy thoughts cycling through the weakest spot.

The trick with assigning a squad to training but not giving them a barracks, that feels like unintended behaviour. I'd imagine that either the dwarfs are supposed to behave that way without using the no barracks trick, or they're not supposed to behave that way when you take their barracks away.

Toady had some interesting thoughts about the possible role of friends proactively working to de-stress their unhappy friends. At the moment it requires a stressed dwarf to go and seek out experiences that will give them happy emotions, Toady's idea was that a friend may go and help a stressed dwarf to relieve their mood. I could imagine that going a little further with dwarfs that have specific traits able to purge some of the clogged long term memories - a sort of councillor role.
Logged

SalfordSal

  • Escaped Lunatic
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #7 on: November 25, 2020, 02:35:34 am »

Quote
If there are no empty slots a check is made to see if an existing memory of the same group exists, the promotion will fail [note 3] if the existing long term memory is stronger, or will overwrite if the existing long term memory is weaker.

I found this sentence really difficult to parse and had to read it a few times. That first comma should probably be a period.

Fixed, thanks :)
Logged

qualiyah

  • Bay Watcher
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #8 on: November 25, 2020, 04:03:22 pm »

That trick about an active squad with no barracks is great! I'm going to start using that.

The best strategy I've found for turning around a severely upset dwarf is to lock them in a room with a bed, table, chair, and stockpiles of food and drink, and a mug, but otherwise nothing to do except admire the *really, really* fancy furniture. But it can't just be masterwork furniture; you have to go the extra mile and ornately decorate it with lots of different materials too--that yields stronger happy thoughts. So long as the dwarf actually does like art (which depends on their personality, but most do), they'll just hang out feeling awe or wonder at the furniture, over and over and over again.

I used to just make them miners or put them in a no-fighting military squad, but this turns them around a lot faster and a lot more consistently. It also has the advantage of sequestering the dwarf away where they can't hurt anyone if they throw a tantrum.
Logged

T-362

  • Escaped Lunatic
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #9 on: November 27, 2020, 08:03:58 pm »

Quote
When a dwarf is scheduled to train, but has nowhere to train, they will actively seek to satisfy any needs.
Im curious, should it be "no assigned barracks" at all, or "no reachable assigned barracks"?

If it will work with not reachable barracks next step is to invent an automatic system to open barracks for half of the year. Idea is everyone is in the military, each dwarf is carrying a weapon and wearing a helmet (because "this is the way" and based on previous researches - enemies will only do headshots to unconsciousness dwarfs), next we have a year - 12 months, 2 months of training (separately), one month barracks are open allowing dwarfs to improve their skills and keep a good shape, and second month barracks are closed so dwarfs will have a vacation to fulfil their needs.
Logged

Clément

  • Bay Watcher
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #10 on: November 29, 2020, 09:53:38 am »

[note 4]: I'm not certain on the exact mechanic of stress accumulation versus stress vulnerability, my hypothesis is that dwarfs who have a high score on stress vulnerability (e.g. "can handle stress") trigger tantrums, etc. at higher levels, similar to how Rimworld handles breakpoints.

I did some reversing of emotions and memories at the time of 0.44.12, so my knowledge may be outdated, but here is what I know. Each time a dwarf "thinks", the strengths of the thoughts divided by the emotion type divider are accumulated separating positive and negative thoughts. Each sum is capped at 500. If a sum is non-zero, 50 times that value is subtracted to stress_drain/stress_boost values (but doesn't go below 0), otherwise 100 is added (capped at 806400).

After that, the negative thoughts (positive stress) score is modified according to the dwarf STRESS_VULNERABILITY. If above 90 the score is multiplied by 5, if above 75 it is multiplied by 3, if above 60 it is multiplied by 2, if below 40 it is divided by 2, if below 25 it is divided by 4, if below 10 it is set to 0. My notes don't tell me what is done with the score after that, I guess I did not finish this part. There may be some other tweaks before it is added/subtracted to the stress value.

If there was neither positive nor negative thoughts (with non-zero strength), the stress value goes back toward 0 at a speed depending on stress_drain/stress_boost (1 below 8400, 2 below 33600, 5 below 100800, 10 below 403200, 20 otherwise).

IIRC, other personality traits may be relevant when choosing the emotion type of a thought, so the same thought can have different emotion type for different dwarves, and thus a different impact on stress through the divider.
Logged

SalfordSal

  • Escaped Lunatic
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #11 on: November 30, 2020, 02:40:20 pm »

That is very interesting Clement, and aligns nicely with my results, so I suspect that it is still accurate in 0.47. Thank you for your additional knowledge :)
Logged

SalfordSal

  • Escaped Lunatic
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #12 on: November 30, 2020, 02:54:25 pm »


Im curious, should it be "no assigned barracks" at all, or "no reachable assigned barracks"?


I haven't tried it with an unreachable barracks, so I can't be sure, but that will be easy for me to test and report back on. My method was to use a barracks which is just a large empty room with a single bed in it. I use the bed to switch on/off actual training and self-care time. I like to have all of my dwarfs train over winter when there's less work to be done, so I was happy setting it manually. The squads were all scheduled to train for 2 of the 3 months of winter, with a third of the fortress available for civilian labour at any time. I included a number in the squad name to make it easy to manage and the schedule and barracks availability would look something like this:

Month 10: squads 1-10 scheduled to train, barracks available; squads 11-20 scheduled to train, no barracks available; squads 21-30 off duty
Month 11: squads 1-10 scheduled to train, no barracks available; squads 11-20 off duty; squads 21-30 scheduled to train, barracks available
Month 12: squads 1-10 off duty; squads 11-20 scheduled to train, barracks available; squads 21-30 scheduled to train, no barracks available

The rest of the year all squads would be off duty, with the exception of the Therapy Squad which was permanently set to train with no barracks available - I would cycle dwarfs in and out of that squad as required.
Logged

palenerd

  • Bay Watcher
  • Has every disease
    • View Profile
Re: !!SCIENCE!! Experiments with memories, stress and happiness: conclusions
« Reply #13 on: December 15, 2020, 03:19:54 pm »

As far as combat hardness, it's easy to get "doesn't really care about anything anymore" in a reanimating biome. Honestly I thought that message indicated a bad reaction to trauma because I usually noticed it on my more stressed dwarves. Dwarves with max combat hardness can definitely still go berserk, and still have emotions. I never got the feeling they were immune to anything, so I can't help on that front.
Logged
Here is a drunken rendition of Sodium Chloride, it menaces with electrons. This relates to the drunkness of palenerd in Early Spring of 2023.