Friday, 27 August 2010

My drunken night with Charles Stross

Pro tip: India Pale Ale.*

(* I would like to thank Charlie and Feorag for being incredibly generous with their time especially at the excruciatingly embarrassing part when I tried to show him something I had written. Also everyone else who attended and had to put up with me interrupting his anecdotes. And I owe someone else whose name I missed a round...)

Sunday, 22 August 2010

Proceduralism: Part Four (What is Interesting?)

[You'll probably want to read the original article series that inspired this follow up, then start with parts one, two and three of this series.]

There are four different strategies for discovering interesting procedural content. These are not exclusive - I can see solutions which blend several approaches being viable.

1. Simulation

We know the real world is interesting - or at least that we are adapted to finding the interesting bits of it. Therefore, by making our procedural generation processes have higher fidelity to real world processes, we guarantee that we'll make more interesting content. Game example: Dwarf Fortress

2. AI Directed

We create a process that determines whether content qualifies as interesting - ideally by simulating human intelligence in some way. We then generate or cull the content using this simulation to ensure it qualifies as interesting. Game example: AI Director in Left4Dead

3. Human Computing

We already have a process that determines whether content is interesting: the player. We therefore harness the player to allow them to choose which content is interesting. This encapsulates a range of strategies: from allowing the player to progress faster through uninteresting content and slowing their progress through interesting content (Game examples: Angband, Crawl), by allowing labeling of interesting content for other players (Game example: Noctis) or by using procedurally powered tools to let the player create user generated content (UGC) for other players (Game example: Spore).

4. Intuitive

We are not very good at distinguishing truly interesting content from random content which fulfills certain criteria (bright lights, loud noises, random rewards). As long as we create content which is sufficiently interesting, perhaps mixed with some complete randomness, we will not be able to distinguish it from content which is more interesting - there is a threshold above which differences in 'interesting-ness' is not perceptible. Therefore it is sufficient for a game designer to choose one or more procedural content generation techniques to use, and tune the parameters by 'staring at the screen saver' and finding values which define consistently interesting content. This is currently the most common form of PCG development.

All four approaches rely on the unproven assumption that there is a level of complexity beyond which people cannot distinguish a procedurally generated system from a human designed system. This is a frequent criticism of procedural content generation: that it is too easy to find something in a procedurally generated system which would clearly not exist if a human had created it. This differs from the intuitive threshold, above, in that it is possible to have interesting, but clearly not human designed content.

Note this is only a problem if computer created content is valued less than content with direct human authorship. I believe there are two approaches to procedural content generation which can help address this: low fidelity and high fidelity. These both come from the idea that people dislike computer generated content for much the same reason that they dislike facsimiles of people - the uncanny valley, but for all procedural content, not just people.

Low fidelity content is content which is clearly distinguishable as artificial: chip tunes, Minecraft maps and pixel and ASCII art. Low fidelity content doesn't trigger the procedural uncanny valley because it is so dissimilar to anything in nature and therefore non-threatening.

High fidelity content on the other hand needs to be indistinguishable from human authored content. High fidelity content doesn't necessarily have to be realistic: it just has to match the conventions of the genre and form - which for games are luckily much lower than other media.

Aside from the expense and complexity of developing it, one significant problem with high fidelity content is that if it is revealed as having artificial origins, the content consumer is likely to experience a significant shift in their perception in how the content functions. The recent criticism of Starcraft 2's narrative highlights the concerns of manipulation of the world to match narrative in a similar way. More importantly, the problems getting high fidelity procedurally generated music accepted in a field dominated by real people point to a longer term resistance to high fidelity solutions. In short, if it looks like a person wrote it, and it turns out a procedural algorithm did instead, a significant percentage of people will feel somehow betrayed.

There is one other significant pay off with the combination of testing for interesting procedural content: it doesn't just allow us to develop better content, it also allows you to determine with high precision what exactly 'interesting' is. This is the most exciting area of research for procedural content generation: once you have a procedural system set up, you can can vary the parameters and measure how this variation affects your test candidates, be they humans or AI programs. Julian Togelius has used the AI directed approach to try to evolve new games, by testing them against a fitness function which evaluated how interesting the rule sets are; equally by randomly varying the rules of a similar set of games and seeing how human players evaluate them, you can determine what the most interesting rules are.

And unlike real world psychology experiments, procedural content generation allows you to vary experimental parameters at very low cost. I can see the potential of procedural content generation is to rapidly refine a model of the mind by both allowing both extensive randomized trials of real people, and testing of multiple differing models against procedurally generated scenarios.

I take a brief second look perspectives in part five.

Proceduralism: Part Three (What is Procedural?)

[You'll probably want to read the original article series that inspired this follow up, then start with parts one and two of this series.]

Alongside the attempt to define a taxonomy of procedural content, my other main goal for the PCG wiki was to list what games featured procedural content - expanding on the inadequate wikipedia entry to create a definitive go to guide if you were looking for a procedural fix. But this building this list has stumbled for two main reasons: a lack of time and contributors - which results in the majority of articles being stubs, with more polished entries where someone else has taken an interest, and a more fundamental problem with deciding whether a game is procedural or not.

But surely it should be clear whether a game is procedural? Take Elite - the canonical example of a procedural game, with an infinitely explorable universe generated from a starting seed. Elite is clearly procedural because of this infinite sandbox. Or is it?

It turns out the universe of Elite is in fact finite enough that it was possible for the founders to check the name of every planet to ensure that there were no curse words included in the final release. And if you are willing to accept a seeded universe but constant content as a starting definition for procedural, then is Eve Online procedural? What about Star Wars: Galaxies? Darwinia? Far Cry 2? Far Cry?

Well if Elite is not a good model to follow, then how about Rogue? Infinite, accessible dungeons - which implies accessibility to newly content is a prime requisite for procedurally generated games. But strategy games like Civilisation have had random maps almost as long as the strategy genre has been played on a computer, and listing every strategy game with a random map generator as a procedural game will be an enormous and potentially futile project.

So it's not simply a matter of random map generation, then how about other content like randomly varying the loot that you find. But that makes World of Warcraft as procedural as Borderlands and Left4Dead procedural because it dynamically mixes and matches zombie bodies to ensure variety in the horde.

But Left4Dead is procedural: because of the AI director, in the same way that Far Cry 2, but not the original Far Cry, is procedural because it has dynamic fire propagation. It's the emergence of interesting properties that makes a game procedural.

But this makes any game with a half-way adequate AI procedural, which is again not a useful definition from the point of view of building a wiki listing procedural games. And does a game like Deus Ex qualify as procedural because of the emergent property of using limpet mines to climb buildings? Maybe it is but Warren Spector didn't intend it that way.

We are left with two possible definitions which seem more robust but neither of which are ultimately satisfying: did the developer intend the game to be procedural, which leads to the problems of divining authorial intent, or is it procedural because I know procedural when I see it?

(I'll return to the matter of perspective later in this article series, but it is worthwhile noting that Minecraft feels more procedural than Populous because of the perspective the player sees the game from, in the same way that a first person shooter or platformer with random maps and AI feels more procedural than a top down strategy game with the same features. It is for this reason I've added a perspective category to games on the PCG wiki).

I want to avoid an argument about definitions for the moment, and try to look at some minimal examples of what we can mean by procedural. Take the following BASIC code:

10 PRINT HELLO WORLD
20 GOTO 10

Which if you run it, results as follows:

HELLO WORLD
HELLO WORLD
HELLO WORLD
...

The output of this code results in infinite content, and the code itself clearly defines a procedure for generating this content. But you and I both would have extreme difficulty in describing this as procedural content, because it is not very interesting.

What do I mean by interesting? That is the heart of whether a piece of content can be adequately described as procedural or not. If we just consider the output of an infinite number of HELLO WORLDS, we can see the content is not very interesting, because the underlying code required to generate this content is not particularly complex, and the result completely predictable.

But at the other extreme, apparently complete randomness isn't terribly complicated an algorithm either, such as this Python implementation of a multiple with carry random number generator shows. The output of this algorithm is too random for any human to detect the underlying pattern, while the pattern itself is compressible in a sense that true random numbers, such as thermal noise, are not.

The fact that a less than one page long algorithm can generate 'random' output as far as a person is concerned implies there is a not terribly complicated threshold past which someone is incapable of distinguishing an algorithm from random noise.

What fascinates me about procedural content is my belief that there another useful boundary between trivially predictable output and effectively random output - what I've called elsewhere biased randomness - that is randomness produced by an underlying discoverable rule set. That is not to say that randomness is uninteresting - given sufficient incentives, we can become horribly addicted to random output - but I think there is more value in exploring biased randomness than coming up with better ways to package completely random content in a compelling format.

You may be thinking here of the mathematical concept of 'chaos' - but while this may be a useful analogy, don't confuse the two. There are plenty of chaotic systems which can be easily comprehended by a person (the outcome just can't be predicted), and just as there are plenty of ordered systems which are similarly incomprehensible. Even the predictable behaviour of two body planetary motion was unknown until the recent past in terms of the overall human evolution of thought.

It is also likely the case that compelling biased randomness is even more complex than the algorithm required to implement effective randomly content - just in the same way that the real world is more complex a place than an aggregation of random elements. This will also be a challenge for biased randomness: justifying the additional time and expense above strictly random content.

So my answer to the question 'what is a procedural game?' is that the game presents a biased randomness where discovering the underlying rules is a necessary part of play. That doesn't help much when it comes to deciding what games should be in the wiki, but at least I have a set of criteria which feels more objective than those I outlined at the start of this article.

Whether the biased randomness in a game is interesting is a subjective exercise: one person's discoverable rule set is another person's fiat from the gods. But I don't believe this is an unsolvable problem: there are definite strategies to discovering whether something is interesting, and ways of dealing with the most common criticisms of procedural content generation. And the question of what people find interesting isn't just an issue for game design; with procedural content, it allows us to build a more precise model of the mind.

And I'll be talking about that in part four.

Sunday, 15 August 2010

Because procedural developers are lazy

The meme of a procedural Zelda is a compelling concept when thinking about procedural generation. The classic Zelda design could be reduced to a the lock and key maze, of which EaS is an excellent example. A lock and key maze requires that every key is placed somewhere in the maze before the lock that opens it, which ensures that the maze is solvable. The puzzle is exploration based, rather than requiring particular problem solving skills, but I would qualify it as a puzzle nonetheless.

The question I have is what other puzzle designs are suited to procedural generation techniques? (With a particular focus on those that produce interesting level design).

Is it possible to procedurally generate Sokoban levels? Explorable match 3 puzzles?

Rather than answer the question myself, I'd like to throw the floor open to suggestions from the readers...

Tuesday, 10 August 2010

Designing a Magic System Redux - Part Two (Status Effects continued)

You should read part one of this article, and are strongly encouraged to read the original Designing a Magic System series of articles if you have not already done so.

There is an asymmetry in the design of status effects in Angband: they differ (sometimes significantly) in implementation between the player and monsters. But I've aspired in Unangband to reduce the asymmetry between the two where possible so I'll begin discussing the impact status effects they have on the player and briefly note into the differences between the player and the monster at the end of the article.

There is also a difference between the original Angband, and Unangband implementation of status effects, where Unangband has more possible states, but compensates by weakening the impact of the original Angband effects. The primary approach I've taken is to make it harder to add additional time to a status effect once the player is already affected by it - to avoid continuous locks. I've also modified the effect where noted below with the intention of making it easier for the player to continue to act when partially impaired without requiring they immediately reach for a reset of the effect.

Blindness was the example I looked at in the first part of this article: a player who is blind has a significant penalty to hit when attacking and cannot read scrolls or cast spells - presumably being unable to read the words from the spell book. In addition, the player stops getting screen updates - so that they are not able to see the current location of enemies or changes in surrounding terrain. My intention in Unangband is to weaken the blindness effect slightly, so that you can cast a spell once, from memory, while you are blind, before forgetting it. This is a shout out to my AD&D 2nd edition roots, as well as a way of allowing the player to sneak around in the dark and still cast spells.

Amnesia in Angband has been changed to a timed effect, based on Unangband's implementation, so that you suffer a penalty to your chance to cast spells. Unangband also prevents you from activating artifacts and other items - it makes you temporarily forget you have identified them - and when blind, will stop you from casting spells at all. (At the moment Unangband stops you from casting at all while merely amnesiac, but I'm changing to closer match Angband in the next version).

