Monday 19 September 2011

So what exactly is an "ego" item anyway?

I think the concept of the "ego item" in gaming can be credited to Gary Gygax, back in 1E AD&D if not before. Literally, he meant an object with an ego, with its own personality. In gaming terms, these were powerful items whose egos meant they were not to be trifled with, expressed their views and could in extremis refuse to obey the wielder.

As ever with Angband the original intent of the designers is unclear, but over the years the term has come to mean "an item with one or more properties which its base item type doesn't have, excluding plusses to-hit/dam (on weapons) or to AC (on armour pieces)". The original concept of powerful arcane items with their own personalities is closer to what we think of as artifacts, and indeed some roguelikes actually express the personality of some artifacts quite explicitly (e.g. the Singing Sword in Crawl).

Having collected the stats from 25million dungeon levels in 3.3.0 we're working towards a fairly significant overhaul of item generation, to try and rebalance the prevalence of weapons and armour which has crept up on us over the last few years. As many people have observed, there are some deficiencies in the current system - two main ones being the distinction between "special" and other artifacts, and the granularity of the alloc_prob variable. There are also obvious problems with distribution: the vast majority of stuff is findable in the first half of the dungeon, making the second half less interesting and making potentially interesting items obsolete too quickly.

It seems to me that the current system of templates for ego items is quite limiting - you need a new template for every variation of an ego, such as if you want it to be quite common on boots and quite rare on armour, or permit a higher pval in one slot than another. The potential for random variation is currently limited to a single random sustain, random high resist or random ability, and even these are implemented in a spectacularly hackish way. There's also no reliable way of providing a smooth power curve from {average} through {good} to low-end ego to high-end ego. Although you ought to be more likely to find Slay Troll than Holy Avenger on dl20 and the reverse on dl80, that isn't noticeably true.

I've had item affixes in the corner of my mind for a couple of years now. EyAngband introduced a number of useful innovations, this one clearly inspired by the prefix/suffix system used in many modern CRPGs (Diablo, Dungeon Siege, Titan Quest et al.). While EyAngband used them as a bolt-on to the existing framework, it would seem eminently plausible to replace Angband's template system with an affix-driven system for magical and ego items. What follows are my initial thoughts on how this could work and why it would be an improvement - feedback would be most welcome.

First, let's distinguish between craftsmanship and magic. A set of affixes like sharp/keen/brutal of piercing/slashing/bludgeoning could refer to additional damage-dealing properties of weapons which result from superior craftsmanship rather than magic (e.g. +dam, or chance of 2x dam, or whatever). Similarly, affixes like superior or of deflection could imply similarly-derived properties for armour (e.g. increased AC, reduced weight). As an aside, this opens up interesting possibilities for making detection slightly less dominant if these items did not show up as magic.

Next, you have all the magical affixes, which should be divided into groups. These would include slays, brands, resists, stat boosts, protections, movement effects (speed, stealth, FA, lower weight, etc.) and so on. I envisage a one-to-one mapping of affixes to object flags, so that any code for picking affixes can provide any individual flag. (Note to self: get the OFT_ types right in list-object-flags.h and this grouping is already done.)

That gives you the basic framework for creating the equivalent of {good} items and low-end egos. What we now think of as {good} would be those with a non-magical affix (occasionally two) which purely boosted offence or defence, while those with one magical affix would be the equivalent of today's single-slay weapons and other one-trick egos.

Where it gets interesting is combining multiple affixes. You can combine a prefix and a suffix to get items ranging from mildly exciting to endgame (anyone remember Godly Plate of the Whale?). You can combine more than one of each to re-create the current high-end egos, with hundreds of other possibilities. You can combine craftsmanship and magical affixes to get even more permutations (sure, Gondolin weapons are special, but some of the smiths were better than others). The key thing about this is that it provides a route to a smoother power curve - the number of affixes would be a function of depth, with shallow items rarely getting more than one or two and really deep items rarely getting fewer than four or five.

Not all properties are equal so it would be sensible if there was some way of telling the generator that "of Dragonbane" is a more useful affix than "of Troll-slaying". I know that some people intensely dislike numerical power ratings, so I remain open to alternative ways of achieving this. In the meantime, list-object-flags.h already provides a rating for each flag, and a multiplier for each slot, which could be used as a starting point.

