Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Effectiveness of syndrome application via inhalation and properties of gas  (Read 1386 times)

Nakéen

  • Bay Watcher
    • View Profile

Hi fellow modders ! I would like to share some science I did today concerning inhaled syndromes.
The following post will demonstrate why syndrome application via boiling stones is unreliable, and uncover some interesting properties of gaseous substances.

It began with a quest to try creating a reliable way to apply inhaled syndromes.

Like many others, I begun by modding a reaction producing 100 boulder of a material boiling at room temp. I quickly realized that no matter the number of boulders, there wasn't a significant change : this is because multiple instances of the same gaseous material will count as one.

To work around this, I tried to increase the frequency of application by creating various clones of the same material. Using material_templates and a dummy creature, I created 100 clones of the material.

While testing this, the syndrome application frequency jumped significantly.
But I soon realized that the frequency stopped increasing beyond a certain point, freezing at something like ~20%. I tried to analyze the phenomenon step by step.

At each tick, I would use a reaction to produce a clone of the gas. Then the next tick, another clone, and so on. I then noted the results.

This is when I discovered some properties about gas and how they interact with creatures :

-When a creature is subject to a gaseous substance, it will "interact" with it on the first tick. When a breathing creature "interacts" with the gas, two results are possible : inhaling or not inhaling, both of which are respectively attached to the messages "caught in a cloud of" and "caught in a burst of".

-Then a second and only one other "interaction" will be possible. The second "interaction" HAS to occur before the "first interaction" can be re-applied. This is what render multiples instances of a gas useless.
You can also see the gas application as a syndrome that begin with the first interaction and end at the second interaction.

-Then I discovered that there is a minimal duration of 10 ticks before the second "interaction" can occur. Then there is another 10 ticks interval during which the second interaction can randomly occur.

Basically it gives that :

 I X X X X X X X X X X O O O O O O O O O O

I = First Interaction
X = No Interaction possible
O = Second Interaction possible

Now some properties about breathing :

-I discovered there is something we could call a "breathing tick". Which is the tick during which a breathing creature will inhale.
The very existence of the breathing tick is the reason why syndrome application via gaseous substances is so unreliable, and also why increasing the number of clones rendered my attempts useless : it only increased the probability that the dwarf will interact with the gas during the 10-tick "second interaction interval".

-What's worse is that the "breathing tick" is random. I didn't have enough courage to fully test this, but I got an interval of 30 ticks followed by one of 9 followed by another of <40.

Which overall means :
-gas inhalation is random
-inhaling is random
-syndrome application via inhalation is random and unreliable, and there is no reliable workaround.
Logged

Bearskie

  • Bay Watcher
  • Nyam nyam
    • View Profile
Re: Effectiveness of syndrome application via inhalation and properties of gas
« Reply #1 on: December 12, 2015, 02:46:28 am »

Heh heh. I like the last part.

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: Effectiveness of syndrome application via inhalation and properties of gas
« Reply #2 on: December 12, 2015, 11:49:38 am »

Yeah, this is really annoying.  Would be nice to have a reliable method of applying a syndrome through a reaction (outside of dfhack, I mean).

One thing I did when it was very important that the syndrome be applied (for instance, an expensive reaction that creates a powerful magic effect, like boosting the stats of the entire fort or damaging all enemies) was that, instead of creating the gas directly, you create several (10-20) items that are then used in a second, automatic reaction that produces a cloud of syndrome-gas for each one.  That way a single reaction attempts to apply the effect multiple times, increasing the chances of it working at least once.