Confusion in Angband prevents you from spell casting, as well as causing you to move and shoot in a random direction instead of the intended direction. I weakened this effect in Unangband so that you can cast spells while confused - because the random target selection effect when combined with the ability to hurt yourself with spells makes for an interesting risk vs. reward trade off - and also made confusion only having a percentage chance of taking effect which increases as you become more confused.

Fear prevents you from fighting monsters in melee - you refuse to attack anything that you bump into. This is meant to encourage the player to flee, but it instead merely forces you to switch to missile weapons or spells, which there is no penalty to use even at point blank range. To compensate for this, I'm adding an additional terror effect, which acts as an 'overflow' to fear. Once you become sufficiently afraid, any fear will overflow into the terror status. While you are terrified, you cannot use any ability which requires aiming - including spells, missile or thrown weapons. You are still able to use other abilities, amongst them the various teleport effects you should be considering to escape with.

I've taken advantage of multiple meanings, to provide an alternative overflow from fear: that of petrification. Petrification status prevents you from moving (although you may teleport still), and has no other effect - although most direct petrification attacks are highly damaging as well. It is possible in Unangband to become petrified with fear, in the same way that terror overflows - and the two different types of overflow are exclusive: you'll either become terrified or petrified if you are made highly afraid, not both.

Paralyzation is the most uninteresting status effect: you simply cannot do anything while paralyzed, and so it is incredibly hard to balance and puts the player at the highest risk of getting a lock. Unangband has a second, more interesting variation: stasis - which paralyzes you, but also makes you invulnerable to damage, which is a side effect of time attacks. Stun deserves mention here because it incrementally penalizes you to the point of knocking you out, an identical result as paralyzation, but the initial penalty is very slight. Both paralyzation and stun are less interesting than the status effects I've already mentioned, because you either perfectly resistant or are in incredible danger should you encounter a monster (or worse group of monsters) which inflict this effect, with very little margin in between. To mitigate paralyzation, I use the slow effect as an intermediate step, with you being slowed before you are paralyzed the majority of the time.

