# D&D.Sci Dungeoncrawling: The Crown of Command Evaluation & Ruleset

This is a follow-up to [last week's D&D.Sci scenario](https://www.lesswrong.com/posts/boLvvZiRazNqipup7/d-and-d-sci-dungeoncrawling-the-crown-of-command): if you intend to play that, and haven't done so yet, you should do so now before spoiling yourself.

Full generation & evaluation code is available [here](https://raw.githubusercontent.com/aphyer1992/dndsci-dungeoncrawl/main/dungeon_crawl.py) if you are interested, or you can read on.

RULESET
=======

THE PARTY
---------

A party has a combined HP total.  (This represents health but also spells, healing potions, and any other resources a party has). Each adventurer contributes (1 + level) HP to the total, so e.g. a team of 4 Level 3 characters has 16HP.  This HP total drops as the party goes through encounters.  If it hits 0, the party withdraws.

Adventurers come in 6 classes, each with a different combat ability:

*   Fighters have Melee Guard, which helps defend against Melee attacks.  If you have no Fighters, enemies with Melee attacks will charge into melee with your squishy ranged characters and deal double damage.
*   Rangers have Range Guard, which helps defend against Range attacks similarly.
*   Mages have Magic Guard, which helps defend against Magic attacks similarly.
*   Clerics have Healing.  This restores 0.5HP per cleric to the party after each encounter if the party hasn't already retreated, plus provides defense against Undead (see Enemies below).
*   Druids have Wild Empathy. This helps defend against Beasts (see Enemies below).
*   Rogues have Cowardice.  This is useless to the party, but makes them tend to show up to lower-level dungeons and not to higher-level ones, so a rogue will usually be higher-level than the dungeon they are encountering.

Encounters have two types: Traps and Enemies.

TRAPS
-----

All traps work the same way: they deal 1d6 damage, reduced by the level of the highest-level appropriate adventurer in your party (to a minimum of 0):

*   Fighters counter Boulder Traps, smashing boulders with their great strength.
*   Rangers counter Lever Puzzle Rooms, using their bows to shoot levers from afar and to fire grappling hooks across the room.
*   Mages counter Riddle Doors, solving the riddles with their keen intellect.
*   Clerics counter Cursed Altars, dispelling the evil magicks upon them.
*   Druids counter Snake Pits, making friends with the snakes.
*   Rogues counter Poison Dart Traps, disarming them in order to steal the poison darts.

So if your party has a Level 4 Fighter,  a Level 3 Fighter, a Level 3 Cleric, and a Level 1 Mage:

*   A Boulder Trap will do 1d6-4 damage (the higher-level fighter is counted, the lower-level one is ignored).
*   A Cursed Altar will do 1d6-3 damage.
*   A Riddle Door will do 1d6-1 damage.
*   A Snake Pit, Lever Puzzle Room or Poison Dart Trap will do 1d6 damage.

If you have a Level 6 character, you will take no damage from the associated trap type.  Beyond this there's less benefit to increased level - it gives extra HP to the party, but nothing else.  
 

ENEMIES
-------

A list of the enemies:

| Enemy | Damage | Attack Type | Notes |
| --- | --- | --- | --- |
| Goblins | 1d3 | Range |     |
| Goblin Chieftain | 1d4 | Melee |     |
| Orcs | 1d4 | Melee |     |
| Wolves | 1d4 | Melee | Beast |
| Orc Shaman | 1d6 | Magic |     |
| Orc Warlord | 1d8 | Melee |     |
| Skeletons | 1d3 | Range, Magic | Undead |
| Zombies | 1d3 | Melee, Magic | Undead |
| Ghosts | 1d4 | Magic | Undead |
| Basilisk | 1d8 | Melee, Magic | Beast |
| Lich | 1d10 | Magic | Undead |
| Dragon | 2d6 | Melee, Range, Magic |     |

When you encounter an enemy, it rolls its Damage. (So Orcs roll 1d4, and might do e.g. 3 damage).

If it is using an attack type you do not have defense against, that damage is doubled.  (So if you have no Fighter, the Orcs above will instead do 6 damage).

If an enemy has multiple attack types, you must have defense against them all to avoid taking double damage - so a Dragon will deal double damage unless you have all three defenses - but it can only double once, even if you are missing multiple defenses.

This is unaffected by the level of the character granting the defense - higher overall level gives more party HP to absorb damage, but e.g. when fighting against Orcs there's no difference between a Level 1 Fighter + Level 7 Mage vs a Level 7 Fighter + Level 1 Mage.

Clerics can use their healing magic against Undead: if you have at least one Cleric, that can count as any one form of defense you are otherwise missing against any Undead enemy.

Druids can use Wild Empathy to convince beasts not to attack: before doubling, reduce any damage suffered from Beasts by the level of the highest-level Druid in your party.

  
  
 
-------

DATASET GENERATION
==================

Dungeons come in three varieties:

*   **Monster Camps** are organized groups of a single kind of monster.
    *   They can be either Goblin, Orc , or Undead.
    *   This will be given in the name, e.g. 'Orc Keep', 'Undead Sepulcher', 'Goblin Warrens'
    *   The camp will have 2d4 encounters with that type of enemy, the last of which will usually be a tougher boss enemy.
    *   The camp then picks a trap type to build as its defense.  Every 2 enemies in the camp build 1 trap of that type.
*   **Lairs** are places where a single powerful monster makes its lair:
    *   The powerful monster will be the last encounter.  It can be a Basilisk, Lich or Dragon (leading to slightly different names).
    *   In addition, there are 1d3 encounters with its minions (it will pick a random enemy type and enslave them as its servants).  Liches will always have Undead servants.
    *   There are also 1d3 traps (of any variety of kinds).
*   **Ruins** are remnants of old civilization.  You can encounter a wide variety of things there:
    *   There will be 2d3 traps (of any variety of kinds).
    *   There will also be 1d4 enemies.  Undead are most common, but almost any enemy can in theory be encountered in a ruin.

Adventurers then approach these dungeons.  Adventurers are usually pretty good at guessing (from rumors about a dungeon, the number of villages laid waste near it, etc.) how threatening it will be, and adventurers of around the right level will approach it. Adventurers somewhat underestimate Goblins in general, and tend to attempt their dungeons at lower-level than they should (**abstractapplic** is the first person I think to notice this one).

  
  
STRATEGY
==============

Once you understand how the system works, general strategy is:

*   Try to have in your party the defense types that counter enemy attack types to avoid taking double damage (or a Cleric can help with this against Undead).  The characters doing this can be of any level.
*   Try to have in your party the classes that counter traps that are present.  The characters doing this need to be high-level.
*   If there are Beasts to fight, bring a Druid (again high-level).
*   If you don't need any other characters, extra Clerics (of any level) are valuable for healing.  Duplicate Clerics can be valuable, while duplicates of other classes never are.

With perfect play, it is possible to reach 100% win rate on all three dungeons using 36,000gp.  This requires going beyond the bounds of the parties you've seen and building parties with weirdly artificial level differences, though.  A more realistic goal of 'selecting optimal classes while bringing all Level 3 adventurers' achieves a 85.75% overall win rate, with most of the loss probability coming from the risk of unlucky rolls against the Dragon in the Infernal Den of Cheliax.

The Lost Temple of Lemarchand
-----------------------------

This is a Ruin-type dungeon.  All encounters in this were known.  

*   You want to bring a Druid and a Rogue for the Snake Pit and Poison Needle Traps.
*   You want to avoid taking double-damage from Skeletons, Zombies, and Ghosts.  The only way to do this with two characters is one Mage (who counters Magic) and one Cleric (whose ability to counter Undead will work on either of the other attack types).
*   The Mage and the Cleric can be any level, the Druid and Rogue should be high-level to counter traps.
*   A party of Druid5, Rogue5, Mage1, Cleric1 (12 levels in total) is guaranteed to win:
    *   Maximum possible damage taken is 3 each from Skeletons (twice) and Zombies (once), 4 from Ghosts (once), and 1 from each trap (four times), for a total of 17.
    *   You start with 16HP.
    *   Additionally, you will receive 3HP of meaningful healing over the course of the adventure.
*   A party of Druid3, Rogue3, Mage3, Cleric3 has a 98.80% win-rate.

The Infernal Den of Cheliax
---------------------------

This is a Lair-type dungeon.  The final encounter is listed as 'Unknown'.  However, it is guaranteed to be a Dragon (the 'Infernal' prefix shows up only with Dragon or Lich, and a Lich will use Undead rather than Orcs as servants.  Congratulations to **measure**, who posted a mostly-complete explanation of what encounters would be in this and the next dungeon.

*   You want to bring a high-level Druid for the Wolves and Snake Pits.
*   In order to avoid taking double-damage from the Dragon, you need to bring a Fighter, a Ranger and a Mage (of any level).
*   Total level needs to be high enough to absorb potentially high damage.
*   A party of Druid6, Fighter3, Ranger2, Mage2 (13 levels in total) is guaranteed to win.  You can also distribute levels differently so long as the druid is at least Level 6:
    *   Maximum possible damage taken is 4 from the Orcs and 12 from the Dragon, for a total of 16.
    *   You start with 17HP.
*   A party of Druid3, Fighter3, Ranger3, Mage3 has an 87.88% win rate.

The Goblin Warrens of Khaz-Gorond
---------------------------------

This is a Monster Camp-type dungeon.  Most encounters in this were listed as 'Unknown.'  However, based on the generation algorithm they are fully predictable except for the order: there will be 3 Boulder Traps, 6 Goblins, and one Goblin Chieftain at the end.  (Each Goblin camp only builds one type of trap, and while some smaller camps have no Chieftain any camp with 6+ Goblins will have one).

*   You want to bring a Ranger (of any level) to avoid taking double-damage from tons of Goblins.
*   You want to bring a Fighter (ideally high-level) to reduce damage from Boulder Traps and avoid taking double-damage from the Goblin Chieftain.
*   Since you don't have any other classes you really need, but the adventure is really long, Clerics will help keep your HP high.
*   A party of Fighter6, Ranger3, Cleric1, Cleric1 (11 levels in total) is guaranteed to win.  You can also distribute the Ranger's second and third level to any other character:
    *   Maximum possible damage is 3 damage from each Goblin (six times) plus 4 from the Chieftain (once), for a total of 22.
    *   You start with 15HP.
    *   Additionally, you will receive at least 8 (and usually 9) points of meaningful healing.
*   A party of Fighter3, Ranger3, Cleric3, Cleric3 has a 98.76% win rate.

  
  
LEADERBOARD
=================

*Note: win rates below were Monte-Carlo derived rather than explicitly calculated.*

Current leaderboard:

| **Submitter** | **Lost Temple of Lemarchand** |   | **Infernal Den of Cheliax** |   | **Goblin Warrens of Khaz-Gorond** |   | **Total** |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Fully Optimal Play | D5, Ro5, M1, C1 | 100.00% | D6, F3, Ra2, M2 | 100.00% | F6, Ra2, C1, C1 | 100.00% | 100.00% |
| Optimal Class Allocation | D3, Ro3, M3, C3 | 98.80% | D3, F3, Ra3, M3 | 87.88% | F3, Ra3, C3, C3 | 98.76% | 85.75% |
| abstractapplic | D2, Ro2, M2, C2 | 50.45% | D3, F5, Ra3, M3 | 96.43% | F4, Ra4, F3 C3 | 99.27% | 48.29% |
| simon | D2, Ro2, M2, C3 | 62.40% | F4, Ra4, C3, D4 | 71.22% | F4, R3, R3, D3 | 58.12% | 25.83% |
| Yonge | D2, Ro2, M2, C3 | 62.40% | F7, Ra3, D2, C2 | 42.16% | Ra6, F4, C2, Ro1 | 97.97% | 25.77% |
| Taleuntum | Ra1, Ro1, C4, M4 | 22.54% | M1, F3, D4, Ra5 | 98.35% | F3, Ra3, Ro3, C4 | 90.09% | 19.97% |
| Measure | F1, M1, C3, D1 | 0.80% | F4, Ra3, M7, C4 | 88.07% | F3, F2, Ra3, C4 | 83.57% | 0.59% |
| Adventurer's Guild | 4 random Level 3s | 27.26% | 4 random Level 3s | 14.31% | 4 random Level 3s | 10.20% | 0.40% |

Congratulations to those who successfully assembled the Crown of Command and became the Tyrant of Calantha, reigning with an iron fist until at last a desperate team of heroes was able to topple you and restore freedom to the nation once more.  **abstractapplic** has the highest win-rate here: if a future scenario needs an evil god-tyrant in it, I'll know who to put there.

Condolences to those who failed at this goal, and were doomed to a life of squalor with only a few thousand servants at your command.

For any future players who want to test their performance, you can edit and run the following lines in the code to include and test your proposed teams:

> specific\_team\_test_runs = True  
> if( specific\_team\_test_runs == True):  
>    my_world = World(log=False)  
>    runs = 0  
>    wins = 0  
>    losses = 0  
>    while runs < 50000:
> 
>           
>        #lots of teams commented out here  
>        #string_party = \[('Mage', 3), ('Cleric', 3), ('Rogue', 3), ('Druid', 3)\]   # Class based LTL  
>        #string_party = \[('Fighter', 3), ('Ranger', 3), ('Mage', 3), ('Druid', 3)\]  # Class based ITC  
>        string_party = \[('Ranger', 3), ('Fighter', 3), ('Cleric', 3), ('Cleric', 3)\] # Class based GWK  
>        party = my\_world.get\_party\_by\_name\_and\_levels( \[(x\[0\], x\[1\]) for x in string_party\] )  
>        dungeon = Dungeon(my_world)  
>        #dungeon.encounter_names = \[ 'Skeletons', 'Skeletons', 'Poison Needle Trap', 'Zombies', 'Snake Pit', 'Poison Needle Trap', 'Ghosts', 'Snake Pit' \]   
>        #dungeon.encounter_names = \[ 'Snake Pit', 'Orcs', 'Snake Pit', 'Wolves', 'Dragon' \]  
>        dungeon.encounter_names = \[ 'Goblins', 'Boulder Trap', 'Goblins', 'Goblins', 'Boulder Trap', 'Goblins', 'Goblins', 'Boulder Trap', 'Goblins', 'Goblin Chieftain' \]  
>        dungeon.get\_encounters\_by_name()  
>        party.run_dungeon(dungeon, log=False)  
>        if party.current_hp > 0:  
>            wins = wins + 1  
>        else:  
>            losses = losses + 1  
>        runs = runs + 1  
>    print('Won {}/{} ({:.2f}%)'.format(wins, runs, wins * 100 / runs))

or if you aren't familiar with the code you can DM me and I can run for you.

  
  
FEEDBACK REQUEST
======================

As usual, I'm interested in feedback.  If you played the scenario, what did you like and what did you not like?  If you might have played but in the end did not, what scared you away?

Additionally, if anyone who's played a few of these is willing to sign up to take a look at the text & first few rows of the data of future scenarios I write before I post them, I would really appreciate it.  (I don't think the LW 'Get Feedback' option is quite meant for this use case).  I'm interested to know in advance things like:

*   The problem statement is confusing and you should reword it.
*   The data looks mistaken and you should fix it.
*   The data is formatted inconveniently and you should supply columns XYZ.
*   Everything looks much too complicated and you should go back to the drawing board.  This is meant to be Dungeons and Data Science, not Dark Souls and Data Science.

 If you are willing to do this, I can't offer to pay you anything, but I can offer you ~~the rulership of all Asia~~ ~~the love of Helen of Troy~~ your name credited for help in the scenario.  If this somehow seems like a good deal to you, let me know and I'll message you when I have something for you to look at.

Thanks for playing!