Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Material Reactions  (Read 11199 times)

Toady One

  • The Great
    • View Profile
    • http://www.bay12games.com
Material Reactions
« on: May 22, 2003, 04:10:00 pm »

I'm starting material reactions now.  Aside from a lot of cleanup, this is the last real barrier to a release.  I'm going to start with a simple reaction, the destruction of shadow by light.  This will proceed as follows:

1) Make a little shadow creature.
2) Implement reaction reagents.  This will cause the shadow to be consumed (always).
3) Implement reaction catalysts.  This will cause the shadow to be consumed only in the presence of light.
4) Implement reaction products.  This will make fire come off of the shadow as it is being consumed.  How theatrical...

This will allow any reaction of the form:
Reagents + Catalysts -> Products.  You make reactions in the reaction editor.

Then I'll program inhibitors.  This should allow gargoyle skin.  I probably won't do rate altering ingredients, even though they are in the editors.  I just want to get the basics done.  The reaction framework should open up a lot of avenues for spell-making, at least once some of the spell effects are fleshed out a little more.

Logged
The Toad, a Natural Resource:  Preserve yours today!

Toady One

  • The Great
    • View Profile
    • http://www.bay12games.com
Re: Material Reactions
« Reply #1 on: May 22, 2003, 11:31:00 pm »

I have a little shadow creature now.  It isn't really afraid though, since it knows that material reactions are impossible to program.
Logged
The Toad, a Natural Resource:  Preserve yours today!

Harlander

  • Bay Watcher
    • View Profile
Re: Material Reactions
« Reply #2 on: May 23, 2003, 03:52:00 pm »

I started thinking about the problem of creating material reactions. Then I realised I had absolutely no idea how stuff is implemented as it is, and so couldn't really say how to expand on what's already there, so I couldn't lend any ideas in anything more than the utterly abstract sense.
Logged

Toady One

  • The Great
    • View Profile
    • http://www.bay12games.com
Re: Material Reactions
« Reply #3 on: May 23, 2003, 05:24:00 pm »

Hmmm...  let me see if I can say what's there.  Here are the reaction structures:

A reaction has a name, a list of reactors, a rate, how long it makes products after the reagents are gone, a chance in 10000 of occuring (mostly just 100%) per unit of rate, and how it handles damage (for example, if you get reacted a little, are you burned or frozen?).

Reactors have three principle features:  type, role, and amount.

Type can be material, material class (e.g. all metals), pressure, rubbing, a field (e.g. evil), light, wind and temperature.  Right now, creature materials must be fed into a material class to be seen by a reaction, but that might be temporary.

Role can be any of the following:
Reagent - consumed by reaction
Product - made by reaction
Solvent - dissolves Solute role
Solute - dissolves in Solvent role
Catalyst - not consumed but must be present
Inhibitor - presence blocks reaction
Rate Increasor - presence speeds reaction
Rate Decreasor - presence slows reaction

Reaction rates can be on a scale from seconds to centuries.  In this manner, you could create a creature out a material that decays over a few centuries.  Not that that timescale is important yet...  maybe more germane now would be summoning an elemental creature that only lasts a few minutes because of rapid decay.

Anyway, those are the elements I'm working with.  Now I just need to get it to work.  What I'm thinking is that it will process all of the creatures every 10 frames, and make a list of all the reactions that can happen (analyzing inventory, air, temperature, light, the ground, etc.)  Then that new members in the list will be added to the reactions running.  Duplicates will be tossed, so that if two creatures are holding the same item, for instance, it won't decay twice as fast.  I don't know if or how fast it will work.  If it bogs down, there are some things I can do to speed it up.  For now it will be fine, since there's only the one shadow reaction.

Logged
The Toad, a Natural Resource:  Preserve yours today!

Toady One

  • The Great
    • View Profile
    • http://www.bay12games.com
Re: Material Reactions
« Reply #4 on: May 28, 2003, 11:17:00 pm »

Well, I got it to go through and check that the shadow creature should in fact be consumed in the light.  I also programmed inhibitors.  I'm not sure if I'm doing this now or not, but I still need to make the game use the inventory and ground in the reactions.  I also need to make the actions actually happen instead of just lining them up to occur (although this borrows heavily from temperature effects, so it won't be so bad).  Actually, this is good.  The game seems to be running smoothly without any kind of delay.

I guess I only need to make the poor little shadow creature light up now.  Then I will clean the release up until we are all old.  By that time, with our flowing gray hair, we will look like wizards and witches and be better able to enjoy the magic.  Yeah.

Logged
The Toad, a Natural Resource:  Preserve yours today!

Toady One

  • The Great
    • View Profile
    • http://www.bay12games.com
Re: Material Reactions
« Reply #5 on: May 29, 2003, 12:29:00 pm »

In order to prevent my geriatric prophecy from being realized, I'm going to do a prerelease sometime in June.  Then we can go through and set priorities for what absolutely needs to be finished for the magic release and move on to items.  That would mean the magic release will be finalized in June or July.  The items release won't take nearly as long, in part because of all the crap I've put in so far.  I expect the Quaint Thorpe release to take a long time (of course), but I'll try to prioritize better or break it up into a few pieces so as not to try everyone's patience (including mine).  During and after Quaint Thorpe, we can revisit the plan a la Denim Sk8r and figure out if any releases or goals within releases should be shifted around a little, keeping in mind that it will all be done eventually anyway...  eventually...
Logged
The Toad, a Natural Resource:  Preserve yours today!