Using the above combination of effects, you can chart the impact on the player's abilities as follows:
You might be tempted to add, for example, a Nausea effect to the above chart, which prevents you from using potions. But I'd discourage this: potions are best kept as the get out clause reset for any effect. It is still possible to partially incapacitate yourself through bloating by stuffing yourself with food and drink, for which a potion of Salt Water is a useful antidote.

You'll also notice Daze in the chart, which I haven't provided an explanation for yet. Daze will be new to Unangband in the next release: it prevents the caster from casting spells on himself and is the direct inverse of Terror, but for only spell casting and (perhaps) magical devices. Daze is interesting because it forces you to use spell attacks which are hampered, or my preferred terminology, made more interesting by blindness and confusion. To complement this, both Confusion and Blindness overflow into Daze, and there is no direct way of a player being dazed by an attack.

Of the effects in the above chart, only petrification, fear, blindness and amnesia of themselves totally incapacitate some ability of the player. The remainder only incapacitate in combination, or as a result of another status effect being repeatedly applied to the point where it 'overflows' into a more dangerous status (Terror and Daze cannot be directly applied to the player). The idea here is the player should get some opportunity to use a reset to avoid incapacitation, with a large margin of error before the more dangerous state occurs.

There are in fact 32 status effects which can negatively effect you in Unangband: of those I've not mentioned, the remainder are either debuffs (stat modifiers), change the rules monsters use to track you (aggravation, stench) or damage over time effects (poison, cuts) and so don't need result in the complete incapacitation which causes a lock. There a Soaked effect which prevents you from lighting fires or reloading firearms, and a Berserk effect which allows you to voluntarily give up missile and magic attacks in return for improved melee, healing and immunity to fear but both of these will have minor impact compared to those I've discussed in depth.

