Ancient Domains Of Mystery (ADOM)

Prefix and suffix variety in JADE

February 18th, 2008 · 25 Comments

I spent the weekend in Berlin with some business akquaintances (thanks to Giordana, Ralf and Alfred for a wonderful saturday - I’m looking forward to the next meeting!). Basically that meant that I spent a fun time but also had about 7 hours of total train travel time to spend on JADE… which I did. Add in another 4-5 hours since yesterday even and JADE has progressed once more quite a bit.

 This time I worked on prefixes and suffixes for item (e.g. “nasty broadsword” as a variant of a broadsword that causes more damage or “unholy battle axe” for a battle axe that causes extra damage against good-aligned beings). While implementing those things I finally discovered (or rather finalized - it has been in JADE for some time) the awareness programming pattern I mentioned some time ago. And now I’m absolutely enthusiastic about the new JADE code structure: Basically JADE now has two major code features that simplify feature implementation enormously:

  1. JADE has a timeline. Each time-dependent “thing” (beings, floating logs, items, story events, recharging items, …) are placed on the time stream and get to act when “their point in time” has come. This is very nice to “program” the game for special events that should take place at some point.
  2. JADE now has event handlers and awareness for special events that can be added to all kinds of things. This can be best explained with a couple of examples: Being blessed e.g. adds a condition to the being that is blessed. Instead of inserting special code for the blessed condition in several places that “blessed condition object” simply accumulates a couple of awarenesses, e.g. it becomes aware of the point in time just before an attack roll is checked for whether it is a hit or not and it becomes damage aware. Whenever a to-hit roll has been executed, the blessed handler object can slightly increase the roll (when not fighting good-aligned beings), whenever damage is caused, the damage can be increased slightly. The result: All the code for being blessed in one place and a generic mechanism that works for almost everything. The nice bonus: Whenever some special event takes place (being hit, being damaged, being… whatever) the game checks the active (and if necessary the passive) being involved in the interaction for “aware things”. This means that every skill, item, talent, special effect, item effect, condition, etc. is tested for awareness - and if it is aware it gets to react. This might seem complicated and time-consuming but so far it seems that the code works exceedingly well… and there are quite a few means that could be used to speed up the code if necessary.

What does this mean for game play? Well, I already have added almost all the melee weapon prefixes from ADOM (quite a few have become more elaborate and there are some new ones, too). Additionally immunities and resistances are back in the game (and they also use the generic awareness mechanism), quite a bit of stuff has been added in several detail areas, etc. Next are the prefixes for armor and the suffixes for both armors and melee weapons. BTW, prefixes and suffixes have been extended to be available for quite a few more items like bracers, helmets, shields, etc. Again accompanied by a nice and efficient implementation feature that should reduce the time required to add more features from ADOM and extend them by quite a bit.

Here’s some more example code:

@MinimumLevel(3)
@Frequency(Rarity.RARE)
@Modifies({Weapon.class})
public class PrefixUnwieldy
    extends AbstractPrefix
{
    public PrefixUnwieldy()
    {
        super("unwieldy");
    }
    protected void whenAddedToImpl(EquippableItem item)
    {
        item.setMeleeHitModifier(item.getMeleeHitModifier() - 8);
    }
}

And here’s some really complicated stuff - relatively… you should see the efforts ADOM makes to implement the same thing:

@MinimumLevel(10)
@Frequency(Rarity.VERY_RARE)
@Modifies({Weapon.class})
public class PrefixCorrupting
    extends AbstractContinuousPrefix
    implements PassageOfTimeAware
{
    private long accumulatedTime;
    public PrefixCorrupting()
    {
        super("corrupting");
        accumulatedTime = 0;
    }

    public void passTime(long ticks)
    {
        if (getModifiedItem().getOwner() != null)
        {
            accumulatedTime += ticks;
            getModifiedItem().getOwner().corruptBy(accumulatedTime / JadeConstants.BASE_TIME_UNIT_IN_TICKS);
            accumulatedTime %= JadeConstants.BASE_TIME_UNIT_IN_TICKS;
        }
        else
        {
            accumulatedTime = 0;
        }
    }
    protected void whenAddedToImpl(EquippableItem item)
    {
        super.whenAddedToImpl(item);
        if (SC.D100(90))
        {
            item.setStatus(ItemStatus.CURSED);
        }
    }
} 

