Sunday 16 May 2021

The game that invented epic loot: Angband (1990)


Angband
is a 1990 computer game in the subgenre of turn-based permadeath dungeon-crawling RPGs, also known as roguelikes. Very few people play Angband today, and most PC gamers have likely never heard of it - even when they've likely heard of NetHack and Dwarf Fortress. But did you know that the randomized equipment or "loot" so common in video games today was originally an innovation of Angband

Today, these "loot lotteries" go far beyond just RPGs: the same blue "rares" and purple "epics" can be seen in the mainstream from mobile games to Fortnite, Destiny, and Counter-Strike: Global Offensive. We tend to talk a lot about the principles that make these systems compelling and even addictive. But what is less often discussed is how the concept's introduction into the mainstream of commercial games came largely through the vision of a single passionate Angband fan.

Angband's items aren't entirely colour-coded by their rarity, just by category... 
...However, artifacts are set apart by their names that glow in light blue. Might this choice be inspired by Bilbo's glowing sword, Sting?



The roots of loot

Like its predecessor Moria (1983), Angband is an unoffical Tolkien fangame, pitting the player against Sauron and Morgoth. (It got away with this by being free and open-source; don't try doing this in a for-profit game.)

The Monsters & Treasure booklet.

In the procedurally generated halls of Morgoth's fortress, the player can chance upon a variety of items on the floor or dropped by slain enemies. The item drops are randomly determined. There's nothing unique about this in itself, of course - the same could be said for Rogue (1980) and, in fact, pen-and-paper roleplaying games starting with the very first publication of Dungeons & Dragons (1974).

From the very beginning, the methods of generating loot were quite complex. In the original D&D game's second booklet, Monsters & Treasure, each monster is given a treasure type, for example: Giant, 5,000 GP + Type E. This indicates a giant lair will contain at least five thousand gold coins worth of treasure, plus potentially other things determined by a series of dice rolls on row E of the treasure types table. The table lists chances for several categories of treasure, each of which is rolled separately: separate chances for each type of coin, gems, and, finally, "Maps or Magic". For Type E, the entry for this last category reads:

30%: any 3 + 1 Scroll

(Gygax & Arneson. Vol 2. p. 22, Dungeons & Dragons. TSR, 1974.)

This means that the dungeon master rolls a d100, and on a result of 1-30, magic items are present. If so, the DM then proceeds to roll on the magic item lists: once on the Scrolls table to determine the type of the scroll, and three rolls for the other items of randomly determined categories (swords, potions, wands, etc.).

Treasure Type E, used for giants, elves, and some of the more dangerous undead.


 
So this all adds up to the dungeon master making up to 15 rolls generate the treasure in a giants' lair. That's the worst case scenario, of course - but, on top of those rolls, some items have further details to be determined: if the scroll is a spell scroll, then the spells written on it will need to be determined, and so on...

It's quite an involved process, and has not grown particularly more complex in later games - at least as long as a human brain and a pencil are used to do the generating. (Of course, a game master is not beholden to these guidelines, and may choose to instead place items using their own judgment.)

When computers began to be used for generating dungeons, they had no such limitations: a computer can make thousands of simulated die rolls a second. Now, the greater challenge lies in designing the rules in such a way as to generate results that are interesting, varied, and balanced, even after countless repetitions. On the other hand, the computer does not have the benefit of using common sense or imagination. It cannot choose to occasionally ignore a rule here and there, scrap a nonsensical result, or suddenly create an entirely novel type of item. The designer must specify all the rules and parameters exactly.

In the same D&D booklet, rules for magic swords were described. Swords were unique among magic weapons in that they could have personalities: the sword's alignment was rolled, as well as values for its intelligence and egoism. These were numeric statistics similar to those of player characters. If the sword's intelligence was sufficiently high, it was sentient and communicated telepathically, and potentially had a number of randomly chosen special powers such as detecting magic, flight, or telekinesis.

Sentient swords with a high egoism score were able to exert their influence on the wielder, initiating a battle of wills. Mechanically, this was a contested roll using the sword's egoism statistic against the wielder's statistics, with the winner gaining control over the other. These rules for mental conflict were designed to emulate the cursed swords in literature - specifically, Elric of Mélnibone's struggles with his runeblade Stormbringer in the many stories written by Michael Moorcock.

 
Randarts: Stormbringer goes electric

So, if loot has been randomly scattered throughout the dungeon in RPGs ever since RPGs existed, what made Angband so unique in its day? How did it impact the history of video games far beyond the roguelike genre, starting with Diablo (1997) and World of Warcraft (2004), like I claimed earlier?

The key innovation of Angband was randomly generated artifacts or "randarts". This feature is arguably what made Diablo such an addictive game - and a game that printed money for Blizzard Entertainment and has been a part of their winning formula ever since.

Angband's randarts can get quite elaborate.
A weapon of Epic rarity in World of Warcraft.
 

 


 

 

 

 


Randarts took a base item, such as a dagger or a tower shield, and modified it by adding multiple properties or "intrinsics", often with further randomized numeric values, some activated powers, and so on. By laying these randomized properties on top of each other in different combinations, an effectively endless variety of equipment is generated. For example:

the Mace 'Taratol' (3d4) (+12,+12)
Slays dragons (powerfully). Branded with lightning. Provides immunity to lightning. Cannot be harmed by acid, fire. When activated, it hastens you for d20+20 turns.

These randomly named artifacts were supplemented by fixed artifacts from the Tolkien legendarium, such as the Phial of Galadriel. Additionally, there were randomly-created magic items with no proper names but which appended a suffix  "...of X" to the item's name:

Iron Helm of Seeing
Chain Mail of Resistance
Mithril Arrows of Frost

The "X of Y" naming is immediately recognizable to anyone who has played an MMORPG. Of course, many of these properties were directly copied from D&D as well. In the Angband fandom, and later roguelikes such as Dungeon Crawl: Stone Soup (2006), these properties are called "brands" (cf. "frost brand sword") for weapons, or more generally, "egos"

I was unable to find any direct source stating that the "ego" terminology in these games has its origins in the "egoism" statistic  (in later editions, "Ego" score) of D&D's sentient weapons. But I think the lineage is pretty evident here, and this connection can probably be assumed.

Nevertheless, compared to pen-and-paper games, the huge amount of combinations that was possible through computer algorithms took the loot lottery to a whole new level, and is the secret sauce that made Diablo so popular and influential.

The devil in the design

"Having realtime combat was an unusual thing." -David Brevik

           (GI Show. Game Informer.  YouTube. May 2019.)

The other unique feature of Diablo behind its popularity is its real-time gameplay. This was relatively rare in computer RPGs of the 90s, and the hack-and-slash games that did exist were often first-person affairs such as Might and Magic VI (1998) or The Elder Scrolls II: Daggerfall (1996). However, the real-time aspect of Diablo was not present during much of the game's development: in a design document from 1994, the game is described as operating "on a turn-based system", and a complex action-points system is alluded to. The same document reinforces the randomly created dungeons as "the heart" of the game. The roguelike origins of Diablo are immediately obvious.

While the creator of the game, David Brevik, was not afraid of taking some innovative departures from those roguelike roots (such as network-based multiplayer, a simple mouse-based interface, and a business model inspired by Magic the Gathering), there was one leap he was strongly opposed to taking: Diablo would never be a real-time game. In an interview with Ars Technica, he calls it his "his line in the sand" for what the game should be. It was turn-based or bust. It took a very long time for his colleagues and publishers (Blizzard, fresh off the success of the first Warcraft game) to get Brevik to agree to even test the idea.

"I said [to Blizzard], 'What are you guys talking about, no no no, this isn't one of your strategy games. We are really commited to making a turn-based game.' I love the sweat in a turn based game, especially in a roguelike, when you've made a turn, and you're down to one hit point, and you're frantically searching through your inventory ... I really loved that tension. And they said, 'Yeah, but, you know... real-time will be better.' ... There were two or three of us that held out 'til the bitter end."

(Diablo: A Classic Game Postmortem. GDC. YouTube. May 2016.)

When he finally implemented real-time gameplay into the Diablo prototype, Brevik immediately fell in love with it. Development continued on the now-realtime game with renewed excitement, and of course players would come to love the gameplay as well. Still, it is interesting to note that unlike many other roguelike trappings with which Brevik disposed of early on, the turn-based framework was one that he was not willing to let go of.

Diablo.


In an interview with Game Informer (YouTube, around 2h37m), Brevik is asked about the colour-coded loot which has been copied into so many other games. He directly credits Angband as the inspiration:

"What about loot rarity colours? Did you guys take that chart from anywhere, or was that invented in Diablo?"

"That came from a game called Angband. Back in college, I played a lot of roguelike games - including Rogue, which is where the term roguelike comes from. There were kind of different versions of this and there was Tolkien-themed ones ... they had a version called Moria, and somebody else made a version of it called uMoria, and then that changed into this game called Angband...

Anyway, so Angband was a game I played thousands, literally thousands of hours of. It was really the game that Diablo was based on. I wanted to take Angband, that original game, and make a modern version of it.

Because this was an ASCII game, you were the '@' symbol, and you were attacking the letter 'k' ... that was what the game looked like, it was just all letters. But there were different random items that you could get in the game and they had different colours. So if you found a rare one, the text wasn't just grey, it was blue text, and that meant that it was magic! So there were some colour variations to the text - yes, we had colour text back then, this new-fangled colour text stuff... So the idea came from that, and then we kind of expanded on it, but originally the idea came from Angband."   

(GI Show. Game Informer.  YouTube. May 2019.)

These days, Angband is also available with graphics.

Blizzard had a smash hit with Diablo and its sequel, and went on to make World of Warcraft, which was played by basically everyone. The influence of those games is visible in most games made today.

So, there you have it. Way back in the '90s, before the roguelites boom of the 2010s, roguelikes were silently changing the face of mainstream game design. And it was about much more than just randomly generated levels. This example shows that there are many valuable ideas and design patterns that originate in the roguelike genre. And, there may yet be many more that could be borrowed into other genres which the mainstream doesn't know about. In the niches beneath a craggy ASCII exterior, there might still be nuggets of gold, just waiting to be mined.



Sunday 28 March 2021

Randomization in chess and roguelikes

 

Chess960: chess with a random setup

Chess960, also known as Fischer random chess, is a variant of standard Western chess in which the home-rank pieces (that is, all pieces except the pawns) are given random starting positions, making it a type of shuffle chess. Published in 1996, the game has increased in prominence in recent years, with 2019 seeing the first official FIDE World Fischer Random Chess Championship.

The effect of varying the starting positions is to reduce the dependence on memorizing openings. This potentially quite interesting game is sadly marred by sharing a name with its creator, Bobby Fischer, the Holocaust-denying Hitler fanboy of the chess world. To avoid giving this vile man any more respect than he deserves, which is to say none at all, I will be referring to the game as Chess960. "Fischerandom" and "Chess960" are both variant names accepted by chess programs.

 

Using polyhedral dice for Chess960 starting positions

Starting positions are mirrored between the two players, so the randomization process for Chess960 needs to only fill in one player's home rank. The second player's starting positions are implied by the first player's.

The starting positions of the pieces have the following constraints:

  • The player's two bishops must be on squares of opposite colours.
  • The player's king must be between the two rooks (to allow castling as in standard chess).

When a computer is not available, we can use a set of polyhedral dice (sometimes called "roleplaying dice" or "D&D dice") to determine the starting positions.



Image 1. The pawns always start at the same positions.

A rank on a chess board has 8 columns/squares, 4 of each color. Thus, there are 4 possible positions for each bishop. Using polyhedral dice, this can be rolled using two d4 (one of each colour).

Let's assume we rolled a 2 and a 2, placing the bishops on columns c and d.


Image 2. The bishops have been placed.

6 squares remain, and the queen is placed next on any one of them. This can be rolled using a d6.

Let's assume we rolled a 5 on the d6, placing the queen on column g.


Image 3. The queen has been placed.

Then, with 5 squares remaining, the two knights are placed randomly on any of them.

Roll a d10. On a result of 1-5, place the first knight on the corresponding free square, and then the second knight on the next free position immediately to its right. On a result of 6-10, place the first knight in the same way (treating a 6 as a 1, and so on), but place the second knight two free positions to the right, instead of one. Wrap the second knight around, so that if there are no more free positions on the right, start counting from the left again.

So, if our free positions are abefh, then the results on the die correspond to the following placements:

d10 First knight Second knight
1 a b
2 b e
3 e f
4 f h
5 h a
6 a e
7 b f
8 e h
9 f a
10 h b

Let's assume we rolled a 10 on the d10. The knights are then placed on columns h and b - or, equivalently, b and h.

 

Image 4. The knights have been placed in b1 and h1.

The 3 remaining squares can only be filled one way, due to the constraint that the king must be between the rooks.


Image 5. The rooks and king have been placed. All positions have been selected. Now, all that remains is to fill out the other player's positions as a mirror image.

Image 6. The final starting positions for both players. White to play.

There are 4 x 4 x 6 x 10 = 960 different starting positions.

Using our example method of generating these positions with polyhedral dice, four dice are needed: a black d4, a white d4, and a d6 and a d10. Or, you can roll the same d4 two times in sequence, once for each bishop.

The method for determining knight positions given here is only one of many possibilities, chosen here because it avoids rerolls and redundancies and seems like something I could remember. I recommend using any rule which you find easy to remember to avoid having to consult a player aid.

 

Other randomized chess variants

Transcendental chess is another randomized chess variant, invented in 1978 by Maxwell Lawrence, (a full 18 years earlier than Chess960). In transcendental chess, the constraint on the rook and king positions does not apply, and castling is removed. Rather than mirroring the board, each player's positions are determined independently. Additionally, a player may use their first turn to swap two pieces on their back row, instead of making a move. As many setups will have one side starting at an advantage, it will perhaps be sporting to play two games for each setup, changing sides in between.

D-chess is similar to transcendental chess, but rather than playing two games, one player gets to choose the side they think is stronger, and the other player gets the option to swap two pieces and also gets the first move.

 

Is there room for randomization in chess?

Traditional chess is fully deterministic, with no random factors. Everything depends on the players' decisions. In many other games and sports, much of the excitement comes from the combination of luck and skill. Their interplay allows for bold risk-taking and dramatic upsets. Far from the usual derision of chance as a factor that makes skill completely irrelevant, taking the right risks at the right time is a skill in itself. Reacting to unlikely chance occurrences can also be a kind of skill, as can knowing and regulating the impact of uncertainty on one's strategy.

In the Wikipedia article linked above, you can read quotes from chess grandmasters on shuffle chess. Some even go as far as saying it's "the future". Reading between the lines, one can get the impression that the game's lack of excitement and human drama is hampering its public profile and influx of new players. Could adding a chance element make chess a bit... well, less boring?

The interplay of chance and skill in games can be broadly divided into two categories: chance that comes after a player's decision, and that which comes before a player's decision. In other words, "randomness of outcome" or output randomness, and "randomness of setup" or input randomness. For example, a chess variant in which the attacker must roll a die to determine the success of a capture has output randomness. This kind of randomness promotes the correct gauging of risk, but it typically has a very large effect on the game's outcome. 

Meanwhile, a chess variant with randomized starting positions would be in the second category, having input randomness. The initial positions may have a large effect on the odds of wining, but beyond that, the only measure of skill is in how the players react and adapt to this new and surprising situation. The player makes an informed decision, and its result is deterministic.

It may be noted that within board games, the output randomness design pattern is more common in American-style boardgames such as Risk, which often include direct conflict, and combat resolution mechanics resembling wargames or Dungeons & Dragons. There, uncertainty is a tool to heighten drama. European-style games, meanwhile, have little or no output randomness, and typically less hidden information. A Eurogame may include input randomness through a randomized initial setup, but from there onward the players' decisions have largely deterministic results. This typically makes for a game that requires careful planning.

Chess, while considered an early wargame, has neither the elements of dice-based combat resolution nor hidden information (fog of war) featured in many wargames starting with the 19th-century Kriegsspiel. It could be argued that adding input randomness to chess through randomized initial setups would turn it into "a Euro-style boardgame".

 

Genres & generations

Arguably the most important games of the 20th century were chess, poker, and Dungeons & Dragons (in increasing order of randomness). D&D's influence has been huge not only in traditional roleplaying games but also in video games and board games. Its dice-based combat system has been passed down through Rogue, Nethack, Dungeon Crawl, Diablo, Elder Scrolls, Final Fantasy, and so on - essentially, the entire "RPG" videogame genre, and beyond.

Although D&D came from the wargaming tradition, it is a cooperative game, not a competitive one. Unlike D&D and the mostly single-player RPGs it inspired, some games in this lineage are competitive. Dota 2 is a multiplayer game of conflict with quite clear D&D-style elements. Dungeon Crawl: Stone Soup is a single-player game in the roguelike genre which is played in competitive tournament formats.

 

Chesslikes?

Interestingly, while the roguelike genre is known for its large degree of randomness, in recent years there has been more experimentation in minimizing output randomness, removing the dice resolution of combat in favour of deterministic models. What is left is just a randomization of maps - input randomness. Often, the entire map is revealed to the player, reducing hidden information as well. This could be seen as a move towards a "Eurogame-ization" of roguelikes. Examples include 868-HACK, Hoplite, and HyperRogue, in which the levels, enemy positions, and powerups are random, but attacks cannot miss and damage is predictable. These games have been described as abstract roguelikes, "tactical puzzles", or even feeling "chess-like". Here, chess-like is being used as an adjective - for now at least, chesslikes are not a recognized game genre.

But... what if? 

 

Image 7. A screenshot from 868-HACK by Michael Brough. Source.

Chess, with its deterministic head-to-head battles, and roguelikes with their iconically chaotic single-player experiences may seem as far apart as games can be. But at their core, both are games of tactics and strategy that play out on a square grid. Both require geometric pattern recognition - and heapings of experience and knowledge. Both are games that can hold a player's interest for 20 years or more.

Perhaps as chess begins to include more random factors, and roguelikes lessen their output randomness, we will see the two genres move closer and closer until they almost seem to merge. Could we even begin to see roguelikes which play out as a battle between two opposing players? Who knows. The future, for now, is under a fog of war.