There are two exceptions: Sleep and Hallucination.

Sleep is one of those spells from AD&D which I cast into the same problematic category as Magic Missile. It was a 1st level spell which either fails or immediately and completely incapacitates with no in between. Sure, you can increase the level casting requirements and have the victim wake when attacked instead of being able to deliver a coup-de-gras, but the ability to completely disable an opponent and escape means the spell has to be made effectively useless against any opponent you'd want to use it against. Sleep works great in a role playing game which is strong on the capture and interrogate dynamic: not so for computer games.

Angband sidesteps Sleep effects against the player completely in favour of paralyzation, which is less a solution and more a tactic acknowledgment of the scope of the problem. Unangband separates them: and gives the player a cool down before falling asleep, which you can cleverly use to damage yourself to stay awake. Should you keep damaging yourself for the duration of the sleep spell, you'll avoid the effect completely.

Hallucination is a fun trick with ASCII graphics, but has little functional difference, and a lot of overlap with the confusion effect. Unangband already has enough restrictions on spell casting to make it worthwhile having hallucination stop spell use as well. But the Nightmare on Elm St of sleep started to get me thinking about what hallucination should do.

Sorcerers in Unangband don't have the range of options that the other major spell casting classes do. I've tried to remedy this by letting them make magical traps, but this both lessens the utility of actual trap setting, and requires enough horrendous hackery that I'm forced to reconsider. Sorcerers can shape change, and charm, and like druids have a minor in summoning spells, but I've come to realize that status effects should be the sorcerer's forte. But blinding and confusing and dazing monsters leaves two problems for me to wrestle with: firstly ensuring that the time required to get a lock on a monster is approximately the same as killing it, and making clear the victory conditions for doing so.