And yes, my code contains comments and documentation - I am leaving it out here for brevity purposes!

Ok, that’s it for tonight. Remember… always listen to the Mad Minstrel ;-)

Categories: JADETags: · · · · · ·

25 responses so far ↓

  • 1 Rando // Feb 19, 2008 at 1:33 am

    Do you have any code examples of the awarenesses in #2? The concept sounds promising, I’m having trouble wrapping my mind around it and figuring out exactly how that would work in code.

  • 2 Savuyar // Feb 19, 2008 at 6:09 pm

    So will there be unholy or cursed items? Or both? Having both of those would be nice since they actually stand for something else, although I remember the first versions of ADOM had unholy instead of cursed, right?

  • 3 admin // Feb 19, 2008 at 7:46 pm

    Actual the PrefixCorrupting example is an example for #2. Due to implementing PassageOfTimeAware the corrupting item will be notified whenever some time has passed for its carrier and then can react accordingly (by corrupting the wearer).

    As for cursed… unholy… etc. My example was not very good. JADE will have the same standard prefixes ADOM has for the cursed…uncursed…blessed scale. And then additional prefixes (one for each item) can be added. So you might find a cursed nasty short sword of vampirism… or something like that.

  • 4 evizaer // Feb 19, 2008 at 10:46 pm

    So you’re hardcoding all these effects in? That sounds like it leads to a class explosion. Wouldn’t it be easier to abstract this further?

    Here’s my idea: Make a hardcoded set of elementary effects (i.e. change health over time, change corruption over time, change alignment over time, add status, change stat over time) and then dynamically aggregate them into statuses such as “unholy” or “vorpal” or whatever, which would be defined in some configuration file. When the aggregate effect comes into play, you can link it to the item and hook it to whatever awareness apparatus you have in place. You can then push these effect aggregates onto your time stream (if I’m understand that idea correctly). I’m not entirely sure how the awareness idea works, so I don’t know how well that would play with what I’ve been saying.

    All of that theoricizing aside, you have certainly opened my eyes to a new way of designing this stuff. Thanks! :)

  • 5 vdweller // Feb 20, 2008 at 12:24 pm

    A nice (and easy to implement, IMHO) idea would be to be able to add enchantments to weapons. For example a player finds a “fire gem” and enchants his/her short sword to a “short sword of fire”, which means that there will be items which, when used/applied on weapons/armor, grant a prefix/suffix.

    Of course, features like this should be implemented with care, because versatility is nice, but with features like this, sometimes concepts like the prefix or suffix become too “obvious” to the player, and from the subconscious state of a magical/rare (and hunted for) feature it may becomes “just another thing to apply to my weapon”…

  • 6 Triton // Feb 20, 2008 at 3:17 pm

    That sounds great. I think it would be a fun challenge to include particuliarly nasty creatures that require certain modifiers on the player or the weapon attacking them. For example there could be a powerful undead that can only be hurt by blessed weapons or that will cause massive damage to the player unless the player is blessed.

  • 7 Daemon // Feb 20, 2008 at 3:28 pm

    I have some ideas concerning cursed items:

    * Make ‘em rarer. In ADOM cursed items were far too common (at least in my opinion)
    * Make cursed instrintic more common with certain prefixes/suffixes. (I think you have done this already. I can’t read code so well, so I’m not sure.)
    * Make cursed items more common in corrupting areas.

    There are some ideas. Feel free to use them, o’ almighty Creator.

  • 8 tOnGAs // Feb 20, 2008 at 7:58 pm

    The “timeline” feature looks really promising.
    Does it mean you could implement some kind of time-travel feature ?
    I’d really love a “scroll of Time Portal” for example.

  • 9 Dougy // Feb 21, 2008 at 2:49 am

    Just want to say my thanks for all the effort put into this new game! It sounds fantastic! I eagerly anticipate it’s arrival. I’m doing a PhD too and know how little spare time there is! Haha! How do you do it??

    Any chance of some screenshots?

  • 10 electric_wizard // Feb 21, 2008 at 2:38 pm

    I’ve always felt it odd when some vile, black hearted demon from the depths of hell leaves behind a blessed item when killed. Seems like the status of the item left should be a reflection of who or where it has come from. I’m not saying that everything dropped by an evil creature should be cursed but it would certainly make sense that you’d be more wary of something left by a chaos knight than a farmer.

    Having said that, I think status abnormality on the whole should be less common than it is in ADOM, but more potent. When you consider what blessed and cursed actually mean, i think it odd that so many items fall into these categories. I’d like to see a blessed item being a really fortuitous find, after all it is supposed to empowered by a god! Naturally holy water would need to be harder to produce, requiring a higher level of piety.

    Anyway, that’s my two cents on the topic.

    By the way, I really like vdweller’s suggestion about enchanting. It would almost be like your weapon gained levels as you added enchantments. Sounds good to me.

  • 11 Snut // Feb 21, 2008 at 3:58 pm

    The implementation for prefix and suffix objects sounds really flexible, and pluggable. Will there be spells to temporarily endow an item with such an effect? Can we wish for them to be added to favoured equipement? I’m all tingly with anticipation.

    Modifiable equipment is quite nice as a concept, especially if you can get some stuff done at the local blacksmith’s. Whack a few nails in a club and all of a sudden you could have a nasty, unwieldy club :)

    By the way, this is just an implementation thing, but to me it would make more immediate sense if the call to corruptBy in #2 used ‘ticks’ rather than ‘accumulatedTime’. Currently it seems that if unit time is 5 ticks and this gets called every tick you’d get corrupted by 0.2, 0.4 .. 1.0, 0.2, 0.4.. etc. rather than at a steady rate of 0.2 corruption/unit time.

  • 12 yisk // Feb 21, 2008 at 4:03 pm

    Come to us to Novouralsk! At you will be more time in road for programming. =)

  • 13 Gareth // Feb 21, 2008 at 7:44 pm

    If i remember correctly, early versions of ADoM used “secular” instead of “uncursed” i think bringing secular back will add a nice flavour to JADE

  • 14 Dougy // Feb 22, 2008 at 2:24 am

    I believe you can change “uncursed” to whatever you like in the config file. I had it as “standard” for a while and once, just for fun, “run-of-the-mill.”

  • 15 Yosmel // Feb 22, 2008 at 4:57 am

    All of this sounds amazing! I can’t wait to grab my greedy little hands on JADE when it’s finally released, regardless of the state :D

    Keep it up Mr. Biskup, I eagerly await more news!

  • 16 m_bowwarrior // Feb 22, 2008 at 10:56 am

    I have a proposition who could be interesting.
    What do you think about making “combo” effects with items?

    For example : when you have
    -2 rings of heal
    -a shield of heal
    -an armor of rapid healing
    ….

    you have a combo effect who generate new side-effects or who boost the first effect.

    If I remember, this sort of thing exist in Diablo 2.
    It could bring quest or just exciting research for the “unique” helmet of breathing fire to complete the combo ^^”

    P.S.: I like the possibility of adding gems or runes in inventory items.

  • 17 Artran // Feb 22, 2008 at 12:23 pm

    I don’t know if adding feature with runes and gems is good idea… maybe yes but not for every class. ADoM is great because every class has its own very individual skills and abilities and hence unique strategy of playing. So only weaponsmith was granted to improve weapons and armour. So if you wanted to make better things you had to play weaponsmith. If everyone could improve weapons and armour it can lead to destroying class uniqueness.

  • 18 m_bowwarrior // Feb 22, 2008 at 3:22 pm

    [quote=”Artran”]I don’t know if adding feature with runes and gems is good idea… maybe yes but not for every class. […] So if you wanted to make better things you had to play weaponsmith. If everyone could improve weapons and armour it can lead to destroying class uniqueness.[/quote]

    I’m agree, so why not having gems and runes who could be ONLY used by weaponsmith with more or less efficiently as a function of the level in weaponsmithing ? This doesn’t disable the availability of those items during dungeons & cie.

  • 19 theotherhiveking // Feb 22, 2008 at 5:19 pm

    wait, Afaik the will no be real clases in jade, you can start as a ancher and learn to smith thing later with practice.

  • 20 yisk // Feb 23, 2008 at 1:47 pm

    I congratulate on a holiday of all! Day of the Defender of Fatherland!

  • 21 Marek14 // Feb 24, 2008 at 3:59 pm

    A few ideas:

    In ADOM blessed items deal more damage to demons, undead and similar nasty buggers. The problem here is that all blessed items work like that, regardless on how they came to be blessed :( I mean, holy water produced by a C PC on a C altar does exactly the same thing as holy water produced by a L PC on a L altar…

    Maybe there could be more than one type of blessed item, based on the alignment? Like:

    Law-blessed item: Deals more damage to chaotic creatures (which already automatically includes undead and demons). Provides some extra bonus to L characters, increasing with alignment (L+ > L > LN). Provides extra penalties to C characters (again, increasing with alignment).
    Any corruption from a Law-blessed item (either on enemies or on wielder) is lessened.

    Balance-blessed item: Deals a bit more damage (not much) to lawfuls and chaotics. Provides extra bonuses to N characters (best to N=), gives some penalties (relatively minor) to L+ and C-.

    Chaos-blessed item: Deals more damage to lawfuls, provides bonuses to C characters and penalties to L. Any corruption from a
    Chaos-blessed item (either on enemies or on wielder) is increased.

    For nonwearable items, the rules of thumb might be:
    Law-blessed: a bit dull, but very reliable items - hard to damage, low RNG ranges for effects.
    Balance-blessed: Medium-range, like current blessed items.
    Chaos-blessed: High-risk, high-power items. Large RNG ranges, bad effects happening together with good (like zapping a chaos-blessed wand gives more damage, but you might suffer some minor corruption as a result), items might be powerful but damage easily etc.

    Now each monster and dungeon floor might have defined what are the chances for various item states to be generated.

    This way, chaos creatures might have lots of chaos-blessed weapons which are quite unpredictable and might cause trouble in hands of lawful PC.

  • 22 Laukku // Mar 1, 2008 at 11:35 am

    If I Recall Correctly, “unholy” and “holy” were changed in ADOM to the more sense-making “chaotic” and “lawful”. So that “unholy battle axe” would be “chaotic[…]”.

  • 23 RealSergius // Mar 19, 2008 at 7:02 am

    IMHO, chaos & lawful are more adequate. But what about religion in JADE? May be chaos, lawful, etc. must be changed accordingly to major entities names (as items, “devoted to […]” or “depended upon […]”).And bonuses/penalties dependes on such an entity and your class/race in game.

  • 24 GroovyJ // Mar 22, 2008 at 6:14 pm

    I think perhaps the terms blessed and cursed would be better replaced with the concept of aligned items. Items could be lawful, neutral, or chaotic. Lawful and chaotic items would function better in the hands of folks of their alignment, while functioning as cursed in the hands of folks of opposed alignment. Neutral items would function normally for anyone. Neutral characters would have no advantage using neutral items, but would have no disadvantage with Lawful of Chaotic items.

    Distribution would probably be about 25% lawful, 25% chaotic, 50% neutral, with modifiers according to the source of the item. (An item dropped by a chaos knight might be 50% chance of neutral, 50% chaotic, for example.)

    This seems to fit into the mythology of ADOM far better than the current system. Altars could be capable of realigning items to their own alignment, provided the character is pious enough (the more powerful the item, the more piety is required.)

    Since alignment for characters is fluid in ADOM, such a system would be strategically interesting as well as making sense. A lot of JADE seems to be taking the best parts of ADOM, and generalizing them to much broader applications. I think extending alignment to items in place of the somewhat strange curse/blessing system makes a lot of sense.

  • 25 Newmooon // Mar 31, 2008 at 9:52 am

    I think that Marek14 had pointed out some good ideas, as marek14 said it is important to separate curse and bless form chaos/evil and good/law, becuase a good/law curse should (or must) be different from a choas/evil curse. Also increasing power of items with gems runes or permanent spells is something I love.

    And an other thing. This is very important. For every curse in the game you should have a way to remove the curse. And keep it balanced! If you can be cursed for every item you touch, there should be a high probability to find uncursing scroll. Also if you get corrupted on every fight there should be a lot of potion of purification.
    But if you get corrupted only if you enter in the worst dungeon of the game you should go to the most powerful law/good altar to have your corruption slightly removed.

You must log in to post a comment.