A new way of managing effects

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Magnate
    Angband Devteam member
    • May 2007
    • 5110

    A new way of managing effects

    Several months ago, takkaria and I had a debate about how to improve the handling of effects. In case anyone is interested, the original exchange is here. The basic issues are:

    1. We don't currently distinguish between simple effects which do one thing (e.g. remove fear) and compound effects which do lots of things (e.g. cure 60 hp and remove poison, blindness, confusion and stunning).

    2. We don't have consistently parameterised effects, by which I mean that the code knows whether an effect requires aiming, but not whether it requires a target object, and that variable values are hard-coded - CLW, CSW and CCW are all *different* effects. This, incidentally, is why it's so hard to display the adjusted damage that an attack wand or rod would do.

    Thirdly, there's no way to edit effects without hacking the source and recompiling.

    So, we concluded that we need to split effects into two. Simple effects *have* to be in the code - because if you want to add or change one, you have to code that change. But compound effects are just multiple simple effects put together, and there's no reason these couldn't be in an edit file:

    N:Cure Light Wounds
    E: HEAL_HP:20:0
    E: DEC_POIS:0:2d6
    E: DEC_BLIND:0:-1 (where -1 means "all")

    N:Cure Serious Wounds
    E: HEAL_HP:40:0
    E: DEC_POIS:0:-1
    E: DEC_BLIND:0:-1
    E: DEC_CONF:0:-1

    etc. So, my plan is to define a full set of simple effects that can be called with a parameter "amount" (i.e. the hp to heal, temp boost to-hit, etc.) and a parameter "duration", and then create an edit file and a parser to deal with the compound effects. (There will be other aspects to encode as well, like whether the effect needs a target object or monster, and of course the flavour text.)

    I'll post the list of simple effects here before I commit anything, to check that it covers what people think might be needed. In the meantime, does anyone have any comments on this approach? Are there other things to take into account?
    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles
  • Djabanete
    Knight
    • Apr 2007
    • 576

    #2
    Seems like a good idea to me, although to be honest I don't know anything.

    Edit: off the top of my head:

    Heal
    Feed
    Restore Mana
    Decrease Poison
    Heal Cutting
    Heal Stunning
    Remove Fear
    Remove Blindness
    Remove Confusion
    Remove Hallucination
    Heroism Buff
    Blessing Buff
    Res Pois/Fire/Cold/Acid/Elec Buff
    Speed Buff

    Comment

    • Timo Pietilä
      Prophet
      • Apr 2007
      • 4096

      #3
      Originally posted by Djabanete
      Seems like a good idea to me, although to be honest I don't know anything.

      Edit: off the top of my head:

      Heal
      Feed
      Restore Mana
      Decrease Poison
      Heal Cutting
      Heal Stunning
      Remove Fear
      Remove Blindness
      Remove Confusion
      Remove Hallucination
      Heroism Buff
      Blessing Buff
      Res Pois/Fire/Cold/Acid/Elec Buff
      Speed Buff
      Berserker buff
      Protection from confusion (mushroom effect)
      Protection from evil.
      What about sprinting? I think that is something that can be stacked with haste?

      Also bad effects, cause cuts/stunning/confusion/blindness/hallucination/fear/hunger (vomit)/paralyzation/slowness/terror (fear that can't be removed, currently joined with sprinting I think).

      ...I think that is close to full list.

      Comment

      • Nick
        Vanilla maintainer
        • Apr 2007
        • 9647

        #4
        This is (probably) a complete list of effects on the player - I think Magnate was after all effects, so including fire bolt, earthquake, aggravate, summon, restore life, etc etc

        So for example *Destruction* is earthquake + mass banishment + remove items + blind.
        One for the Dark Lord on his dark throne
        In the Land of Mordor where the Shadows lie.

        Comment

        • Djabanete
          Knight
          • Apr 2007
          • 576

          #5
          It's more complicated than that, because Mass Banishment doesn't remove uniques while *Destruction* does, and Mass Banishment costs life while *Destruction* doesn't.

          Comment

          • Nick
            Vanilla maintainer
            • Apr 2007
            • 9647

            #6
            Originally posted by Djabanete
            It's more complicated than that, because Mass Banishment doesn't remove uniques while *Destruction* does, and Mass Banishment costs life while *Destruction* doesn't.
            Yes, that's what's known as a deliberate error to make a point.

            *cough*
            One for the Dark Lord on his dark throne
            In the Land of Mordor where the Shadows lie.

            Comment

            • Djabanete
              Knight
              • Apr 2007
              • 576

              #7
              Heh, well, the point was well-made in any case. I could imagine the "effects" library being quite extensive, allowing for some interesting possibilities. Traps, consumables, activations, and spells could become very easily modifiable, allowing both users and developers to make changes using only the edit files. New combinations could be tested by those who felt adventurous.

              And in Variant Land, having a comprehensive library of effects could allow characters to create spells and items from within the game.

              Comment

              • Magnate
                Angband Devteam member
                • May 2007
                • 5110

                #8
                Originally posted by Djabanete
                Heh, well, the point was well-made in any case. I could imagine the "effects" library being quite extensive, allowing for some interesting possibilities. Traps, consumables, activations, and spells could become very easily modifiable, allowing both users and developers to make changes using only the edit files. New combinations could be tested by those who felt adventurous.
                That's the idea. I've been through the code and done a spreadsheet, and I think I can create every single current effect of items, monsters and spells from a set of 21 base effects:

                Effects on grids (a grid is a square on the map):
                - detect a grid
                - modify the contents of a grid (create, destroy, or replace a feature e.g. wall with rubble)
                - change the light level of a grid
                - change the status of a door (locked, stuck, etc.)

                Effects on objects:
                - learn about an object (detection and ID)
                - create an object
                - destroy an object
                - modify an object (i.e. change its to-hit, to-dam, base ac, to-ac, dice, sides, weight, extent)
                - add, change or remove an object flag
                - imbue an object with the ability to inflict a status change on the next monster it hits (i.e. Monster Confusion)

                Effects on monsters:
                - learn about a monster (detection and probing)
                - create a monster (summon, clone, polymorph)
                - change a monster status (stun, fear, confuse)
                - change a monster quantity (hp, sleep depth, speed)
                - change a monster location (which includes banishment)

                Effects on @:
                - change a flag-based status or quantity (i.e. speed, resists, fear, etc.)
                - change a non-flag status (blind, paralyse, confuse, hallucination, amnesia, vomiting, poison)
                - change a non-flag quantity (hp, mana, cuts, stun, food, to-hit, to-dam, ac)
                - change a stat (including exp)
                - protect from a monster flag (i.e. Protection from Evil)
                - change location

                This list actually condenses down further, if we consider that several of them are duplicates with different targets: learning about something, or changing a flag, a non-flag status, a quantity or a location. It condenses further still if we ignore the arbitrary distinction of which statuses and quantities happen to be associated with flags and which don't. We then end up with five basic effects:

                - learn (or forget) about something
                - create, destroy or replace something
                - modify an attribute of something
                - move something
                - protect @ from something

                Now, each of these effects needs to know an amount, a range, and a duration, as well as things like what the flag is and whether there's an applicable resistance or saving throw. But what this tells me is that the whole business of flags needs rationalising before trying to rewrite the effects framework ...

                By the way, you're probably all wondering how all the bolts, balls, beams and breaths fit into this. Well they don't - they're projections, not effects. We must distinguish between the effects of a thing, and the mechanism that thing uses to deliver its effects. Above are the effects, which could be the result of projections, but need not be. For example, projecting an acid ball (whether from a wand or ring or spell) can modify the hp of monsters or the player if it hits them, as well as modifying the to-hit, to-dam or to-ac of objects it hits. Conversely, lots of effects don't require projections at all (e.g. earthquake, banishment).
                "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                Comment

                • Antoine
                  Ironband/Quickband Maintainer
                  • Nov 2007
                  • 1010

                  #9
                  I guess you'd want to make sure that (a) effects could still depend on stuff like Device skill, and (b) similar-sounding effects (like !CSW/_CSW/spell of CSW) could still have different consequences?

                  A.
                  Ironband - http://angband.oook.cz/ironband/

                  Comment

                  • Magnate
                    Angband Devteam member
                    • May 2007
                    • 5110

                    #10
                    Originally posted by Antoine
                    I guess you'd want to make sure that (a) effects could still depend on stuff like Device skill, and (b) similar-sounding effects (like !CSW/_CSW/spell of CSW) could still have different consequences?

                    A.
                    Funny you should say that. Takkaria has always been very keen on CLW being CLW, i.e. having exactly the same consequences whether it's from a spell, potion, staff or whatever. But yes, any modular/parseable effects system will let you define as many variations of CLW as you like.

                    Your other point is a good reminder - yes, we do want the variables in effects to be able to be adjusted by device skill (or whatever else) - I do need to bear in mind how to keep that simple.
                    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                    Comment

                    Working...
                    😀
                    😂
                    🥰
                    😘
                    🤢
                    😎
                    😞
                    😡
                    👍
                    👎