I will be reusing the surrender code to allow monsters to gracefully give up to the sorcerer: but it is more difficult to decide when this should occur. With hit points, we have a clear definition: when the monster is near death. With status effects, I have to define more clearly how to get a lock.

Take the following chart:

This is the status effects I've described previously, excluding effects that disable all a monster's abilities, with arrows used to indicate where one status effect overflows to another, and where abilities accumulate together to provide a 'higher level' result. I've added one additional overflow: confusion also can also overflow to hallucination - which will be important later.

If a monster is both frightened and petrified, it is considered in a melee attack lock. It cannot provide any kind of melee threat to the player, and if it is only capable of melee, it provides no further threat to the player until it recovers from either effect. Similarly, terror provides a ranged attack lock by itself, where ranged attacks are either shooting or breath weapons, and either amnesia and blindness, or terror and dazed effects provide a spell casting lock. A monster will surrender if it has all its abilities (melee, ranged, spell casting) locked for sufficient time and it has no allies in line of sight which are also not incapacitated. If a monster doesn't have one set of abilities it is is easier to lock.

In this way, aiming for a status lock is a broad attack in that you have to apply multiple different effects to a single monster for it to be defeated, whereas damaging attacks are deep in that once you find the vulnerability, you repeatedly exploit it with the same attack.

Also note that if the monster is immune to a particular status effect it is also harder to get into a lock: for instance monsters which are immune to fear cannot be melee or ranged locked unless it is possible to directly apply petrification or terror. Ideally there should be multiple paths to achieve each lock, so that a monster which is immune to a single type of status lock can still be affected by applying another combination of status effects. I am tempted to make the hallucination effect also prevent ranged attacks - another alternative would be to make confusion plus blindness effectively act as a ranged attack lock, because a blind and confused monster is unlikely to be able to use any ranged attack effectively.