To avoid a total mish-mash of random permutations, we could tell the generator to recognise certain combinations and steer its later choices. This would enable us to retain the flavour of existing ego types without their limitations - we could specify the likelihood of each affix on a per-slot basis, and limit the later choices as much or as little as we wanted. (Hmmm, this item has one more affix to go, and it's already got SLAY_ORC and SLAY_TROLL - looks like a weak Westernesse weapon to me, so let's give it STR or DEX ... oooh we rolled a 1_in_6, let's bung in a sustain for free ...) It would also go hand-in-hand with naming items with multiple affixes - so for example anything with two of SLAY_EVIL, SLAY_UNDEAD and SLAY_DEMON gets the prefix "holy".

This proposal will mean rethinking the concept of randarts. With more randomness in non-artifact items, it becomes less important in artifacts. I think there is still a place for randarts, but how to distinguish them from these new ego items is a topic for another day. (My initial instinct is to randomise only *some* of the properties of each artifact ...)

So how are we going to balance this to make sure it doesn't flood the dungeon with egos (er ...) or, even worse, leave people struggling with a +0 whip until 2000'. That's what the stats module is for - rather than agonise over balance before writing it we can write it, run some stats, adjust it and iterate. It's non-trivial (the code for picking names is going to be tricky - fortunately there's a handy precedent in Sangband's class titles), but I think it's possible.

What do you think?

8 comments:

  1. Whow, I had totally forgotten that this blog existed.
    Not much traffic here.

    I have been saying for a long time, that more artifacts should be fixed in a randart game.
    Like the three, sting, ringil, calrist, anduril. The big names from the novels and the ones which became significant in angband's ( the games ) history.

    Similarly I would like to keep the interesting names of fixed egos. Like dwarven, elven, westernesse, defender.

    In the end the distinction between artifacts and egos could become one of pure flavor.
    Where artifacts have interesting text and a connection to the greater mythos, while egos have not.

    ReplyDelete
  2. While the current ego templates are a bit restrictive, it would not be too hard to make them less so. You could allow ego items to have a broader range of random properties (like FAangband ego items), or have code to design 'ego' items individually but based on a theme (like, you guessed it, FAangband jewellery).

    Not that I'm against affixes as such, but it could get out of hand - "In your pack: A Fire-and-Acid-Resisting Sharp Long Sword of Dragonbane of Free Action of Strength" would be a bit of a mouthful.

    ReplyDelete
  3. It would - but there's no reason it would need to be called that. I'd envisage any multiple prefixes or suffixes being described with a single word, so you'd never see more than A Blah Longsword of Wibble.

    ReplyDelete
  4. I think an edit-file based system of affixes has the potential to be hugely powerful and interesting, but anything that hardcoded flag selections or a one-to-one relation between flags and affixes seems like a backwards step.

    On the names issue, surely you could provide names for combinations of affixes in the edit files too - and specify probabilities for how likely they are to be combined with other affixes. Maybe you have affixes and a list of affix combinations that specifies rules about how to combine them, or something.

    ReplyDelete
  5. Excellent idea - edit files here I come.

    ReplyDelete
  6. It's a little to cumbersome to put these suggestions on irc, so I'm putting them here. This is based on e1c9b79 on magnate/affixes.

    1) We need to distinguish between magical affixes and non-magical affixes. non-magical affixes would be "sharp, rusty, cheap, tough, etc.". Magical affixes would be stuff like, "resist fire, slow digestion, etc." There are some difficulties with things like "sapphire, hunter's, etc." as it's not clear whether they are magical or not.

    2) Magical affixes get a "magical" flag. These will show up on detect enchantment. Unless they have an obvious effect, like +1 STR, they do not show up on wield.

    3) Non-magical affixes are obvious on wield (or maybe even LoS). If I can tell that the blade is rusty or damaged, then so can @. In general, the bonuses/penalties don't need to be revealed, but the attribute should certainly be known.

    4) Using enchant scrolls or spells on objects gives them the magical flag.

    5) I could see something like 'sharp' being non-magical and 'keen' being magical.

    6) Pseudo is entirely based off of the magical flags. You can have a sharp dagger (+2, +2) and it should pseudo as average.

    7) Curses can now be implemented as affixes. Although, I think implementing them now is premature until curse-breaking is sorted out.

    ReplyDelete
  7. Ok, I've been thinking more about this. If I was writing egos from scratch I'd probably pursue this framework. I think this will be accessible through Magnate's work, which would be nice.

    All items have 3 non-magical properties. These are: material, make, and quality. Material properties are iron, silver, wood, emerald, sapphire, etc. Make properties are, giant, troll, kobold, elven, dwarven, etc. Quality properties are, cheap, good, tough, reinforced, sharp, keen, brutal etc. The defaults for these are steel, human, and average. (Excepting quarterstaves and whips which are wood and leather respectively.)

    Every item gets three material properties, so the inspect screen might say something like:

    This item is made out of [steel] it is of [human] make and is of [craptastic] quality.

    Needless to say, an item cannot have more than one of any property. It cannot be both silver and diamond, and it cannot be of both hobbitish and giant make. It also can't be both ornamental and vicious.

    All of these properties are obvious on sight (maybe LoS). Squelch also has to be figured out, but I think this can be done.

    Now, in addition to these material properties, we also have a plethora of magical properties. An item can have any number of magical properties. There needs to be simple default property of "enchanted" which should probably be something like M15, M15 for +to-hit and +to-dam for weapons, and M15 for AC on armor items. All the slays, brands, stat-raising powers and resists are here. And the themed items are always just amalgamations of magical properties. (so durable would have to be a magical property.)

    If this wasn't complicated enough, there can still be a next step if desired. Namely, non-magical bonuses are susceptible to acid damage but not disenchant. And magical bonuses are susceptible to disenchant but not acid. For armor this is (mostly) easy since non-magical bonuses can be simply added to the base AC. For weapons this is a bit harder as you may need to keep track of both magical and non-magical bonuses separately. Now something like "restore item" scrolls make sense. They can restore all acid damage. Similarly "*enchant" scrolls can restore disenchantment damage, maybe incrementally back to the original amount.

    ReplyDelete
  8. I like this system - it gives a coherence and structure to affixes which I hadn't reached. It would seem sensible to do the three non-magical qualities as prefices, and all the magical qualities as suffices. The "type" field in the N: line would become one of material, make, quality, magical rather than just prefix or suffix.

    If you wanted to go through ego_items.txt and re-organise the affixes along these lines, I'll happily write the code to support these changes. (I'll start with just getting the items right, then we can work on ID and LOS detection etc.)

    ReplyDelete