Alternatively, you can produce an item that automatically disappears after a minute or so (by giving it a fixed temp slightly below it's colddam point) and use that item in an automatic reaction that does not consume the item.  Same basic principle, but this way you avoid the possibility of the player cheating by forbidding some of the items and saving them for later.

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Effectiveness of syndrome application via inhalation and properties of gas
« Reply #3 on: December 12, 2015, 01:01:03 pm »

This is one of the many reasons why modding without DFHack is basically crippling yourself.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

Urdothor

  • Bay Watcher
    • View Profile

Found this thread while looking into implementing an alchemy/magic system of some kind.

Now, I'm a novice modder at best, so forgive me if I've misunderstood something, or made incorrect assumptions about something, but I think I have an idea that might work. It's only a theory though.

It seems to me, based on reading this, that the issue with applying a syndrome through inhalation is that due to the breathing tick, the target creature can only inhale a small number of times, as the gas fades before they have another chance to breath it in. Even when generating a large number of boiling stones, the gas still fades away in relatively the same amount of time, correct? And IndigoFenix's work around gives multiple chances for the effect to work, but runs multiple reactions.

My theory, I believe, may work relatively well. If you could extend the amount of time there's gas in the air, it would give the creature more chances to breathe it in and be affected. Containers affect the temperature of their contents, raising or lowering them depending on it's own temperature. What if you had the reaction produce a number of stones and place them in a container with a fixed temperature just over their boiling point? Give each stone a different spec_heat value calibrated so that when the gas of one dissipates, another one boils(would require testing to get the time right). Or better yet, have multiple clones that boil simultaneously so theirs a greater chance of the inhalation happening. This way, the air is full of syndrome-gas for a longer amount of time using one reaction, giving a more reliable(not 100%, unless you do it for a very long time, but close) rate of effectiveness.

I could be misunderstanding absolutely everything, but I'm pretty sure that'll boost effectiveness if it works.
Edit: May not be the most elegant of solutions...
« Last Edit: January 18, 2016, 09:44:08 am by Urdothor »
Logged

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game

Hm.  That might work.  Not elegant from a raw standpoint, but a little more sensible in gameplay.  Can we produce containers in reactions and place other products into those containers within the same reaction?

Although, creatures only stay near the workshop for a short period, so it still might not work.

Urdothor

  • Bay Watcher
    • View Profile

Hm.  That might work.  Not elegant from a raw standpoint, but a little more sensible in gameplay.  Can we produce containers in reactions and place other products into those containers within the same reaction?

Although, creatures only stay near the workshop for a short period, so it still might not work.

You can give the material a reaction class, and have the container of that material be one of the reagents, and then have them place it in the container.

And a few solutions to the short period of time are to 1, make the building a bit of a maze, since the gas can pass an area that the creature can't(I believe Meph had that idea, if I remember correctly?), or 2, simply have the creature you want effected haul the gas spewing barrel to a stockpile(Maybe have the hauler be a caste/pet capable of hauling, with a special class so it's effected), or 3 have the creature you want effected tethered nearby somehow.
Logged

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile

This is spectacular to learn, as I had been having difficulty with gas-based infections for a Plump Helmet Man transformation plague... however, as I had already intended to give it varying percentages of affliction chance as the infection goes on, this just makes it a matter of accounting for the "percent chance to breathe".
Logged
DF Vanilla-Spice Revised: Better balance, more !!fun!!
http://www.bay12forums.com/smf/index.php?topic=173907.msg7968772#msg7968772

LeadfootSlim on Steam, LeadfootSlim#1851 on Discord. Hit me up!

Locustic

  • Escaped Lunatic
    • View Profile

Would it be possible to have a contact syndrome on a new item that counts as a sand and is created unbagged?
While messing with a custom workshop to create sand I found that attempting to Dump the unbagged item it made just dirtied the dwarf with a coating of sand that had to be cleaned off.
It ended up with a long line of dwarves using all my damn soap, but it might help something here.
Logged

Cheesoburgor

  • Bay Watcher
  • [NO_SLEEP]
    • View Profile

Huh, i always thought the unreliableness of inhaled syndromes had something to do with creature's disease resistance. guess its useless then?
Logged
Im alive again after a 4 year break!

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Effectiveness of syndrome application via inhalation and properties of gas
« Reply #10 on: January 19, 2016, 10:17:14 pm »

Huh, i always thought the unreliableness of inhaled syndromes had something to do with creature's disease resistance. guess its useless then?

That would only matter if the syndrome has RESISTABLE or whatever it's called

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: Effectiveness of syndrome application via inhalation and properties of gas
« Reply #11 on: January 20, 2016, 12:16:47 am »

Sweet jesus, I underestimated the numbers.

As mentioned above, I introduced a plump helmet man plague... after increasing the numbers and correcting the ability to contract it from eating plump helmets, I've had six people turn in the course of a season. Inhalants are perhaps only unreliable in the throes of battle, it seems.
Logged
DF Vanilla-Spice Revised: Better balance, more !!fun!!
http://www.bay12forums.com/smf/index.php?topic=173907.msg7968772#msg7968772

LeadfootSlim on Steam, LeadfootSlim#1851 on Discord. Hit me up!