But even if I make hallucination prevent ranged attacks, it still feels like the unwanted step child of status effects. Luckily, I've come up with a fevered dream of a solution that should give Sorcerer's yet another way of attacking monsters with status effects.

What is missing from Unangband is the ability to create illusions - something a Sorcerer class should excel at. There's a number of ways to implement illusions: you can have monsters which disappear when attacked, mirror images of the Sorcerer which disappear when attacked... all in all, a little ineffectual.

But what if you allowed illusions to cause real damage while the target was affected by particular status effects: I'm thinking specifically of while sleeping. That way you could have illusions interact with real monster resistances so that if you tried to burn a monster with illusory fire which is normally immune to that effect, it notices and wakes up, whereas you could damage it while asleep and have it remain asleep if it succumbs to the illusion. The incentive here is for the Sorcerer to attack monsters as they asleep, but have to periodically force them back to sleep as they are awoken by the illusory effects you cast at them. Pure damage could be represented by the Sorcerer's existing mental attack abilities, which would cause double damage to sleeping monsters whereas the various illusory elemental attacks would require the illusionist play by the same rules as regular spell casters.

And in this scheme, the hallucinating status effect would similarly allow you to affect monsters with illusions while they are awake. The advantage to hallucination is the sleep effect has a time delay before the monster succumbs, whereas hallucinations take effect instantly.

This is followed by part three which looks at magic items in more detail.

Sunday, 8 August 2010

Design A Magic System Redux - Part One (Status Effects)

In the original Designing a Magic System series of articles, I briefly looked at status effects as a way of separately out various incapacitation effects from hit points. Antoine's suggestion of an Enchanter class in Angband has forced me to take a closer look: both to justify my intuition that an Enchanter class would be inherently uninteresting, and set myself the challenge of trying to make this class, or the Sorcerer equivalent in Unangband, an interesting play style. Luckily I'm in the midst of implementing a whole host of new status effects in Unangband, so I'll be able to benefit from this design exercise as well as give you some insight into the decisions I've made.

My original thesis in Designing a Magic System was hit points are a good design compromise between a tug of war between two sides, which could result in games which never resulted in a victory condition, and incapacitating damage which would result in a negative feedback loop where the player could lose the game without being dead.

In this model, status effects become an idealized way of representing various types of incapacitation without being directly linked to hit points. Status effects are almost always timed, to allow the ability limited by the status effect to recover naturally should the player survive long enough, and can be recovered from using a variety of resets. It is important when designing status effects that it is not possible to get a lock on the player, but you can intentionally design traps, which are best suited to multi-player games, to allow a player to get a significant advantage by applying a lock, but at increased risk should the opponent predict that they are attempting this technique.

(If you are not familiar with locks and traps, I recommend that you refer to the original articles).

The canonical example of a status effect is the interrupt - this interrupts whatever the other player is doing and forces them to start again. If the interrupt takes less time than whichever action the other player is attempting, you can keep your opponent constantly interrupted - and if you start your interrupt action before they do, you can get a lock on the other player by interrupting their attempts to interrupt you. If the game has an action which takes less time than an interrupt, but does much less damage than the standard action, you can create a trap: the other player may attempt a standard attack for a lot of damage, but be at risk of your interrupts, or use the weak attack to avoid being interrupted, which exposes them to your standard attack. The trap in this example is only interesting if the other player is a human opponent: because it forces you to build a model of what the other player is thinking - in effect, to second guess them.

The interrupt as a status effect can be problematic for two reasons: the interrupt can be constantly applied if the duration of the interrupt is longer than the time required to apply it, and if there is no way the opponent can get a win if you choose to always interrupt. I've referred to both of these as locks, but these are actually different but related behaviours. (Note in this example, the duration of the interrupt is actually the duration of whichever action your opponent was attempting, plus the duration the interrupt prevents further activity for.)

Even if you are careful to ensure the interrupt action takes longer than the time it interrupts the other player, if you team up with other players, it may be possible to get a lock on a single player through judicious timing of interrupts. (Or conversely, multiple enemies could get a lock on you).

But imagine an interrupt which only affects some of the possible actions the other player could choose. An example in Angband is blindness. Blindness has a partial effect on the player's melee and shooting skills, completely prevents spell casting and reading scrolls, but has no impact on the player's ability to quaff potions, or use rods, staffs or wands. As a designer, you can minimise the risk of constant blindness by designing items which can reset the blindness effect and ensuring that they are usable via a action which blindness does not prevent - as a player, you can minimize the risk by ensuring that you carry these items. The counter-example to be avoided: a helmet of blindness which can only be removed by reading a scroll of remove curse. This would give the player into permanent blindness once they accidentally wear this item - not catastrophic, but a significant impact on the overall game.

(For the Unangband equivalents, you could extend this table to include all the possible status effects to get a feel for what different types of partial incapacitation could do.)

By using partially incapacitating status effects, and allowing resets, we can side step the risk of unintentional locks because the player can always reset themselves out of a lock, or choose an action which is unaffected by the lock that allows them to progress towards winning. (Using rods, staffs and wands are permitted while blind for this very reason).

There is still the risk of cumulative locks as follows: imagine there are some number of partially incapacitating effects, each of which affects the player's ability to do certain things, but when some of these effects are applied together the player is totally incapacitated. You can design your way out of this problem by ensuring that there is always something the player can do - but I think there is a more interesting alternative.

I've been using the term path to victory somewhat loosely: but let's be more rigorous about it. The path to victory is the total distance (number of actions or time) that the player needs to win the game. The shortest path to victory is the player doing the optimal action at every point and the opponent picking the most suboptimal action: the game is unbalanced if both the player and opponent choose their most optimal action and either is guaranteed victory. Unbalanced games are fine against multiple opponents (Angband being a classic example of this).

For this argument, assume the path to victory is always progressed by doing damage to the opponent's hit points. In this instance, the most logical way to win is by using your most damaging attack. A counter strategy to this is to use status effects against you which prevent you using your most optimally damaging attack, and force you to use a more suboptimal attack. Ideally the first status effect to apply would be the one that causes the most difference between the two: but it may also make sense to use a status effect which lasts longer and gives your opponent a bigger window for counter attack.

The path to victory is blocked completely if the opponent is able to use a combination of attacks which prevent you doing any damage at all to them. We call this a lock.

The above is pretty self-explanatory and you can see various techniques for reducing the risk of a lock (always allow a damaging attack and a reset to be available, reduce the duration of the combined status effects so that the time to implement them all exceeds that figure etc).

Here's my theory: the risk of a lock becomes a non-issue, when the distance to achieve a lock (time or actions) is the same as the length of your path to victory. That is, if the effort required to get a lock on an opponent equals or exceeds the effort required for to win against that opponent, from a design point of view you don't have to worry about the risk of a lock being applied. In essence, getting the lock is just as difficult as winning.

(In fact, you can have a more generous margin, because it may not be initially clear whether direct damage or a lock is the correct approach to take.)

Antoine's Enchanter (and Unangband's Sorcerer) then becomes a class which can lock opponents through a combination of status effects with about as much effort as another magic using class would take to kill them.

And in part two, I'll look at which status effects that Unangband has to support this.

RIP

For a variety of reasons, I am tempted to add the 'towel wrapped around head' character state.

Sunday, 1 August 2010

The Problem with Pretty Damn Quick

The agony and the ecstasy of Valve is they don't release until they're ready. When this goes badly, it could be a recipe for timid over-design that boils out the essential flavours, but when it goes well, such as the recent Engineer update, it makes genius games. In fact, Valve at the moment feel like they are on a whole different level of game design from other companies and Team Fortress 2 is the boiler room in which they sweat out their best work.

Take one design which has been simmering in beta for over a year - the Pretty Damn Quick. This is the engineering wrench which allows you to build buildings faster, at the cost of not being able to upgrade them. It is an 'obvious' design, in that it makes a net improvement to one parameter, while removing another. And there is no hint of the PDQ in the actual release.

Or is there?

Surprisingly, there is the reverse: the Gunslinger. The Gunslinger allows you to build and upgrade all buildings normally - except the sentry, where it allows you to quickly build a sentry which cannot be repaired or upgraded at all. The inversion in this design is that it is the building that cannot be upgraded, rather than the ability to upgrade which is removed. The reason why is obvious in retrospect: an engineer with a Gunslinger is still able to upgrade the buildings of engineers he works with, but an engineer with the PDQ is not able to assist his team mates - and the Team in Team Fortress 2 highlights why the Gunslinger design is the better choice.

(As for why it is only the sentry which is modified by the Gunslinger design: the tf2 blog post about the Repair Node is a lessons learned on why the teleporter and dispenser should not be messed with).

If you look at the other class updates in this light, the balance of unlockable weapons favour team play over individual prowess: the Jarate and Huntsman allow the sniper to move up alongside his team to assist, bleeding weapons highlight enemy Spies to other team mates instead of improving instant kill chances, the poorly received Scout update improving the ability to distract and harass instead of assassinate, the Scottish Resistance providing superior area denial abilities.

So what next?

If you've missed the analysis on the forums, the Polycount update will include community weapons with new abilities and the underlying message is don't worry about the game design - Valve have got that covered. Despite the forums being filled with back seat game designers, like myself, none of them are at a stage where we can conduct wide spread testing and analysis of games to the same depth that Valve is capable of. I find this a little surprising: play testing is something that should be easy to crowd source by distributing a server side mod, but the combination of community organisation and technical ability appears to be beyond most forum members. I suspect this is because game design is ultimately dictatorial - which is why the variant model used by Angband development (a gateway drug which is easy to edit leading open access to the clean source code combined with lots of bad game design) works so well. In order to organise external testing for Team Fortress 2 of the sort required to match Valve's game design abilities, you'd need to find the group organisation, game design and reverse engineering skills in the same individual or tight knit team, virtually fully formed.

But it turns out what is next is actually Alien Swarm, the free to play source mod released with source code, a tile based generation tool set which includes procedural level creation tools and access to the AI director. Alien Swarm is an entirely different kind of boiler room, and seen in the light of the misdirection of the PDQ beta I believe Valve are putting a number of free tools out there to see what the community can do with them.

We know that Valve are experimenting with procedural content generation, because Gabe has told us so, in an editorial written for Edge Magazine in December 2008. At the time, everyone assumed he was talking simply about the AI director in Left4Dead, but he must also had in mind Alien Swarm - the team of which Valve had hired the previous year - and was 'thinking aloud' about whether procedural content generation was possible for level design as well as pacing.

The procedural generation in Alien Swarm is about as simple and generic as you can make 3D generated levels - so simple at the moment it doesn't necessarily guarantee connectivity. It is template-based, much in the same way Torchlight builds it's levels, although at a lower level of detail, and the view angle deliberately prevents more complex 3D geometry such as bridges and subways which would complicate the level generation algorithms. It does do some clever design with tags for various room templates to allow the random levels to be closed correctly to avoid players being able to fall off the edge of the world - an issue which 2D level designs don't face.

What it does give you is source code, the Source engine tool set and a design vocabulary to build on - and I believe Valve wants to see what is possible with that combination. What won't be possible with Alien Swarm is more complex 3D geometry - and you should ignore the temptation to port your favourite 2D roguelike level generator to the Alien Swarm source code. But, as Mad Tinkerer points out, there is real scope for creating a procedural Zelda-like - go here, destroy these things, get this door key, then go here - something that no one has tried to build using a roguelike engine. The tag system appears ideal for procedural puzzle building, there is enough of an in-game vocabulary of gates and triggers, and the possibility of using Source engine physics should be enough scope to (procedurally) build something beautiful.