dcss-ai-wrapper’s documentation

Quickstart

Clone the repository:

git clone https://github.com/dtdannen/dcss-ai-wrapper.git

Change directory to the new dcss-ai-wrapper folder:

cd dcss-ai-wrapper/

Create a virtualenv and install packages:

python3 -m venv .env

On Linux in the shell:

source .env/bin/activate

Or on Windows from powershell:

./.env/Scripts/Activate.ps1

Then to install all packages into this virtualenv:

pip install -r requirements.txt

And do a pip install of the project in develop mode so you can change files in between running agents:

pip install -e .

Using Docker to run the Webserver

There are two ways to run the webserver via docker: build the webserver docker yourself (option 1) or use a premade image (option 2).

(Option 1) Build the docker image yourself:

cd webserver_docker/
docker build .

It will take a few minutes to compile. Once it finishes, run:

docker images

to find the newly created image, and copy the IMAGE ID value. Then launch the docker:

docker run -p 8080:8080 <paste image_id here>

(Option 2) Use a pre-made Docker image

Pull a pre-made docker image with the DCSS webserver installed (if you’d like to create your own docker or install DCSS yourself, see Installation):

docker pull dtdannen34/dcss-ai-wrapper:webtilesserver

Run the docker and open an interactive shell:

docker run -it -p 8080:8080 b3d5cdf181b8

Now launch the webserver from within the docker interactive shell by first activating python environment and then running the webserver:

cd /dcss/crawl/crawl-ref/source/webserver
source venv/bin/activate

Then run the webserver:

cd ..
python webserver/server.py

Register the agent on the docker webserver via the browser

Now you can leave the docker alone, as long as it keeps running, agents can connect and play the game.

Open your browser to http://localhost:8080/ to the DCSS browser interface, which should look like:

_images/dcss_browser_screenshot_1.png

Click on the ‘Register’ button and create an account with the following values:

  • Username: midca

  • Password: midca

  • Repeat password: midca

  • Leave the Email Address field blank

_images/dcss_browser_screenshot_2.png

Then click ‘Submit’.

By default you’ll be logged in on the browser but it’s recommended for you to be logged out so go ahead and click the ‘Logout’ button.

Note: Do not login on the browser yourself, creating the account is so that the agent in the API can connect and play. You will spectate the agent without logging in yourself.

Open a new terminal, navigate to dcss-ai-wrapper, activate the virtual environment, and try running an agent:

cd dcss-ai-wrapper/

On Linux in the shell:

source .env/bin/activate

Or on Windows from powershell:

./.env/Scripts/Activate.ps1

Now you can run the random agent by running the following from the project root: dcss-ai-wrapper/

python .\src\dcss\agent\randomagent.py

Within 1-2 seconds you should see the agent show up in the lobby of the web browser, something like this:

_images/dcss_browser_screenshot_3.png

Wait for the agent to get past the character creation menus (there’s a strange bug that appears if you spectate too early - this should only take a few seconds), then click on the agent’s name, which in this case is ‘midca’. You will now be spectating the agent, for example:

_images/dcss_browser_screenshot_4.png

Now you’re all set to go with the SimpleRandomAgent being able to play the game! The rest of this README file contains additional details on using the DCSS AI Wrapper.

Installation

Installing Dungeon Crawl Stone Soup

Building on Docker

The docker that is available for download can be built using the dockerfile in webserver_docker/:

cd ~/dcss-ai-wrapper/webserver_docker/

docker build .

Compiling from Source on Ubuntu

Note that these instructions were adapted from https://github.com/crawl/crawl/blob/master/crawl-ref/INSTALL.md

  1. Install system packages:

    sudo apt install build-essential libncursesw5-dev bison flex liblua5.1-0-dev libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 python2 make libsdl2-image-dev libsdl2-mixer-dev libsdl2-dev libfreetype6-dev libpng-dev fonts-dejavu-core advancecomp pngcrush git python3.8-venv

  2. Clone the repository including submodules:

    git clone --recurse-submodules -j8 https://github.com/crawl/crawl.git crawl/
    
  3. Compile crawl:

    cd crawl/crawl-ref/source/
    make install prefix=/usr/local WEBTILES=y
    
  4. Create an RCS directory that’s used to hold player data:

    mkdir /dcss/crawl/crawl-ref/source/rcs/
    

Old Instructions

NOTE These instructions have not been tested for a while. I have included these instructions in case it helps you to use the terminal version of the game. The current best way to use the API is using the pre-made docker container - see Quickstart.

While this API is likely to work with the current dcss master branch, it has been tested with the 23.1 version, which is the recommended version of crawl to use with this API. We recommend installing a local version of crawl inside this project’s folder.

  1. Make sure you have cloned this repository (dcss-ai-wrapper)

  2. Grab a copy of the 23.1 version of crawl, by cloning the repo and then resetting to the 23.1 version:

    cd ~/dcss-ai-wrapper/ # assuming this is the directory where you cloned this project - dcss-ai-wrapper)

    git clone https://github.com/crawl/crawl.git

    cd ~/dcss-ai-wrapper/crawl/

    git reset –hard d6e21ad81dcba7f7f8c15336e0e985f070ce85fb

    git submodule update –init

  3. Compile crawl with the following flags:

    cd ~/dcss-ai-wrapper/crawl/crawl-ref/source/
    
    sudo make install prefix=/usr/local/ WEBTILES=y
    
    __Note for installing on Ubuntu 20.04:__
    
    If you get an error saying "/usr/bin/env cannot find python", then one possible fix is to the do the following (but beware this may change the default python on your system)
    
    `sudo ln --symbolic /usr/bin/python2.7 /usr/bin/python`
    
    Note that Python2.7 is needed to compile crawl.
    
  4. Check that the `crawl/crawl-ref/source/rcs’ folder exists, if not create it:

    mkdir crawl/crawl-ref/source/rcs
    

How to Run a simple agent in the terminal

  1. Open a new terminal, cd into dcss-ai-wrapper/ and run:

    First time running the following script may require:

    chmod +x start_crawl_terminal_dungeon.sh

    otherwise

    ./start_crawl_terminal_dungeon.sh

    Note that nothing will happen until an agent connects.

    The terminal that runs this command must be a minimum width and height, so try enlarging the terminal if it doesn’t work and you are using a small monitor/screen. (Only try changing the width if the next step fails).

  2. Open a new terminal, cd into dcss-ai-wrapper/ and run:

    python3 main.py
    
  3. You should now be able to watch the agent in the terminal as this script is running, as shown in the demo gif at the top of this readme.

Creating an Agent

Creating an agent is as simple as subclassing the BaseAgent class. The most important part is to override the get_action() function, which is where you obtain the game state object. The return value of the function will be the next action that gets executed by the dcss-ai-wrapper API in the current game of DCSS that the agent is playing.

 1from dcss.agent.base import BaseAgent
 2from dcss.state.game import GameState
 3from dcss.actions.action import Action
 4
 5import random
 6
 7
 8import time
 9
10
11
12class MyAgent(BaseAgent):
13
14    def __init__(self):
15        super().__init__()
16        self.gamestate = None
17        self.start_time = time.time()
18        self.num_actions_sent = 0

And then to run the agent, you need to create a WebSockGame object with the agent class, like this:

 1from dcss.websockgame import WebSockGame
 2from dcss.connection.config import WebserverConfig
 3
 4        self.gamestate = gamestate
 5        # get all possible actions
 6        actions = Action.get_all_move_commands()
 7        # pick an action at random
 8        self.num_actions_sent +=1
 9        print("Actions per second = {}".format(self.num_actions_sent / (time.time() - self.start_time)))
10        return random.choice(actions)
11
12
13if __name__ == "__main__":

The full example can be found in src/dcss/agent/randomagent.py:

 1from dcss.agent.base import BaseAgent
 2from dcss.state.game import GameState
 3from dcss.actions.action import Action
 4
 5from dcss.websockgame import WebSockGame
 6from dcss.connection.config import WebserverConfig
 7
 8import random
 9
10from loguru import logger
11
12import time
13
14
15
16class MyAgent(BaseAgent):
17
18    def __init__(self):
19        super().__init__()
20        self.gamestate = None
21        self.start_time = time.time()
22        self.num_actions_sent = 0
23
24    def get_action(self, gamestate: GameState):
25        self.gamestate = gamestate
26        # get all possible actions
27        actions = Action.get_all_move_commands()
28        # pick an action at random
29        self.num_actions_sent +=1
30        print("Actions per second = {}".format(self.num_actions_sent / (time.time() - self.start_time)))
31        return random.choice(actions)
32
33
34if __name__ == "__main__":

Moving On

Next we look at the state representations available from the GameState object.

State Representations

dcss-ai-wrapper offers multiple state representations to support multiple types of AI agents.

Vector-based Representations

Vector-based representations are available as a python list data type containing values where the index of the list corresponds to the feature. The complete specification is listed below, per category of data describing the state (i.e. player stats, map data, etc.).

PDDL-based Representations

Planning Domain Definition Language (PDDL) is a relational, symbolic logic state representation. The following state data is available via functions that return a set of PDDL facts, that are aligned with the PDDL domain file found under models/fastdownward_simple.pddl.

API: Vector-based Representations

Player stats (vector)

src.dcss.state.game.GameState.get_player_stats_vector(verbose=False)

The following player stats are returned by this function:

Vector Index

Description of Data

Data Type if available

0

health

Int

1

health_max

Int

2

health_max_real

Int

3

mana_points

Int

4

mana_points_max

Int

5

mana_points_real

Int

6

AC

Int

7

EV

Int

8

SH

Int

9

Str

Int

10

Str max

Int

11

Int

Int

12

Int max

Int

13

Dex

Int

14

Dex max

Int

15

XL

Int

16

Experience until next level

0-100 percentage

14

God

Int

15

Piety Level

Int

16

Spell slots left

Int

17

gold

Int

18

rFire

Int

19

rCold

Int

20

rNeg

Int

21

rPois

Int

22

rElec

Int

23

rCorr

Int

24

MR

Int

25

Stealth

Int

26

HPRegen per turn

Float

27

MPRegen per turn

Float

28

See invisible

Boolean

30

Faith

Boolean

31

Spirit

Boolean

32

Reflect

Boolean

33

Harm

Boolean

34

game turns

Float

35

game time

Float

36

attack speed

Int

37

movement speed

Int

169

Player Place (Dungeon, Vaults, etc.)

Boolean

38

Agile status effect

Boolean

39

Antimagic status effect

Boolean

40

Augmentation status effect

Boolean

41

Bad Forms status effect

Boolean

42

Berserk status effect

Boolean

170

Unable to Berserk status effect

Boolean

43

Black Mark status effect

Boolean

44

Blind status effect

Boolean

45

Brilliant status effect

Boolean

46

Charm status effect

Boolean

47

Confusing Touch status effect

Boolean

48

Confusion status effect

Boolean

49

Constriction status effect

Boolean

50

Cooldowns status effect

Boolean

51

Corona status effect

Boolean

52

Corrosion status effect

Boolean

53

Darkness status effect

Boolean

54

Dazed status effect

Boolean

55

Death Channel status effect

Boolean

56

Death’s Door status effect

Boolean

57

Deflect Missiles status effect

Boolean

58

Disjunction status effect

Boolean

59

Divine Protection status effect

Boolean

60

Divine Shield status effect

Boolean

61

Doom Howl status effect

Boolean

62

Drain status effect

Boolean

63

Engorged status effect

Boolean

64

Engulf status effect

Boolean

65

Fast+Slow status effect

Boolean

66

Fear status effect

Boolean

67

Finesse status effect

Boolean

68

Fire Vulnerable status effect

Boolean

69

Flayed status effect

Boolean

70

Flight status effect

Boolean

71

Frozen status effect

Boolean

72

Haste status effect

Boolean

73

Heavenly Storm status effect

Boolean

74

Held status effect

Boolean

75

Heroism status effect

Boolean

76

Horrified status effect

Boolean

77

Inner Flame status effect

Boolean

78

Invisibility status effect

Boolean

79

Lava status effect

Boolean

80

Leda’s Liquefaction status effect

Boolean

81

Leda’s Liquefaction status effect

Boolean

82

Magic Contamination status effect

Boolean

83

Mark status effect

Boolean

84

Mesmerised status effect

Boolean

85

Might status effect

Boolean

86

Mirror Damage status effect

Boolean

87

No Potions status effect

Boolean

88

No Scrolls status effect

Boolean

89

Olgreb’s Toxic Radiance status effect

Boolean

90

Orb status effect

Boolean

91

Ozocubu’s Armour status effect

Boolean

92

Paralysis status effect

Boolean

93

Petrifying/Petrified status effect

Boolean

94

Poison status effect

Boolean

95

Powered by Death status effect

Boolean

96

Quad Damage status effect

Boolean

97

Recall status effect

Boolean

98

Regenerating status effect

Boolean

99

Repel Missiles status effect

Boolean

100

Resistance status effect

Boolean

101

Ring of Flames status effect

Boolean

102

Sapped Magic status effect

Boolean

103

Scrying status effect

Boolean

104

Searing Ray status effect

Boolean

105

Serpent’s Lash status effect

Boolean

106

Shroud of Golubria status effect

Boolean

107

Sickness status effect

Boolean

108

Silence status effect

Boolean

109

Silence status effect

Boolean

110

Sleep status effect

Boolean

111

Slimify status effect

Boolean

112

Slow status effect

Boolean

113

Sluggish status effect

Boolean

114

Starving status effect

Boolean

115

Stat Zero status effect

Boolean

116

Sticky Flame status effect

Boolean

117

Still Winds status effect

Boolean

118

Swiftness status effect

Boolean

119

Teleport Prevention status effect

Boolean

120

Teleport status effect

Boolean

121

Tornado status effect

Boolean

122

Transmutations status effect

Boolean

123

Umbra status effect

Boolean

124

Vitalisation status effect

Boolean

125

Vulnerable status effect

Boolean

126

Water status effect

Boolean

127

Weak status effect

Boolean

128

Acute Vision mutation

Boolean

129

Antennae mutation

Boolean

130

Beak mutation

Boolean

131

Big Wings mutation

Boolean

132

Blink mutation

Boolean

133

Camouflage mutation

Boolean

134

Clarity mutation

Boolean

135

Claws mutation

Boolean

136

Cold Resistance mutation

Boolean

137

Electricity Resistance mutation

Boolean

138

Evolution mutation

Boolean

139

Fangs mutation

Boolean

140

Fire Resistance mutation

Boolean

141

High MP mutation

Boolean

142

Hooves mutation

Boolean

143

Horns mutation

Boolean

144

Icy Blue Scales mutation

Boolean

145

Improved Attributes mutation

Boolean

146

Iridescent Scales mutation

Boolean

147

Large Bone Plates mutation

Boolean

148

Magic Resistance mutation

Boolean

149

Molten Scales mutation

Boolean

150

Mutation Resistance mutation

Boolean

151

Passive Mapping mutation

Boolean

152

Poison Breath mutation

Boolean

153

Poison Resistance mutation

Boolean

154

Regeneration mutation

Boolean

155

Repulsion Field mutation

Boolean

156

Robust mutation

Boolean

157

Rugged Brown Scales mutation

Boolean

158

Shaggy Fur mutation

Boolean

159

Slimy Green Scales mutation

Boolean

160

Stinger mutation

Boolean

161

Strong Legs mutation

Boolean

162

Talons mutation

Boolean

163

Tentacle Spike mutation

Boolean

164

Thin Metallic Scales mutation

Boolean

165

Thin Skeletal Structure mutation

Boolean

166

Tough Skin mutation

Boolean

167

Wild Magic mutation

Boolean

168

Yellow Scales mutation

Boolean

Returns:

A list of features representing the player’s stats

Player inventory (vector)

src.dcss.state.game.GameState.get_player_inventory_vector()

Player has 52 inventory slots corresponding to each lowercase and uppercase letter of the English alphabet.

Each item is represented by a vector of size 7:

Vector Index

Description of Data

Data Type if available

0

Item type

1

quantity

Int

2

Item Bonus

Int

3

Is Equipped

Boolean

4

First property

5

Second property

6

Third property

Returns:

a list of size 364 (52 inventory items each represented with 7 features shown above)

Player spells (vector)

src.dcss.state.game.GameState.get_player_spells_vector()

Player has a maximum of 21 spell slots for spells to be learned.

Each of these 21 spells slots is represented by a vector of 3 values:

Vector Index

Description of Data

Data Type if available

0

Spell ID.

Int repr. spell ID

1

Spell SkillName

Int repr. skill ID

2

Spell SkillName #2

Int repr. skill ID

3

Spell SkillName #3

Int repr. skill ID

4

Failure Likelihood

Int 0-100

5

Spell Level

Int

Additionally, there are 118 spells that can be learned if the player has found a book item with a given spell, therefore we need an additional 118 slots in this vector representing whether each spell is available to be learned.

Returns:

a list of size 21*6 + 118.

Player abilities (vector)

src.dcss.state.game.GameState.get_player_abilities_vector()

There are 94 possible abilities a player may acquire. For each of these abilities, they are represented by the following vector:

Vector Index

Description of Data

Data Type if available

0

Ability is ID

Int repr. spell ID

1

Failure Likelihood

Int 0-100

2

Magic Point Cost

Boolean

3

Piety Point Cost

Boolean

4

Has Delay Cost

Boolean

5

Has Frailty Cost

Boolean

# TODO there are probably more costs (like health, etc) that should end up as additional rows in this table

Returns:

a list of size 94*6.

Player skills (vector)

src.dcss.state.game.GameState.get_player_skills_vector()

Player has 31 skills that increase over time if the player is actively ‘training’ those skills.

Each skill is represented by a vector of size 3:

Vector Index

Description of Data

Data Type if available

0

Current value

Float

1

Training Percentage

Int (0-100)

2

Aptitude

Int

Returns:

a list of size 93

Map data Line-of-Sight (LOS) (vector)

src.dcss.state.game.GameState.get_egocentric_LOS_map_data_vector(radius=7)

Returns a vector containing data on the tiles in a ((radius*2)+1)^2 square centered on the player.

See cell.py get_cell_vector() for a description of what is in each cell vector.

Map data current level (vector)

src.dcss.state.game.GameState.get_egocentric_level_map_data_vector()

Returns a vector containing data on the tiles on the player’s current level.

Uses the same tile representation of vectors of size 34 from get_egocentric_LOS_map_data()

Returns a vector with no upperbound if traveling through levels such as Abyss or Labyrinth. More realistically returns a vector ranging from a minimum size of 7,650 (225 LOS tiles * 34) up to possible sizes of 68,000+ (2000 tiles * 34).

Map data all (vector)

src.dcss.state.game.GameState.get_all_map_data_vector()

Returns a vector containing data on the tiles the player has encountered so far in the game.

Uses the same tile representation of vectors of size 34 from get_egocentric_LOS_map_data()

Returns a vector with no upperbound if traveling through levels such as Abyss or Labyrinth. More realistically returns a vector ranging from a minimum size of 7,650 (225 LOS tiles * 34) up to possible sizes of 3,400,000+ (100,000 tiles * 34).

API: PDDL-based Representations

Player stats (PDDL)

src.dcss.state.game.GameState.get_player_stats_pddl()

Returns PDDL 2.2 level 1 which DOES NOT include all aspects of numeric planning.

PDDL predicates that are provided via this function:

  • playerhealth

  • playermagicpoints

  • player_worshipping

  • player_piety

  • player_has_available_spell_slot

  • player_resist_fire

  • player_resist_cold

  • player_resist_neg

  • player_resist_pois

  • player_resist_elec

  • player_resist_corr

  • player_willpower

  • player_stealth

  • player_see_invis

  • player_faith_status

  • player_spirit_status

  • player_reflect_status

  • player_harm_status

  • player_movement_speed

  • player_attack_speed

  • playerplace

  • player_has_status_effect

  • player_has_mutation

Therefore the following player stats aren’t available.

Player Stat

Description of Data

Why not included?

AC

Represents Armour

Non-relative Int

EV

Represents Evasion

Non-relative Int

SH

Represents Shelf

Non-relative Int

Strength

Current value

Non-relative Int

Intelligence

Training Percentage

Non-relative Int

Dexterity

Aptitude

Non-relative Int

Returns a list of PDDL facts representing player stats

Player inventory (PDDL)

src.dcss.state.game.GameState.get_player_inventory_pddl()

Returns a simple PDDL representation for inventory items that will describe items with the following predicates. Note that this function returns two data objects, first is a list of inventory object names and the second is a list of the pddl facts, as strings, about those objects.

Predicates currently supported: * equipped * cursed * item_bonus (refers to the +3 kinds of bonuses on items) * weapon, scroll, ammunition, potion, or armour (others may be discovered and then must be added here) * only_one_left or more_than_one_remaining

Player skills (PDDL)

src.dcss.state.game.GameState.get_player_skills_pddl()

Skill names as objects are already provided in the PDDL domain file since they are constant across all characters and game modes.

Only PDDL facts about whether each skill has training off, low, or high is returned, and the current value of said skill using qualitative quantifiers of: ‘none’, ‘low’, ‘medium_low’, ‘medium’, ‘medium_high’, ‘high’, ‘maxed’

Map data Line-of-Sight (LOS) (PDDL)

src.dcss.state.game.GameState.get_egocentric_LOS_map_data_pddl(radius=7)

Returns a list of PDDL facts representing the tiles around the player for the given radius. Information about tiles outside of this radius is not returned.

Map data current level (PDDL)

Map data all (PDDL)

src.dcss.state.game.GameState.get_all_map_data_pddl()

Returns a list of PDDL facts for every tile encountered by the player thus far.

Static Background Knowledge (PDDL)

src.dcss.state.game.GameState.get_background_pddl()

Returns a static list of pddl facts, including all type instances and dungeon level connections.

ACS 2022 Tutorial

Note

We will be adding more content to this page between now and the tutorial start. We welcome any and all questions to be asked via the Gitter public chatroom for the dcss-ai-wrapper project here: https://gitter.im/dcss-ai-wrapper/community

Updates:

  • [October 20th] First draft of this tutorial is posted online.

  • [November 20th] The tutorial will be held online using Zoom, more details to follow. See the conference slack channel # tutorial_2022

  • [November 20th] We will use the main ACS conference Zoom link

  • [November 20th] The in-person session will be in Multipurpose room 125

  • [November 21st] The tutorial has been advertised on the dcss subreddit, to attend virtually via Zoom please register here: https://docs.google.com/forms/d/e/1FAIpQLSdxlvtW95NiuozTaVz3Ie0Hbydmn-eCHnxKLGGAnPFa-alqBg/viewform

  • [November 22nd] A few quality-of-life code updates have been pushed to the master branch, you may wish to re-pull the master branch when the tutorial starts if you set up everything more than ~10 hours before the tutorial started.

Introduction

dcss-ai-wrapper aims to enable the Dungeon Crawl Stone Soup (DCSS) video game to be used as an evaluation domain for AI research. While more traditional planning benchmarks exist (i.e. IPC domains) and more traditional RL benchmarks exist (i.e. open-ai gym), it is often difficult to compare an RL agent on IPC domains or a planner on RL domains. DCSS-AI-Wrapper aims to provide support for both automated planning and RL in the DCSS video game.

Annotated Screenshot of DCSS

Annotated Screenshot of Dungeon Crawl Stone Soup’s Interface

Dungeon Crawl Stone Soup (Github) is a single-player, free, and open-source rogue-like turn-based video game that consists of a procedurally generated 2-dimensional grid world. To win the game, a player must navigate their character through a series of levels to collect `The Orb of Zot’ and then return to the starting location. Along the way, the player encounters a wide variety of monsters and items. Players equip and use items to make themselves stronger or consume them to aid in difficult situations. The DCSS environment is dynamic, stochastic, partially observable, and complex with the number of instantiated actions the player may take reaching into the hundreds.

dcss-ai-wrapper is the first AI-friendly API designed to enable planning-based agents to play Dungeon Crawl Stone Soup. In this tutorial we will introduce the DCSS game, explain the rationale and design of the API, and guide participants through exercises to run agents in DCSS. No experience with DCSS is necessary. For the hands-on portions, basic python programming experience will be useful. By the end of the tutorial you will have an automated planning agent playing DCSS on your machine using the FastDownward planner.

Schedule

The main objective of this tutorial is to provide a hands-on tutorial of the software. By the end of the tutorial, the attendees will be able to install the game / API wrapper, understand various API functionalities, and be able to run sample Automated Planning agents. We plan for a 3 hour tutorial.

Date: Tuesday, November 22nd, 2022

Time (EST): 8:45am to Noon

Location: We hope to hold the tutorial as a hybrid event, both in person at the Advances in Cognitive Systems conference and virtually through the ACS 2022 conference Zoom (you will have recieved a link to this when you registered for the conference virtually - which is free).

After the tutorial ends, you are more than welcome to continue the conversation and ask questions in the gitter chatroom for this project: https://gitter.im/dcss-ai-wrapper/community

Schedule:

Time

Description

8:45am - 9am

Setup and helping attendee’s with any installation issues

9am - 9:30am

Introduction to the DCSS Game

9:30am - 10am

DCSS-AI-Wrapper API - Rationale, current status & how you can help

10am to Noon

Excercises (organizer will be available to help guide participants through these excercises):

  • Exercise 1: Get random agent running and watch it play in the browser

  • Exercise 2: Get fastdownward agent running and watch it play in the browser

  • Exercise 3: Make a custom level

  • Exercise 4: Run the human interface agent to play the game manually

  • Exercise 5: See how far down the dungeon you can go, by modifying the planning agent

Preparing for the Tutorial

Please perform the following steps to get your system ready for the live tutorial session. This includes installing dcss-ai-wrapper and the FastDownward planner on your system.

(optional, fun) Try playing Dungeon Crawl Stone Soup yourself to get a feel for the game. See how far in the dungeon you can go!

Software prequisites:

Next install dcss-ai-wrapper by following these instructions here: Quickstart

Finally install FastDownward by following their instructions here: http://www.fast-downward.org/ObtainingAndRunningFastDownward

  • Rename the fastdownward folder to be ‘FastDownward’ and make sure it’s in the top level dcss-ai-wrapper directory, like:

    dcss-ai-wrapper/FastDownward/
    
  • You will need to be able to call fast-downward.py from the command line (on Windows via powershell, or in Unix based systems on the command line) so the best instructions to follow are the ones where you compile it. We have not tested using FastDownward from the Vagrant or Docker installation images.

  • If you have trouble installing FastDownward, you can still follow along with the tutorial up to a certain point, and run agents that don’t use FastDownward.

The ultimate test to see if everything is installed and working correctly is to run the fastdownwardplanningagent.py agent in src/dcss/agent/fastdownwardplanningagent.py like:

cd dcss-ai-wrapper/  # make sure you're in the project root and the virtual env is active
python .\src\dcss\agent\fastdownwardplanningagent.py

Then go to the browser and if you can see the agent moving around then it means it’s working. It should be exploring new tiles and attacking monsters whenever it finds them (albeit sometimes poorly).

ICAPS 2021 Tutorial

Note

We will be adding more content to this page between now and the tutorial start. We welcome any and all questions to be asked via the Gitter public chatroom for the dcss-ai-wrapper project here: https://gitter.im/dcss-ai-wrapper/community

Updates:

  • [July 30th at 23:00 UTC-4] First version of these instructions are posted online.

  • [Aug 2nd at 07:20 UTC-4] We are working on providing a modified tutorial instead of cancelling.

  • [Aug 2nd at 08:30 UTC-4] We have updated the schedule with a modified list of excercises and timeline.

  • [Aug 2nd at 19:30 UTC-4] Updated Quickstart instructions for added clarity.

Introduction

dcss-ai-wrapper aims to enable the Dungeon Crawl Stone Soup (DCSS) video game to be used as a new benchmark for AI research. While more traditional planning benchmarks exist (i.e. IPC domains) and more traditional RL benchmarks exist (i.e. open-ai gym), it is often difficult to compare an RL agent on IPC domains or a planner on RL domains. DCSS is a complex domain that has built-in support for both automated planning and RL, as well as other properties that make it worthwhile to study.

Annotated Screenshot of DCSS

Annotated Screenshot of Dungeon Crawl Stone Soup’s Interface

Dungeon Crawl Stone Soup (Github) is a single-player, free, and open-source rogue-like turn-based video game that consists of a procedurally generated 2-dimensional grid world. To win the game, a player must navigate their character through a series of levels to collect `The Orb of Zot’ and then return to the starting location. Along the way, the player encounters a wide variety of monsters and items. Players equip and use items to make themselves stronger or consume them to aid in difficult situations. The DCSS environment is dynamic, stochastic, partially observable, and complex with the number of instantiated actions the player may take reaching into the hundreds.

dcss-ai-wrapper is the first AI-friendly API designed to enable planning-based agents to play Dungeon Crawl Stone Soup. In this tutorial we will guide participants through multiple live-coding exercises, providing them with the hands-on experience needed to apply their own custom planning algorithms and techniques to control an agent in DCSS for AI research.

Schedule

The main objective of this tutorial is to provide a hands-on tutorial of the software. By the end of the tutorial, the attendees will be able to install the game / API wrapper, understand various API functionalities, be able to run sample Automated Planning agents, and understand the experimental metrics that can be used. We plan for a 3 hour tutorial.

Date: August 3rd, 2021

Time (UTC-4, aka EST): 7:00 to 10:00

Time (UTC+8): 19:00 to 23:00

Location: The tutorial will be held virtually through gather.towns. Please see ICAPS information to access gather.towns.

After the tutorial ends, you are more than welcome to continue the conversation and ask questions in the gitter chatroom for this project: https://gitter.im/dcss-ai-wrapper/community

Time

Description

-1hr to Start

Open session to help attendee’s with any installation issues

Start - 45min

Introductory Lecture to the DCSS Game and the API + Live Demo

45 min to End

Excercises (organizers will be available to help guide participants through these excercises):

  • Exercise 1: Get random agent running and watch it play in the browser

  • Exercise 2: Get fastdownward agent running and watch it play in the browser

  • Exercise 3: Plot performance of random agent

  • Exercise 4: Plot performance of planning agent

  • Exercise 5: See how far you can get by modifying the planning agent

Preparing for the Tutorial

Please perform the following steps to get your system ready for the live tutorial session. This includes installing dcss-ai-wrapper and the FastDownward planner on your system.

(optional, fun) Try playing Dungeon Crawl Stone Soup yourself to get a feel for the game. See how far in the dungeon you can go!

Software prequisites:

Next install dcss-ai-wrapper by following these instructions here: Quickstart

Finally install FastDownward by following their instructions here: http://www.fast-downward.org/ObtainingAndRunningFastDownward

  • Rename the fastdownward folder to be ‘FastDownward’ and make sure it’s in the top level dcss-ai-wrapper directory, like:

    dcss-ai-wrapper/FastDownward/
    
  • You will need to be able to call fast-downward.py from the command line (on Windows via powershell, or in Unix based systems on the command line) so the best instructions to follow are the ones where you compile it. We have not tested using FastDownward from the Vagrant or Docker installation images.

  • If you have trouble installing FastDownward, you can still follow along with the tutorial up to a certain point, and run agents that don’t use FastDownward.

The ultimate test to see if everything is installed and working correctly is to run the fastdownwardplanningagent.py agent in src/dcss/agent/fastdownwardplanningagent.py like:

cd dcss-ai-wrapper/  # make sure you're in the project root and the virtual env is active
python .\src\dcss\agent\fastdownwardplanningagent.py

Then go to the browser and if you can see the agent moving around then it means it’s working. It should be exploring new tiles and attacking monsters whenever it finds them (albeit sometimes poorly).

Support

The easiest way to get help with the project is to ask a question in the Gitter community chat:

https://gitter.im/dcss-ai-wrapper/community

There is a dedicated youtube channel for the project that has helpful content:

https://www.youtube.com/channel/UCPR_UzIThpHNGEZos1SVmLQ

Another good way to get support is to open an issue on Github here:

https://github.com/dtdannen/dcss-ai-wrapper/issues

API Reference

This page contains auto-generated API reference documentation [1].

src

Subpackages

src.dcss
Subpackages
src.dcss.actions
Submodules
src.dcss.actions.action
Module Contents
Classes

Action

This class represents an action that the agent can take.

class src.dcss.actions.action.Action

This class represents an action that the agent can take.

This file contains messages for key actions and text inputs to be sent to webserver, including: * moving around * accessing the inventory * using items * … etc

These keycodes were identified manually be testing commands using Chrome’s develop tools and observing the communications sent through the websockets.

command_to_msg
dcss_menu_chars
static get_execution_repr(command_or_menu_choice)
static get_execution_repr_command(command: dcss.actions.command.Command)

Given a command, return the data that can be sent directly to the game to execute the command. :return: a message data structure that can be sent directly to the game to execute the command.

static get_execution_repr_menuchoice(choice: dcss.actions.menuchoice.MenuChoice)

Given a menuchoice, return the data that can be sent directly to the game to execute the menu selection. :return: a message data structure that can be sent directly to the game to select the desired menu option.

static get_all_commands()
static get_all_move_commands()
src.dcss.actions.command
Module Contents
Classes

Command

These are taken from the in-game manual of crawl.

class src.dcss.actions.command.Command

Bases: enum.Enum

These are taken from the in-game manual of crawl.

MOVE_OR_ATTACK_SW = 1
MOVE_OR_ATTACK_S = 2
MOVE_OR_ATTACK_SE = 3
MOVE_OR_ATTACK_W = 4
MOVE_OR_ATTACK_E = 5
MOVE_OR_ATTACK_NW = 6
MOVE_OR_ATTACK_N = 7
MOVE_OR_ATTACK_NE = 8
REST_AND_LONG_WAIT = 9
WAIT_1_TURN = 10
AUTO_EXPLORE = 11
INTERLEVEL_TRAVEL = 12
FIND_ITEMS = 13
SET_WAYPOINT = 14
LONG_WALK_SW = 15
LONG_WALK_S = 16
LONG_WALK_SE = 17
LONG_WALK_W = 18
LONG_WALK_E = 19
LONG_WALK_NW = 20
LONG_WALK_N = 21
LONG_WALK_NE = 22
ATTACK_WITHOUT_MOVE_SW = 23
ATTACK_WITHOUT_MOVE_S = 24
ATTACK_WITHOUT_MOVE_SE = 25
ATTACK_WITHOUT_MOVE_W = 26
ATTACK_WITHOUT_MOVE_E = 27
ATTACK_WITHOUT_MOVE_NW = 28
ATTACK_WITHOUT_MOVE_N = 29
ATTACK_WITHOUT_MOVE_NE = 30
AUTO_FIGHT = 31
AUTO_FIGHT_WITHOUT_MOVE = 32
WIELD_HAND_WEAPON = 33
QUIVER_MISSILE = 34
FIRE_MISSILE = 35
SELECT_MISSILE_AND_FIRE = 36
CYCLE_MISSILE_FORWARD = 37
CYCLE_MISSILE_BACKWARD = 38
WEAR_ARMOUR = 39
TAKE_OFF_ARMOUR = 40
CHOP_CORPSE = 41
EAT = 42
READ = 43
QUAFF = 44
PUT_ON_JEWELLERY = 45
REMOVE_JEWELLERY = 46
EVOKE = 47
SELECT_ITEM_TO_EVOKE = 48
MEMORISE = 49
COUNT_GOLD = 50
USE_SPECIAL_ABILITY = 51
CAST_SPELL_ABORT_WITHOUT_TARGETS = 52
CAST_SPELL_NO_MATTER_WHAT = 53
LIST_ALL_SPELLS = 54
TELL_ALLIES = 55
REDO_PREVIOUS_COMMAND = 56
SAVE_GAME_AND_EXIT = 57
SAVE_AND_EXIT_WITHOUT_QUERY = 58
ABANDON_CURRENT_CHARACTER_AND_QUIT_GAME = 59
DISPLAY_CHARACTER_STATUS = 60
SHOW_SKILL_SCREEN = 61
CHARACTER_OVERVIEW = 62
SHOW_RELIGION_SCREEN = 63
SHOW_ABILITIES_AND_MUTATIONS = 64
SHOW_ITEM_KNOWLEDGE = 65
SHOW_RUNES_COLLECTED = 66
DISPLAY_WORN_ARMOUR = 67
DISPLAY_WORN_JEWELLERY = 68
DISPLAY_EXPERIENCE_INFO = 69
OPEN_DOOR = 70
CLOSE_DOOR = 71
TRAVEL_STAIRCASE_DOWN = 72
TRAVEL_STAIRCASE_UP = 73
EXAMINE_CURRENT_TILE_PICKUP_PART_OF_SINGLE_STACK = 74
EXAMINE_SURROUNDINGS_AND_TARGETS = 75
EXAMINE_LEVEL_MAP = 76
LIST_MONSTERS_ITEMS_FEATURES_IN_VIEW = 77
TOGGLE_VIEW_LAYERS = 78
SHOW_DUNGEON_OVERVIEW = 79
TOGGLE_AUTO_PICKUP = 80
SET_TRAVEL_SPEED_TO_CLOSEST_ALLY = 81
SHOW_INVENTORY_LIST = 82
INSCRIBE_ITEM = 83
PICKUP_ITEM = 84
SELECT_ITEM_FOR_PICKUP = 85
DROP_ITEM = 86
DROP_LAST_ITEMS_PICKED_UP = 87
EXIT_MENU = 88
SHOW_PREVIOUS_GAME_MESSAGES = 89
RESPOND_YES_TO_PROMPT = 90
RESPOND_NO_TO_PROMPT = 91
ENTER_KEY = 92
EXAMINE_TILE_IN_EXPLORE_MENU = 93
src.dcss.actions.menuchoice
Module Contents
Classes

MenuChoice

Menu choices are always a lower or upper case letter

MenuChoiceMapping

class src.dcss.actions.menuchoice.MenuChoice

Bases: enum.Enum

Menu choices are always a lower or upper case letter

NONE
LOWER_A = 0
LOWER_B = 1
LOWER_C = 2
LOWER_D = 3
LOWER_E = 4
LOWER_F = 5
LOWER_G = 6
LOWER_H = 7
LOWER_I = 8
LOWER_J = 9
LOWER_K = 10
LOWER_L = 11
LOWER_M = 12
LOWER_N = 13
LOWER_O = 14
LOWER_P = 15
LOWER_Q = 16
LOWER_R = 17
LOWER_S = 18
LOWER_T = 19
LOWER_U = 20
LOWER_V = 21
LOWER_W = 22
LOWER_X = 23
LOWER_Y = 24
LOWER_Z = 25
UPPER_A = 26
UPPER_B = 27
UPPER_C = 28
UPPER_D = 29
UPPER_E = 30
UPPER_F = 31
UPPER_G = 32
UPPER_H = 33
UPPER_I = 34
UPPER_J = 35
UPPER_K = 36
UPPER_L = 37
UPPER_M = 38
UPPER_N = 39
UPPER_O = 40
UPPER_P = 41
UPPER_Q = 42
UPPER_R = 43
UPPER_S = 44
UPPER_T = 45
UPPER_U = 46
UPPER_V = 47
UPPER_W = 48
UPPER_X = 49
UPPER_Y = 50
UPPER_Z = 51
ZERO = 52
ONE = 53
TWO = 54
THREE = 55
FOUR = 56
FIVE = 57
SIX = 58
SEVEN = 59
EIGHT = 60
NINE = 61
ASTERISK = 62
EXCLAMATION_POINT = 63
FORWARD_SLASH = 64
QUESTION_MARK = 65
LESS_THAN = 66
GREATER_THAN = 67
ENTER = 68
PERIOD = 69
DASH = 70
CARAT = 71
TAB = 72
BACKSLASH = 73
UNDERSCORE = 74
ESCAPE = 75
class src.dcss.actions.menuchoice.MenuChoiceMapping
dcss_menu_chars
menus_to_choices
static get_menu_letter_to_menu_choice()
static get_menu_choice_from_letter(letter)
static get_menu_choice_from_item_menu_raw_str(raw_str)

Individual inventory item menus have actoins at the bottom that look like this (example is a scroll):

‘(=)adjust, (r)ead, (d)rop, or (i)nscribe.’

This function takes one of these actions, ‘(r)ead’ and returns the appropriate MenuChoice enum, which would be

MenuChoice.LOWER_R in this example

static get_menu_letter_to_menu_choice()
add_menu_choices_for_individual_item_menu(choices: list)
static add_ability_menu_choice(letter)
src.dcss.agent
Submodules
src.dcss.agent.QLearning
Module Contents
Classes

QLearning

Attributes

my_config

class src.dcss.agent.QLearning.QLearning

Bases: dcss.agent.base.BaseAgent

get_action(gamestate: dcss.state.game.GameState)
src.dcss.agent.QLearning.my_config
src.dcss.agent.SimpleRandomAgent
Module Contents
Classes

SimpleRandomBaseAgent

Agent that takes random cardinal actions to move/attack.

class src.dcss.agent.SimpleRandomAgent.SimpleRandomBaseAgent

Bases: dcss.agent.base.BaseAgent

Agent that takes random cardinal actions to move/attack.

do_sprint()
do_dungeon()
do_dungeon_webserver()
get_game_mode_setup_actions()
get_game_mode_setup_actions_webserver()
get_action(gamestate)
src.dcss.agent.base
Module Contents
Classes

BaseAgent

class src.dcss.agent.base.BaseAgent
abstract get_action(gamestate: dcss.state.game.GameState)
requesting_start_new_game()

This function enables the agent class to decide to start a new game. By default this is false, and subclasses of BaseAgent should implement this function to return True whenever a new game should begin. This function is especially helpful when you have some arbitrary criteria for which you want an agent to stop.

src.dcss.agent.coeyFeatureAgent
Module Contents
Classes

coeyFeatureAgent

Attributes

my_config

class src.dcss.agent.coeyFeatureAgent.coeyFeatureAgent

Bases: dcss.agent.base.BaseAgent

get_action(gamestate: dcss.state.game.GameState)
src.dcss.agent.coeyFeatureAgent.my_config
src.dcss.agent.debug_agent
Module Contents
Classes

MyAgent

Attributes

my_config

class src.dcss.agent.debug_agent.MyAgent

Bases: dcss.agent.base.BaseAgent

action_sequence()
get_action(gamestate: dcss.state.game.GameState)
src.dcss.agent.debug_agent.my_config
src.dcss.agent.fastdownwardplanningagent
Module Contents
Classes

FastDownwardPlanningBaseAgent

Agent that uses fast downward to solve planning problems to explore a floor.

Functions

setup_logger(logger)

Attributes

my_config

class src.dcss.agent.fastdownwardplanningagent.FastDownwardPlanningBaseAgent

Bases: dcss.agent.base.BaseAgent

Agent that uses fast downward to solve planning problems to explore a floor.

pddl_domain_file = ''
process_gamestate_via_cells()
get_full_health_goal()
get_nearest_item_pickup_goal()
get_random_nonvisited_nonwall_playerat_goal()
get_first_monster_goal()

This picks a the first available monster and chooses that monsters cell to be the goal. In the process of trying to move into the monsters cell, the agent should end up attacking the monster, because movement and attacking are the same thing (for melee).

generate_current_state_pddl(goals)
get_plan_from_fast_downward(goals)
equip_best_items()

Calling this will have the agent evaluate the best items

read_scrolls()

The agent will read all scrolls in its inventory

can_create_plan_to_reach_next_floor()

Returns a plan to go to the next floor

goal_selection()

Returns the goal the agent should pursue right now

In some cases, deciding to reach a goal may depend on whether that goal is even reachable via planning. Since we would have generated the plan anyway, let’s return it and save some work

get_random_simple_action()
get_action(gamestate: dcss.state.game.GameState)
src.dcss.agent.fastdownwardplanningagent.setup_logger(logger)
src.dcss.agent.fastdownwardplanningagent.my_config
src.dcss.agent.fastdownwardtutorial1
Module Contents
Classes

FastDownwardPlanningAgentTut1

Agent that uses fast downward to solve planning problems to explore a floor.

class src.dcss.agent.fastdownwardtutorial1.FastDownwardPlanningAgentTut1

Bases: dcss.agent.base.BaseAgent

Agent that uses fast downward to solve planning problems to explore a floor.

pddl_domain_file = ''
get_random_nonvisited_nonwall_playerat_goal()
get_plan_from_fast_downward(goals)
write_data_to_file()
get_blue_tile_goal(i)
get_random_simple_action()
requesting_start_new_game()

This function enables the agent class to decide to start a new game. By default this is false, and subclasses of BaseAgent should implement this function to return True whenever a new game should begin. This function is especially helpful when you have some arbitrary criteria for which you want an agent to stop.

get_action(gamestate: dcss.state.game.GameState)
src.dcss.agent.humaninterfaceagent
Module Contents
Classes

HumanInterfaceBaseAgent

Attributes

STILL_NEED_TO_RESTART

getch

my_config

src.dcss.agent.humaninterfaceagent.STILL_NEED_TO_RESTART = False
src.dcss.agent.humaninterfaceagent.getch
class src.dcss.agent.humaninterfaceagent.HumanInterfaceBaseAgent

Bases: dcss.agent.base.BaseAgent

get_action(gamestate: dcss.state.game.GameState)
print_all_items_near_player(gamestate: dcss.state.game.GameState, r=1)
print_player_stats_vector(verbose=False)

Print the player stats vector

print_current_menu()

Print the menu that the API thinks is currently true

print_player_skills_pddl()

Print the pddl facts about the players skill and what they are training, current level, etc.

print_player_inv_pddl()
get_command_from_human_keypress(keypress)

Return the command that matches the keypress from the user

src.dcss.agent.humaninterfaceagent.my_config
src.dcss.agent.randomagent
Module Contents
Classes

MyAgent

Attributes

my_config

class src.dcss.agent.randomagent.MyAgent

Bases: dcss.agent.base.BaseAgent

get_action(gamestate: dcss.state.game.GameState)
src.dcss.agent.randomagent.my_config
src.dcss.agent.randomagent_local
Module Contents
Classes

MyAgent

Attributes

game_state

class src.dcss.agent.randomagent_local.MyAgent

Bases: dcss.agent.base.BaseAgent

get_action(gamestate: dcss.state.game.GameState)
src.dcss.agent.randomagent_local.game_state
src.dcss.agent.randomagent_local_pshandler
Module Contents
Classes

MyAgent

Attributes

process_handler

class src.dcss.agent.randomagent_local_pshandler.MyAgent

Bases: dcss.agent.base.BaseAgent

get_action(gamestate: dcss.state.game.GameState)
src.dcss.agent.randomagent_local_pshandler.process_handler
src.dcss.agent.simpleGR
Module Contents
Classes

Goal

Generic enumeration.

SimpleGRAgent

Agent that uses fast downward to solve planning problems to explore a floor.

Attributes

my_config

class src.dcss.agent.simpleGR.Goal

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

EXPLORE = 1
ATTACK = 2
RETREAT = 3
COLLECT_ITEMS = 4
HEAL = 5
class src.dcss.agent.simpleGR.SimpleGRAgent

Bases: dcss.agent.base.BaseAgent

Agent that uses fast downward to solve planning problems to explore a floor.

pddl_domain_file = ''
_remove_old_state_files()
get_pddl_state_filename()
process_gamestate_via_cells()
get_random_nonvisited_nonwall_playerat_goal()
get_item_goal()

This picks the first available potion.

get_first_monster_goal()

This picks a the first available monster and chooses that monsters cell to be the goal. In the process of trying to move into the monsters cell, the agent should end up attacking the monster, because movement and attacking are the same thing (for melee).

update_pddl_objs_and_facts()
get_plan_from_fast_downward(goals)
equip_best_items()

Calling this will have the agent evaluate the best items

read_scrolls()

The agent will read all scrolls in its inventory

can_create_plan_to_reach_next_floor()

Returns a plan to go to the next floor

goal_selection()

Returns the goal the agent should pursue right now

In some cases, deciding to reach a goal may depend on whether that goal is even reachable via planning. Since we would have generated the plan anyway, let’s return it and save some work

goal_satisified()
get_random_simple_action()
get_action(gamestate: dcss.state.game.GameState)
src.dcss.agent.simpleGR.my_config
src.dcss.agent.testallcommandsagent
Module Contents
Classes

TestAllCommandsBaseAgent

Agent that serves to test all commands are working. Cycles through commands in actions.Command enum.

class src.dcss.agent.testallcommandsagent.TestAllCommandsBaseAgent

Bases: dcss.agent.base.BaseAgent

Agent that serves to test all commands are working. Cycles through commands in actions.Command enum.

do_dungeon()
get_game_mode_setup_actions()
get_action(gamestate)
src.dcss.connection
Subpackages
src.dcss.connection.states
Submodules
src.dcss.connection.states.initial
Module Contents
Classes

Initial

class src.dcss.connection.states.initial.Initial

Bases: dcss.connection.state.State

run()
next(input)
Submodules
src.dcss.connection.autobahn_game_connection
Module Contents
Classes

DCSSProtocol

Base class for asyncio-based WebSocket client protocols.

class src.dcss.connection.autobahn_game_connection.DCSSProtocol

Bases: autobahn.asyncio.websocket.WebSocketClientProtocol

Base class for asyncio-based WebSocket client protocols.

Implements:

  • autobahn.websocket.interfaces.IWebSocketChannel

onConnect(response)

Callback fired directly after WebSocket opening handshake when new WebSocket server connection was established.

Parameters:

response (instance of autobahn.websocket.types.ConnectionResponse) – WebSocket connection response information.

async onOpen()
onMessage(payload, isBinary)

Implements autobahn.websocket.interfaces.IWebSocketChannel.onMessage()

reset_before_next_game()
perform_state_checks(json_msg)
check_for_in_lobby(json_msg)
check_for_ping(json_msg)
check_for_enter_key(json_msg)
check_for_inventory_menu(json_msg)
check_for_all_spells_menu(json_msg)
check_for_skills_menu(json_msg)
get_spell_menu_options(json_msg)
get_skill_menu_options(json_msg)
check_for_attribute_increase(json_msg)
check_for_walk_into_teleport_trap(json_msg)
check_for_renounce_religion_prompt(json_msg)
check_for_are_you_sure_text_menu(json_msg)
check_for_no_longer_in_text_menu(json_msg)

After choosing an option in a text menu, getting one of the following messages means you are no longer in that text menu

check_for_ability_menu(json_msg)
get_ability_menu_options(json_msg)
{“msgs”:
[{“msg”:”input_mode”,”mode”:0},
{“msg”:”menu”,”ui-centred”:false,”tag”:”ability”,”flags”:3154,

“title”:{“text”:” <white>Ability - do what? Cost Failure”}, “more”:”Press ‘<white>!<lightgrey>’ or ‘<white>?<lightgrey>’ to toggle between ability selection and description.”, “total_items”:3, “chunk_start”:0, “items”:[{“text”:” Invocations - “,”colour”:1,”level”:1},

{“text”:” X - Renounce Religion None 0%”,”q”:1,”hotkeys”:[88],”level”:2,”tiles”:[{“t”:7696,”tex”:5}]}, {“text”:” a - Berserk None 0%”,”q”:1,”hotkeys”:[97],”level”:2,”tiles”:[{“t”:7795,”tex”:5}]}]}

check_for_sprint_map_menu(json_msg)
check_for_game_seed_menu(json_msg)
check_for_pregeneration_check_true(json_msg)
check_for_tutorial_menu(json_msg)
check_for_login_success(json_msg)
check_for_lobby_clear(json_msg)
check_for_game_started(json_msg)
check_received_map_data(json_msg)
check_if_player_died(json_msg)
check_for_death_message(json_msg)
check_for_species_selection_menu(json_msg)
get_species_options(json_msg)
check_for_background_selection_menu(json_msg)
get_background_options(json_msg)
check_for_weapon_selection_menu(json_msg)
get_weapon_options(json_msg)
check_for_action_limit_reached()
check_for_close_all_menus(json_msg)

Checks for the ‘close_all_menus’ message from server to exit out of menus

check_for_item_description_menu(json_msg)
{‘msgs’: [{‘msg’: ‘update_menu_items’,

‘chunk_start’: 1, ‘items’: [{‘text’: ‘ a + a +0 hand axe (weapon)’, ‘colour’: 10, ‘tiles’: [{‘t’: 4152, ‘tex’: 4}, {‘t’: 3041, ‘tex’: 4}]}]},

{‘title’: ‘a - a +0 hand axe (weapon).’,

‘body’: “A small axe.

Base accuracy: +3 Base damage: 7 Base attack delay: 1.3 This

weapon’s minimum attack delay (0.6) is reached at skill level 14.

Your skill: 3.6; use <white>(s)<lightgrey> to set

14.0 as a target for Axes.

At 100% training you would reach 14.0 in about 8.0 XLs.

At current training (39%) you reach 14.0 in about 10.6 XLs.

It hits all enemies adjacent to the wielder,

dealing less damage to those not targeted.

This weapon falls into the ‘Axes’ category. It is a one handed

weapon.

It can be maximally enchanted to +9.

Stash search prefixes: {inventory} {Axes} {one-handed} {melee weapon}

Menu/colouring prefixes: identified uncursed melee equipped weapon

“Lizzie Borden took an axe
And gave her

mother forty whacks.

When she saw what she had done She gave her father forty-one.”

-A popular skipping-rope

rhyme, after 1893.

SPELLSET_PLACEHOLDER”,

‘spellset’: [], ‘actions’: ‘(=)adjust, (u)nwield, (s)kill, (d)rop, or (i)nscribe.’, ‘tiles’: [{‘t’: 4152, ‘tex’: 4},

{‘t’: 3041, ‘tex’: 4}], ‘msg’: ‘ui-push’, ‘type’: ‘describe-item’, ‘ui-centred’: False, ‘generation_id’: 3}]}

check_for_identify_which_item_menu(json_msg)

When you read a scroll of identify, you will get to a special menu of all things you can identify.

This function checks for this menu.

data looks like:

into: {“msgs”:[{“msg”:”input_mode”,”mode”:0},
{“msg”:”menu”,”ui-centred”:false,”tag”:”inventory”,”flags”:2,

“title”:{“text”:”<white>Identify which item? (to view known items)”}, “more”:””,”total_items”:2,”chunk_start”:0, “items”:[{“text”:”Scrolls”,”colour”:1,”level”:1},

{“text”:” e - a scroll labelled AMAPPOAXZA”,”q”:1,”colour”:9,

“hotkeys”:[101,63],”level”:2,”tiles”:[{“t”:3424,”tex”:4}]}]}

,{“msg”:”player”,

“inv”:{“3”:{“sub_type”:0,”flags”:2,”name”:”scroll of identify”,”col”:-1,”tile”:[3424,3425]}}}

,{“msg”:”msgs”,”more”:false}

]}

check_for_close_nested_menu(json_msg)

{“msgs”:[{“msg”:”ui-pop”}

,{“msg”:”update_menu_items”,”chunk_start”:1,”items”:[{“text”:” a - a +0 hand axe (weapon)”,”colour”:10,”tiles”:[{“t”:4152,”tex”:4},{“t”:3041,”tex”:4}]}]}

get_hotkey_json_as_msg(hotkey)
get_gamestate()
check_agent_wants_to_start_next_game()
set_ai_class(agent_class)
load_ai_class()
onClose(wasClean, code, reason)

Implements autobahn.websocket.interfaces.IWebSocketChannel.onClose()

src.dcss.connection.config
Module Contents
Classes

LocalConfig

This configuration should be used when running DCSS in the terminal locally on the machine. Currently this

WebserverConfig

This configuration should be used when running DCSS in webserver mode.

class src.dcss.connection.config.LocalConfig

This configuration should be used when running DCSS in the terminal locally on the machine. Currently this has only been tested in Linux. It should work for Mac. Windows support is unknown.

socketpath = '127.0.0.1'
server_ip = '127.0.0.1'
server_port = '80'
server_uri
agent_name = 'midca'
crawl_socketpath
delay = 0.5
static construct_server_uri()
class src.dcss.connection.config.WebserverConfig

This configuration should be used when running DCSS in webserver mode.

server_uri = 'ws://127.0.0.1:8080/socket'
server_ip = '127.0.0.1'
server_port = '8080'
agent_name = 'midca'
agent_password = 'midca'
delay = 1
game_id = 'tut-web-trunk'
seed = 4675233756386659716
tutorial_number = 1
sprint_map_letter = 'a'
auto_start_new_game = False
max_actions
always_start_new_game = False
ai_python_class = 'FastDownwardPlanningAgentTut1'
species = 'Minotaur'
background = 'Berserker'
starting_weapon = 'hand axe'
draw_map = False
src.dcss.connection.game_connection
Module Contents
Classes

GameConnection

class src.dcss.connection.game_connection.GameConnection(config=config.WebserverConfig())
static json_encode(value)
async consumer(message)
async only_receive_ws()
start()
async connect_webserver2()
async login_webserver()
async send_pong()
async load_game_on_webserver()
async get_all_server_messages()
async send_and_receive(message)
async send_and_receive_ws(message)
async send_and_receive_command_ws(command)
async connect_webserver()
async connect_ws()
connect()
ready_to_connect()
close()
_send_message(data)
_control_input(c)
_send_input(input_str)
_read_msg()
_handle_msgs(msgs)
get_gamestate()
_read_msgs()
_send_command(command)
async _send_command_ws(command)
send_and_receive_dict(input_dict)
async send_and_receive_dict_ws(input_dict)
send_and_receive_str(input_str)
send_and_receive_command(command, sleep_secs=0.05)
src.dcss.connection.local_game_connection
Module Contents
Functions

_start_process(self)

connect(self, socketpath[, primary])

src.dcss.connection.local_game_connection._start_process(self)
src.dcss.connection.local_game_connection.connect(self, socketpath, primary=False)
src.dcss.connection.menuknowledge
Module Contents
Classes

MenuBackgroundKnowledge

class src.dcss.connection.menuknowledge.MenuBackgroundKnowledge
tutorial_lesson_number_to_hotkey
sprint_map_letter_to_hotkey
src.dcss.connection.state
Module Contents
Classes

State

class src.dcss.connection.state.State
abstract run()
abstract next(input)
src.dcss.state
Submodules
src.dcss.state.ability
Module Contents
Classes

AbilityName

Represents a player ability

AbilityNameMapping

Assists parsing what ability the player has from websocket data

Ability

Represent a spell that a player can or has learned.

class src.dcss.state.ability.AbilityName

Bases: enum.Enum

Represents a player ability

NULL_SPELL_SPECIAL_CASE = 0
ANCESTOR_IDENTITY_ABILITY = 1
ANCESTOR_LIFE_ABILITY = 2
ANIMATE_DEAD_ABILITY = 3
ANIMATE_REMAINS_ABILITY = 4
APOCALYPSE_ABILITY = 5
BANISH_ABILITY = 6
BANISH_SELF_ABILITY = 7
BEND_SPACE_ABILITY = 9
BEND_TIME_ABILITY = 10
BERSERK_ABILITY = 11
BRAND_WEAPON_WITH_HOLY_ABILITY = 13
BRAND_WEAPON_WITH_PAIN_ABILITY = 14
BRIAR_PATCH_ABILITY = 15
BRIBE_BRANCH_ABILITY = 16
BROTHERS_IN_ARMS_ABILITY = 17
CALL_MERCHANT_ABILITY = 18
CHANNEL_MAGIC_ABILITY = 19
CLEANSING_FLAME_ABILITY = 20
CORRUPT_ABILITY = 22
CORRUPT_WEAPON_ABILITY = 23
CURE_BAD_MUTATIONS_ABILITY = 24
CURSE_ITEM_ABILITY = 25
DEAL_FOUR_ABILITY = 26
DEPART_ABYSS_ABILITY = 27
DISASTER_AREA_ABILITY = 28
DIVINE_PROTECTION_ABILITY = 29
DIVINE_SHIELD_ABILITY = 30
DIVINE_VIGOUR_ABILITY = 31
DRAIN_LIFE_ABILITY = 32
DRAW_OUT_POWER_ABILITY = 33
ELEMENTAL_FORCE_ABILITY = 34
ENSLAVE_SOUL_ABILITY = 35
EXSANGUINATE_ABILITY = 8
FINESSE_ABILITY = 36
FLIGHT_ABILITY = 37
FORGET_SPELL_ABILITY = 38
GAIN_RANDOM_MUTATIONS_ABILITY = 39
GIVE_ITEM_TO_FOLLOWER_ABILITY = 40
GRAND_FINALE_ABILITY = 41
GREATER_HEALING_ABILITY = 42
GROW_BALLISTOMYCETE_ABILITY = 43
GROW_OKLOB_PLANT_ABILITY = 44
HEAL_OTHER_ABILITY = 45
HEAL_WOUNDS_ABILITY = 46
HEAVENLY_STORM_ABILITY = 47
HEROISM_ABILITY = 48
HOP_ABILITY = 49
IDEALISE_ABILITY = 50
IMPRISON_ABILITY = 51
LESSER_HEALING_ABILITY = 52
LINE_PASS_ABILITY = 53
MAJOR_DESTRUCTION_ABILITY = 54
MINOR_DESTRUCTION_ABILITY = 55
OVERGROW_ABILITY = 56
PICK_A_CARD_ANY_CARD_ABILITY = 57
POTION_PETITION_ABILITY = 58
POWER_LEAP_ABILITY = 59
PURIFICATION_ABILITY = 60
RECALL_ABILITY = 61
RECALL_UNDEAD_SLAVES_ABILITY = 62
RECEIVE_CORPSES_ABILITY = 63
RECEIVE_NECRONOMICON_ABILITY = 64
RECITE_ABILITY = 65
REQUEST_JELLY_ABILITY = 66
RESURRECTION_ABILITY = 67
REVIVIFY_ABILITY = 95
ROLLING_CHARGE_ABILITY = 68
SANCTUARY_ABILITY = 69
SCRYING_ABILITY = 70
SERPENTS_LASH_ABILITY = 71
SHADOW_FORM_ABILITY = 72
SHADOW_STEP_ABILITY = 73
SLIMIFY_ABILITY = 74
SLOUCH_ABILITY = 75
SMITE_ABILITY = 76
SPIT_POISON_ABILITY = 77
STACK_FIVE_ABILITY = 78
STEP_FROM_TIME_ABILITY = 79
STOMP_ABILITY = 80
SUMMON_DIVINE_WARRIOR_ABILITY = 81
SUMMON_GREATER_SERVANT_ABILITY = 82
SUMMON_LESSER_SERVANT_ABILITY = 83
TEMPORAL_DISTORTION_ABILITY = 84
TOGGLE_DIVINE_ENERGY_ABILITY = 85
TOGGLE_INJURY_MIRROR_ABILITY = 86
TORMENT_ABILITY = 87
TRANSFER_KNOWLEDGE_ABILITY = 88
TRANSFERENCE_ABILITY = 89
TRIPLE_DRAW_ABILITY = 90
TROGS_HAND_ABILITY = 91
UPHEAVAL_ABILITY = 92
VITALISATION_ABILITY = 93
WALL_JUMP_ABILITY = 94
RENOUNCE_RELIGION_ABILITY = 95
class src.dcss.state.ability.AbilityNameMapping

Assists parsing what ability the player has from websocket data

# TODO add more here as they are discovered - crawl wiki unreliable

ability_menu_messages_lookup
class src.dcss.state.ability.Ability(abilityname: AbilityName, fail_chance: int, mp_cost: bool, piety_cost: bool, delay_cost: bool, frailty_cost: bool)

Represent a spell that a player can or has learned.

NULL_ABILITY_VECTOR
ABILITY_NAME_LENGTH
get_ability_vector()
get_ability_pddl()
__hash__()

Return hash(self).

__eq__(other)

Return self==value.

src.dcss.state.cell
Module Contents
Classes

Cell

Stores a cell of the map, not sure what all the information means yet

class src.dcss.state.cell.Cell(vals)

Stores a cell of the map, not sure what all the information means yet

set_vals(vals)
remove_all_items()
get_pddl_name()
get_cell_vector()

A tile can have 0 or 1 monsters. Monsters do not have IDs therefore they are referred to by the tile they are occupying.

Each tile is represented by a vector of size 34:

Vector Index

Description of Data

Data Type if available

0-19

Monster data, see monster.py get_cell_vector()

20

Terrain Type

Int repr.type ID

21

Has Item Potion

Int repr. type ID

22

Has Item Scroll

Int repr. type ID

23

Has Item Armour

Int repr. type ID

24

Has Item Weapon

Int repr. type ID

25

Has Item Missile

Int repr. type ID

26

Has Gold

Boolean

27

Has Smoke / Fog

Boolean

28

Has Flame Cloud

Boolean

29

(TODO) Has Rune

Int repr. type ID

30

Has Orb of Zot

Boolean

get_pddl_facts()
straight_line_distance(cell)
get_simple_vector_value()

Returns a vector based representation of the cell for use in RL approaches.

This vector has length 1 and is highly simplified. Possible values are: 0 - empty 1 - player 2 - monster 3 - lava 4 - plant or tree 5 - stairsup 6 - stairsdown 7 - statue or wall or 8 - open door 9 - closed door

static get_simple_vector_value_for_nonexistent_cell()

In the situation where we need to represent a tile that doesn’t exist, use this as the default value

__str__()

Return str(self).

src.dcss.state.cellmap
Module Contents
Classes

CellMap

Data structure that maintains the set of all cells currently seen in the game.

class src.dcss.state.cellmap.CellMap

Data structure that maintains the set of all cells currently seen in the game.

add_or_update_cell(x, y, vals)
set_agent_x(x)
set_agent_y(y)
draw_cell_map()
set_current_depth(depth: int)
set_current_place(place: str)
get_radius_around_agent_vector(r=2, tile_vector_repr='simple')

Returns a vector of tiles around the agent. The length of the vector is (2r+1)^2

get_radius_around_agent_cells(r=2)

Returns a list of Cell objects around the agent, given a radius.

get_radius_around_agent_str(r=8)
get_cell_map_pddl_global()

Returns PDDL object and fact statements for the entire game so far, including multiple levels

get_cell_map_pddl_radius(radius=8)

Returns PDDL objects and facts for the current level with the given radius (default=8)

get_xy_to_cells_dict()
get_player_cell()
src.dcss.state.cellrawstrdatum
Module Contents
Classes

CellRawStrDatum

These are the types of data that may appear in a raw str description of a cell from the server.

class src.dcss.state.cellrawstrdatum.CellRawStrDatum

Bases: enum.Enum

These are the types of data that may appear in a raw str description of a cell from the server.

x = 0
f = 1
y = 2
g = 3
t = 4
mf = 5
col = 6
mon = 7
src.dcss.state.game
Module Contents
Classes

GameState

This file stores the state class that is used to keep track of

class src.dcss.state.game.GameState

This file stores the state class that is used to keep track of the current state of the dcss game

ID = 0
update(msg_from_server)

Updates the game state object with a message from the webserver.

Parameters:

msg_from_server (dict) – message from the server

set_current_menu(menu: dcss.state.menu.Menu)
get_current_menu()
get_player_stats_vector(verbose=False)

The following player stats are returned by this function:

Vector Index

Description of Data

Data Type if available

0

health

Int

1

health_max

Int

2

health_max_real

Int

3

mana_points

Int

4

mana_points_max

Int

5

mana_points_real

Int

6

AC

Int

7

EV

Int

8

SH

Int

9

Str

Int

10

Str max

Int

11

Int

Int

12

Int max

Int

13

Dex

Int

14

Dex max

Int

15

XL

Int

16

Experience until next level

0-100 percentage

14

God

Int

15

Piety Level

Int

16

Spell slots left

Int

17

gold

Int

18

rFire

Int

19

rCold

Int

20

rNeg

Int

21

rPois

Int

22

rElec

Int

23

rCorr

Int

24

MR

Int

25

Stealth

Int

26

HPRegen per turn

Float

27

MPRegen per turn

Float

28

See invisible

Boolean

30

Faith

Boolean

31

Spirit

Boolean

32

Reflect

Boolean

33

Harm

Boolean

34

game turns

Float

35

game time

Float

36

attack speed

Int

37

movement speed

Int

169

Player Place (Dungeon, Vaults, etc.)

Boolean

38

Agile status effect

Boolean

39

Antimagic status effect

Boolean

40

Augmentation status effect

Boolean

41

Bad Forms status effect

Boolean

42

Berserk status effect

Boolean

170

Unable to Berserk status effect

Boolean

43

Black Mark status effect

Boolean

44

Blind status effect

Boolean

45

Brilliant status effect

Boolean

46

Charm status effect

Boolean

47

Confusing Touch status effect

Boolean

48

Confusion status effect

Boolean

49

Constriction status effect

Boolean

50

Cooldowns status effect

Boolean

51

Corona status effect

Boolean

52

Corrosion status effect

Boolean

53

Darkness status effect

Boolean

54

Dazed status effect

Boolean

55

Death Channel status effect

Boolean

56

Death’s Door status effect

Boolean

57

Deflect Missiles status effect

Boolean

58

Disjunction status effect

Boolean

59

Divine Protection status effect

Boolean

60

Divine Shield status effect

Boolean

61

Doom Howl status effect

Boolean

62

Drain status effect

Boolean

63

Engorged status effect

Boolean

64

Engulf status effect

Boolean

65

Fast+Slow status effect

Boolean

66

Fear status effect

Boolean

67

Finesse status effect

Boolean

68

Fire Vulnerable status effect

Boolean

69

Flayed status effect

Boolean

70

Flight status effect

Boolean

71

Frozen status effect

Boolean

72

Haste status effect

Boolean

73

Heavenly Storm status effect

Boolean

74

Held status effect

Boolean

75

Heroism status effect

Boolean

76

Horrified status effect

Boolean

77

Inner Flame status effect

Boolean

78

Invisibility status effect

Boolean

79

Lava status effect

Boolean

80

Leda’s Liquefaction status effect

Boolean

81

Leda’s Liquefaction status effect

Boolean

82

Magic Contamination status effect

Boolean

83

Mark status effect

Boolean

84

Mesmerised status effect

Boolean

85

Might status effect

Boolean

86

Mirror Damage status effect

Boolean

87

No Potions status effect

Boolean

88

No Scrolls status effect

Boolean

89

Olgreb’s Toxic Radiance status effect

Boolean

90

Orb status effect

Boolean

91

Ozocubu’s Armour status effect

Boolean

92

Paralysis status effect

Boolean

93

Petrifying/Petrified status effect

Boolean

94

Poison status effect

Boolean

95

Powered by Death status effect

Boolean

96

Quad Damage status effect

Boolean

97

Recall status effect

Boolean

98

Regenerating status effect

Boolean

99

Repel Missiles status effect

Boolean

100

Resistance status effect

Boolean

101

Ring of Flames status effect

Boolean

102

Sapped Magic status effect

Boolean

103

Scrying status effect

Boolean

104

Searing Ray status effect

Boolean

105

Serpent’s Lash status effect

Boolean

106

Shroud of Golubria status effect

Boolean

107

Sickness status effect

Boolean

108

Silence status effect

Boolean

109

Silence status effect

Boolean

110

Sleep status effect

Boolean

111

Slimify status effect

Boolean

112

Slow status effect

Boolean

113

Sluggish status effect

Boolean

114

Starving status effect

Boolean

115

Stat Zero status effect

Boolean

116

Sticky Flame status effect

Boolean

117

Still Winds status effect

Boolean

118

Swiftness status effect

Boolean

119

Teleport Prevention status effect

Boolean

120

Teleport status effect

Boolean

121

Tornado status effect

Boolean

122

Transmutations status effect

Boolean

123

Umbra status effect

Boolean

124

Vitalisation status effect

Boolean

125

Vulnerable status effect

Boolean

126

Water status effect

Boolean

127

Weak status effect

Boolean

128

Acute Vision mutation

Boolean

129

Antennae mutation

Boolean

130

Beak mutation

Boolean

131

Big Wings mutation

Boolean

132

Blink mutation

Boolean

133

Camouflage mutation

Boolean

134

Clarity mutation

Boolean

135

Claws mutation

Boolean

136

Cold Resistance mutation

Boolean

137

Electricity Resistance mutation

Boolean

138

Evolution mutation

Boolean

139

Fangs mutation

Boolean

140

Fire Resistance mutation

Boolean

141

High MP mutation

Boolean

142

Hooves mutation

Boolean

143

Horns mutation

Boolean

144

Icy Blue Scales mutation

Boolean

145

Improved Attributes mutation

Boolean

146

Iridescent Scales mutation

Boolean

147

Large Bone Plates mutation

Boolean

148

Magic Resistance mutation

Boolean

149

Molten Scales mutation

Boolean

150

Mutation Resistance mutation

Boolean

151

Passive Mapping mutation

Boolean

152

Poison Breath mutation

Boolean

153

Poison Resistance mutation

Boolean

154

Regeneration mutation

Boolean

155

Repulsion Field mutation

Boolean

156

Robust mutation

Boolean

157

Rugged Brown Scales mutation

Boolean

158

Shaggy Fur mutation

Boolean

159

Slimy Green Scales mutation

Boolean

160

Stinger mutation

Boolean

161

Strong Legs mutation

Boolean

162

Talons mutation

Boolean

163

Tentacle Spike mutation

Boolean

164

Thin Metallic Scales mutation

Boolean

165

Thin Skeletal Structure mutation

Boolean

166

Tough Skin mutation

Boolean

167

Wild Magic mutation

Boolean

168

Yellow Scales mutation

Boolean

Returns:

A list of features representing the player’s stats

get_player_inventory_vector()

Player has 52 inventory slots corresponding to each lowercase and uppercase letter of the English alphabet.

Each item is represented by a vector of size 7:

Vector Index

Description of Data

Data Type if available

0

Item type

1

quantity

Int

2

Item Bonus

Int

3

Is Equipped

Boolean

4

First property

5

Second property

6

Third property

Returns:

a list of size 364 (52 inventory items each represented with 7 features shown above)

get_player_spells_vector()

Player has a maximum of 21 spell slots for spells to be learned.

Each of these 21 spells slots is represented by a vector of 3 values:

Vector Index

Description of Data

Data Type if available

0

Spell ID.

Int repr. spell ID

1

Spell SkillName

Int repr. skill ID

2

Spell SkillName #2

Int repr. skill ID

3

Spell SkillName #3

Int repr. skill ID

4

Failure Likelihood

Int 0-100

5

Spell Level

Int

Additionally, there are 118 spells that can be learned if the player has found a book item with a given spell, therefore we need an additional 118 slots in this vector representing whether each spell is available to be learned.

Returns:

a list of size 21*6 + 118.

get_player_abilities_vector()

There are 94 possible abilities a player may acquire. For each of these abilities, they are represented by the following vector:

Vector Index

Description of Data

Data Type if available

0

Ability is ID

Int repr. spell ID

1

Failure Likelihood

Int 0-100

2

Magic Point Cost

Boolean

3

Piety Point Cost

Boolean

4

Has Delay Cost

Boolean

5

Has Frailty Cost

Boolean

# TODO there are probably more costs (like health, etc) that should end up as additional rows in this table

Returns:

a list of size 94*6.

get_player_skills_vector()

Player has 31 skills that increase over time if the player is actively ‘training’ those skills.

Each skill is represented by a vector of size 3:

Vector Index

Description of Data

Data Type if available

0

Current value

Float

1

Training Percentage

Int (0-100)

2

Aptitude

Int

Returns:

a list of size 93

get_egocentric_LOS_map_data_vector(radius=7)

Returns a vector containing data on the tiles in a ((radius*2)+1)^2 square centered on the player.

See cell.py get_cell_vector() for a description of what is in each cell vector.

get_egocentric_level_map_data_vector()

Returns a vector containing data on the tiles on the player’s current level.

Uses the same tile representation of vectors of size 34 from get_egocentric_LOS_map_data()

Returns a vector with no upperbound if traveling through levels such as Abyss or Labyrinth. More realistically returns a vector ranging from a minimum size of 7,650 (225 LOS tiles * 34) up to possible sizes of 68,000+ (2000 tiles * 34).

get_all_map_data_vector()

Returns a vector containing data on the tiles the player has encountered so far in the game.

Uses the same tile representation of vectors of size 34 from get_egocentric_LOS_map_data()

Returns a vector with no upperbound if traveling through levels such as Abyss or Labyrinth. More realistically returns a vector ranging from a minimum size of 7,650 (225 LOS tiles * 34) up to possible sizes of 3,400,000+ (100,000 tiles * 34).

get_player_stats_pddl()

Returns PDDL 2.2 level 1 which DOES NOT include all aspects of numeric planning.

PDDL predicates that are provided via this function:

  • playerhealth

  • playermagicpoints

  • player_worshipping

  • player_piety

  • player_has_available_spell_slot

  • player_resist_fire

  • player_resist_cold

  • player_resist_neg

  • player_resist_pois

  • player_resist_elec

  • player_resist_corr

  • player_willpower

  • player_stealth

  • player_see_invis

  • player_faith_status

  • player_spirit_status

  • player_reflect_status

  • player_harm_status

  • player_movement_speed

  • player_attack_speed

  • playerplace

  • player_has_status_effect

  • player_has_mutation

Therefore the following player stats aren’t available.

Player Stat

Description of Data

Why not included?

AC

Represents Armour

Non-relative Int

EV

Represents Evasion

Non-relative Int

SH

Represents Shelf

Non-relative Int

Strength

Current value

Non-relative Int

Intelligence

Training Percentage

Non-relative Int

Dexterity

Aptitude

Non-relative Int

Returns a list of PDDL facts representing player stats

get_possible_actions_for_current_menu()
get_inventory_menu_choices()

Returns the menu choices for selecting an item in the inventory menu

get_player_inventory_pddl()

Returns a simple PDDL representation for inventory items that will describe items with the following predicates. Note that this function returns two data objects, first is a list of inventory object names and the second is a list of the pddl facts, as strings, about those objects.

Predicates currently supported: * equipped * cursed * item_bonus (refers to the +3 kinds of bonuses on items) * weapon, scroll, ammunition, potion, or armour (others may be discovered and then must be added here) * only_one_left or more_than_one_remaining

get_player_skills_pddl()

Skill names as objects are already provided in the PDDL domain file since they are constant across all characters and game modes.

Only PDDL facts about whether each skill has training off, low, or high is returned, and the current value of said skill using qualitative quantifiers of: ‘none’, ‘low’, ‘medium_low’, ‘medium’, ‘medium_high’, ‘high’, ‘maxed’

get_egocentric_LOS_map_data_pddl(radius=7)

Returns a list of PDDL facts representing the tiles around the player for the given radius. Information about tiles outside of this radius is not returned.

get_current_level_map_data_pddl()

Returns a list of PDDL facts representing the tiles in player’s current level. Information about tiles outside of the current level is not returned.

get_all_map_data_pddl()

Returns a list of PDDL facts for every tile encountered by the player thus far.

get_background_pddl()

Returns a static list of pddl facts, including all type instances and dungeon level connections.

shift_agent_x(change)

Performs an addition

TODO: Write documentation

shift_agent_y(change)

Performs an addition

TODO: Write documentation

get_cell_map()

Returns the cell map object.

Returns:

the object containing all information per cell of the DCSS game so far

Return type:

CellMap

_process_raw_state(s, last_key='')

TODO: Write documentation

process_menu_text(html_str)
_process_resistances(html_str)
_process_see_invis(html_str)
_process_hp_mp_regen(html_str)
_process_spell_slots(html_str)
_process_mutations(html_str)
_process_items_agent_location(message)
_process_single_spell(message)
_process_single_ability(message)
process_messages(data)
process_attack_move_speeds(s)
process_player(data)
process_player_status(status_list)
process_cursor(data)
process_describe_monster(data)

Process description of cells that describe monsters via the examine mode

get_pddl_current_state_player()
get_pddl_player_info()

Return player health information and other stats

get_pddl_current_state_cellmap(radius=10)
get_current_game_turn()
get_current_game_time()
player_radius_pddl_facts(radius)
all_pddl_facts()
get_all_map_objects_in_pddl()
write_pddl_current_state_to_file(filename, goals)

Filename is assumed to be a relevant filename from the folder that the main script is running

has_agent_died()
is_agent_too_terrified(reset=True)
agent_cannot_move(reset=True)
agent_just_leveled_up(reset=True)
process_inv(data)
process_equip(data)
process_quiver_item(data)
process_quiver_available(data)
get_cell_objs_from_raw_data(cells)
get_player_xy()
get_asp_str()
get_asp_comment_str()
get_training_asp_str()
get_player_cell()
get_tiles_around_player_radius(radius=1)

A radius of 0 is only the players tile A radius of 1 would be 9 tiles, including

  • players tile

  • all tiles 1 away (including diagonal) of the player’s tile

A radius of 2 would be 16+8+1 = 25 tiles (all tiles <= distance of 2 from player) etc…

Returns a factored state representation of the tiles around the player: Example w/ radius of 1 - 9 tiles including the player’s current position and all adjacent tiles in every cardinal direction - tiles are ordered in a clockwise orientation, starting with N, then NE, then E, etc - inner layers come before outer layers - each tile is represented as a factored state:

<objType,monsterLetter,hasCorpse,hereBefore>
  • objType = 0 is empty, 1 is wall, 2 is monster

  • monsterLetter = 27 if noMonster, 0-26 representing the alpha index of the first letter of mon name

  • hasCorpse = 0 if no edible corpse, 1 if edible corpse

  • hereBefore = 0 if first time player on this tile, 1 if player has already been here

Parameters:

radius – Int

Returns:

a factored state representation of the tiles around the player

draw_map()
draw_cell_map()
print_inventory()
get_inventory_vector()
_pretty_print(curr_state, offset=1, last_key='')
printstate()
get_map_obj()
convert_cells_to_map_obj(cells_str)

cells is the data of the map and nearby monsters and enemies received from the server

_process_skill_lines(skill_lines)
src.dcss.state.inventoryitem
Module Contents
Classes

ItemType

Represents a type of item, enum value matches what the game sends over as 'base_type'

InventoryItem

class src.dcss.state.inventoryitem.ItemType

Bases: enum.Enum

Represents a type of item, enum value matches what the game sends over as ‘base_type’

NULL_ITEM_TYPE
WEAPON = 0
AMMUNITION = 1
ARMOUR = 2
SCROLL = 5
POTION = 7
class src.dcss.state.inventoryitem.InventoryItem(id_num, name, quantity, base_type=None)
ITEM_VECTOR_LENGTH = 7
NULL_ITEM_VECTOR
ITEM_TYPE_MAPPING
set_base_type(base_type)
get_base_type()
set_name(name)
get_name()
set_quantity(quantity)
get_quantity()
set_num_id(id_num)
get_num_id()
get_letter()
get_item_bonus()
is_item_equipped()
unequip()
equip()
get_item_type()

Since 0 is a valid value, increase all by 1, so 0 means an empty value

get_property_i(i)
get_item_vector()
  • Indicates that item vector value may be repeated, if more than one property.

Index Information Contained —– ———————

0 Item Type (Armour, Weapon, etc) 1 Item Count 2 Item Bonus (“+x” value) 3 Item Equipped 4 Property* (Fire resist, stealth, venom, etc) 5 Property* (Fire resist, stealth, venom, etc) 6 Property* (Fire resist, stealth, venom, etc)

get_item_pddl()
Returns:

  1. list of pddl object statements where each item has a unique name

  2. list of pddl predicates about that item

Index Information Contained —– ———————

0 Item Type (Armour, Weapon, etc) 1 Item Count 2 Item Bonus (“+x” value) 3 Item Equipped 4 Property* (Fire resist, stealth, venom, etc) 5 Property* (Fire resist, stealth, venom, etc) 6 Property* (Fire resist, stealth, venom, etc)

static get_empty_item_vector()
__eq__(other)

Return self==value.

__str__()

Return str(self).

src.dcss.state.itemproperty
Module Contents
Classes

ItemProperty

See crawl wiki for lists of these:

class src.dcss.state.itemproperty.ItemProperty

Bases: enum.Enum

See crawl wiki for lists of these: weapons: http://crawl.chaosforge.org/Brand armour: http://crawl.chaosforge.org/Ego

NO_PROPERTY = 0
Antimagic_Brand = 1
Chaos_Brand = 2
Disruption_Brand = 3
Distortion_Brand = 4
Dragon_slaying_Brand = 5
Draining_Brand = 6
Electrocution_Brand = 7
Flaming_Brand = 8
Freezing_Brand = 9
Holywrath_Brand = 10
Pain_Brand = 11
Necromancy_Brand = 12
Protection_Brand = 13
Reaping_Brand = 14
Speed_Brand = 15
Vampiricism_Brand = 16
Venom_Brand = 17
Vorpal_Brand = 18
Dispersal_Brand = 19
Exploding_Brand = 20
Penetration_Brand = 21
Poisoned_Brand = 22
Returning_Brand = 23
Silver_Brand = 24
Steel_Brand = 25
Confusion_Brand = 26
Curare_Brand = 27
Frenzy_Brand = 28
Paralysis_Brand = 29
Sleeping_Brand = 30
Resistance_Ego = 31
Fire_Resistance_Ego = 32
Cold_Resistance_Ego = 33
Poison_Resistance_Ego = 34
Positive_Energy_Ego = 35
Protection_Ego = 36
Invisibility_Ego = 37
Magic_Resistance_Ego = 38
Strength_Ego = 39
Dexterity_Ego = 40
Intelligence_Ego = 41
Running_Ego = 42
Flight_Ego = 43
Stealth_Ego = 44
See_Invisible_Ego = 45
Archmagi_Ego = 46
Ponderousness_Ego = 47
Reflection_Ego = 48
Spirit_Shield_Ego = 49
Archery_Ego = 50
src.dcss.state.menu
Module Contents
Classes

Menu

Generic enumeration.

class src.dcss.state.menu.Menu

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

NO_MENU = 1
CHARACTER_CREATION_SELECT_SPECIES = 2
CHARACTER_CREATION_SELECT_BACKGROUND = 3
CHARACTER_CREATION_SELECT_WEAPON = 4
CHARACTER_INVENTORY_MENU = 5
CHARACTER_ITEM_SPECIFIC_MENU = 6
TUTORIAL_SELECTION_MENU = 7
SPRINT_MAP_SELECTION_MENU = 8
ABILITY_MENU = 9
ALL_SPELLS_MENU = 10
SKILL_MENU = 11
ATTRIBUTE_INCREASE_TEXT_MENU = 12
WALK_INTO_TELEPORT_TRAP_TEXT_MENU = 13
EXAMINE_MAP_MENU = 14
INDIVIDUAL_INVENTORY_ITEM_MENU = 15
SCROLL_OF_IDENTIFY_MENU = 16
RENOUNCE_FAITH_TEXT_MENU = 17
ARE_YOU_SURE_TEXT_MENU = 18
src.dcss.state.monster
Module Contents
Classes

Monster

Sample monster data:

MonsterName

Monster name that matches the lowercase pddl repr.

class src.dcss.state.monster.Monster

Sample monster data:

‘mon’: {

‘id’: 1, ‘name’: ‘kobold’, ‘plural’: ‘kobolds’, ‘type’: 187, ‘typedata’: {

‘avghp’: 3

}, ‘att’: 0, ‘btype’: 187, ‘threat’: 1

}

all_possible_g_values
ids_to_monsters
static create_or_update_monster(vals, ascii_sym)
update(vals, ascii_sym)
set_cell(cell)
remove_cell()
get_pddl_strs(pddl_cell_str)

(hasmonster ?cell - cell ?monster - monster) (monster_danger_rating ?cell - cell ?danger - danger_rating) (monster_health ?cell - cell ?amount - qualitative_quantity) (monster_status_effect ?cell - cell ?status - status_effect)

set_health(health: int)
set_danger_rating(danger_rating: str)
set_ac(ac: int)
set_ev(ev: int)
set_mr(mr: int)
get_monster_vector()

Returns a vector of a monster with the following fields:

Vector Index

Description of Data

Data Type if available

0

Monster Type

Int repr. type ID

1

(TODO) Monster is unique

Boolean

2

Monster danger rating

Int

3

Monster current health

Int

4

Monster max health

Int

5

Monster AC

Int

6

Monster EV

Int

7

Monster MR

Int

8

Monster Speed

Int

9

Monster Status Effect 1

Int repr. type ID

10

Monster Status Effect 2

Int repr. type ID

11

Monster Status Effect 3

Int repr. type ID

12

Monster Status Effect 4

Int repr. type ID

13

Monster Status Effect 5

Int repr. type ID

14

Monster Has Spell 1

Int repr. type ID

15

Monster Has Spell 2

Int repr. type ID

16

Monster Has Spell 3

Int repr. type ID

17

Monster Has Spell 4

Int repr. type ID

18

Monster Has Spell 5

Int repr. type ID

19

Monster Has Spell 6

Int repr. type ID

__str__()

Return str(self).

class src.dcss.state.monster.MonsterName

Bases: enum.Enum

Monster name that matches the lowercase pddl repr.

ABOMINATION = 1
ACID_BLOB = 2
ACID_DRAGON = 3
ADDER = 4
AGATE_SNAIL = 5
AGNES = 6
AIR_ELEMENTAL = 7
AIZUL = 8
ALLIGATOR = 9
ALLIGATOR_SNAPPING_TURTLE = 10
ANACONDA = 11
ANCIENT_BEAR = 12
ANCIENT_CHAMPION = 13
ANCIENT_LICH = 14
ANCIENT_ZYME = 15
ANGEL = 16
ANT_LARVA = 17
ANTAEUS = 18
ANUBIS_GUARD = 19
APIS = 20
APOCALYPSE_CRAB = 21
ARACHNE = 22
ARCHER_STATUE = 23
ASMODEUS = 24
ASTERION = 25
AZRAEL = 26
AZURE_JELLY = 27
BABY_ALLIGATOR = 28
BAI_SUZHEN = 29
BALL_LIGHTNING = 30
BALL_PYTHON = 31
BALLISTOMYCETE = 32
BALLISTOMYCETE_SPORE = 33
BALRUG = 34
BARACHI_MONSTER = 35
BASILISK = 36
BAT = 37
BATTLESPHERE = 38
BENNU = 39
BIG_FISH = 40
BIG_KOBOLD = 41
BLACK_BEAR = 42
BLACK_DRACONIAN = 43
BLACK_MAMBA = 44
BLACK_SUN = 45
BLIZZARD_DEMON = 47
BLOATED_HUSK = 48
BLOCK_OF_ICE = 49
BLOOD_SAINT = 50
BLORK_THE_ORC = 51
BLUE_DEATH = 52
BLUE_DEVIL = 53
BOG_BODY = 54
BOG_MUMMY = 55
BOGGART = 56
BONE_DRAGON = 57
BORING_BEETLE = 58
BORIS = 59
BOULDER_BEETLE = 60
BRAIN_WORM = 61
BRIAR_PATCH = 62
BRIMSTONE_FIEND = 63
BROWN_OOZE = 64
BULLFROG = 65
BUMBLEBEE = 66
BUNYIP = 67
BURNING_BUSH = 68
BUTTERFLY = 69
CACODEMON = 70
CANE_TOAD = 71
CATOBLEPAS = 72
CAUSTIC_SHRIKE = 73
CENTAUR_MONSTER = 74
CENTAUR_WARRIOR = 75
CEREBOV = 76
CHAOS_BUTTERFLY = 77
CHAOS_CHAMPION = 78
CHAOS_SPAWN = 79
CHARRED_STATUE = 80
CHERUB = 81
CHIMERA = 82
CHUCK = 83
CLAY_GOLEM = 84
CONJURER_STATUE = 85
CORRUPTER = 86
CRAWLING_CORPSE = 87
CRAZY_YIUF = 88
CRIMSON_IMP = 89
CROCODILE = 90
CRYSTAL_GOLEM = 91
CRYSTAL_GUARDIAN = 92
CURSE_SKULL = 93
CURSE_TOE = 94
CYCLOPS = 95
DAEVA = 96
DANCING_WEAPON = 97
DART_SLUG = 98
DEATH_COB = 99
DEATH_DRAKE = 100
DEATH_KNIGHT = 101
DEATH_OOZE = 102
DEATH_SCARAB = 103
DEATH_YAK = 104
DEATHCAP = 105
DEEP_DWARF_MONSTER = 106
DEEP_DWARF_ARTIFICER = 107
DEEP_DWARF_BERSERKER = 108
DEEP_DWARF_DEATH_KNIGHT = 109
DEEP_DWARF_NECROMANCER = 110
DEEP_DWARF_SCION = 111
DEEP_ELF_ANNIHILATOR = 112
DEEP_ELF_ARCHER = 113
DEEP_ELF_BLADEMASTER = 114
DEEP_ELF_CONJURER = 115
DEEP_ELF_DEATH_MAGE = 116
DEEP_ELF_DEMONOLOGIST = 117
DEEP_ELF_ELEMENTALIST = 118
DEEP_ELF_FIGHTER = 119
DEEP_ELF_HIGH_PRIEST = 120
DEEP_ELF_KNIGHT = 121
DEEP_ELF_MAGE = 122
DEEP_ELF_MASTER_ARCHER = 123
DEEP_ELF_PRIEST = 124
DEEP_ELF_SOLDIER = 125
DEEP_ELF_SORCERER = 126
DEEP_ELF_SUMMONER = 127
DEEP_TROLL = 128
DEEP_TROLL_EARTH_MAGE = 129
DEEP_TROLL_SHAMAN = 130
DEMIGOD_MONSTER = 131
DEMON = 132
DEMONIC_CRAWLER = 133
DEMONIC_MONSTERS = 134
DEMONSPAWN_MONSTER = 135
DERIVED_UNDEAD = 136
DIAMOND_OBELISK = 137
DIRE_ELEPHANT = 138
DISPATER = 139
DISSOLUTION = 140
DONALD = 141
DOOM_HOUND = 142
DOWAN = 143
DRACONIAN_MONSTER = 144
DRACONIAN_ANNIHILATOR = 145
DRACONIAN_KNIGHT = 146
DRACONIAN_MONK = 147
DRACONIAN_SCORCHER = 148
DRACONIAN_SHIFTER = 149
DRACONIAN_STORMCALLER = 150
DRACONIAN_ZEALOT = 151
DREAM_SHEEP = 152
DROWNED_SOUL = 153
DRYAD = 154
DUANE = 155
DUVESSA = 156
DWARF = 157
EARTH_ELEMENTAL = 158
EDMUND = 159
EFREET = 160
EIDOLON = 161
ELDRITCH_TENTACLE = 162
ELECTRIC_EEL = 163
ELECTRIC_GOLEM = 164
ELEIONOMA = 165
ELEMENTAL_WELLSPRING = 166
ELEPHANT = 167
ELEPHANT_SLUG = 168
ELF = 169
EMPEROR_SCORPION = 170
ENTROPY_WEAVER = 171
ERESHKIGAL = 172
ERICA = 173
EROLCHA = 174
ETTIN = 175
EUSTACHIO = 176
EXECUTIONER = 177
EYE_OF_DEVASTATION = 178
EYE_OF_DRAINING = 179
FANNAR = 180
FAUN = 181
FELID_MONSTER = 182
FENSTRIDER_WITCH = 183
FIRE_BAT = 184
FIRE_CRAB = 185
FIRE_DRAGON = 186
FIRE_DRAKE = 187
FIRE_ELEMENTAL = 188
FIRE_GIANT = 189
FIRE_VORTEX = 190
FIRESPITTER_STATUE = 191
FLAMING_CORPSE = 192
FLAYED_GHOST = 193
FLOATING_EYE = 194
FLYING_SKULL = 195
FORMICID_MONSTER = 196
FORMICID_DRONE = 197
FORMICID_VENOM_MAGE = 198
FRANCES = 199
FRANCIS = 200
FREDERICK = 201
FREEZING_WRAITH = 202
FRILLED_LIZARD = 203
FROST_GIANT = 204
FROST_COVERED_STATUE = 205
GARGOYLE_MONSTER = 206
GASTRONOK = 207
GELID_DEMONSPAWN = 208
GERYON = 209
GHOST_CRAB = 210
GHOST_MOTH = 211
GHOUL_MONSTER = 212
GIANT_AMOEBA = 213
GIANT_BLOWFLY = 214
GIANT_CENTIPEDE = 215
GIANT_COCKROACH = 216
GIANT_FIREFLY = 217
GIANT_GOLDFISH = 218
GIANT_MITE = 219
GIANT_SLUG = 220
GIANT_TOAD = 221
GILA_MONSTER = 222
GLOORX_VLOQ = 223
GLOWING_ORANGE_BRAIN = 224
GLOWING_SHAPESHIFTER = 225
GNOLL_MONSTER = 226
GNOLL_SERGEANT = 227
GNOLL_SHAMAN = 228
GOBLIN = 229
GOLDEN_DRAGON = 230
GOLDEN_EYE = 231
GOLIATH_BEETLE = 232
GOLIATH_FROG = 233
GRAND_AVATAR_MONSTER = 234
GREAT_ORB_OF_EYES = 235
GREEN_DEATH = 236
GREEN_DRACONIAN = 237
GREY_DRACONIAN = 238
GREY_RAT = 239
GRIFFON = 240
GRINDER = 241
GRIZZLY_BEAR = 242
GRUM = 243
GUARDIAN_GOLEM = 244
GUARDIAN_MUMMY = 245
GUARDIAN_NAGA = 246
GUARDIAN_SERPENT = 247
HAIRY_DEVIL = 248
HALAZID_WARLOCK = 249
HALFLING_MONSTER = 250
HAROLD = 251
HARPY = 252
HELL_BEAST = 253
HELL_HOG = 254
HELL_HOUND = 255
HELL_KNIGHT = 256
HELL_RAT = 257
HELL_SENTINEL = 258
HELLEPHANT = 259
HELLION = 260
HELLWING = 261
HILL_GIANT = 262
HIPPOGRIFF = 263
HOBGOBLIN = 264
HOG = 265
HOLY_SWINE = 266
HORNET = 267
HOUND = 268
HOWLER_MONKEY = 269
HUMAN_MONSTER = 270
HUNGRY_GHOST = 271
HYDRA = 272
ICE_BEAST = 273
ICE_DEVIL = 274
ICE_DRAGON = 275
ICE_FIEND = 276
ICE_STATUE = 277
IGNACIO = 278
IGNIS = 279
IGUANA = 280
IJYB = 281
ILSUIW = 282
IMPERIAL_MYRMIDON = 283
INEPT_MIMIC = 284
INFERNAL_DEMONSPAWN = 285
INSUBSTANTIAL_WISP = 286
IRON_DEVIL = 287
IRON_DRAGON = 288
IRON_ELEMENTAL = 289
IRON_GIANT = 290
IRON_GOLEM = 291
IRON_IMP = 292
IRON_TROLL = 293
IRONBRAND_CONVOKER = 294
IRONHEART_PRESERVER = 295
JACKAL = 296
JELLY = 297
JELLYFISH = 298
JESSICA = 299
JIANGSHI = 300
JORGRUN = 301
JORY = 302
JOSEPH = 303
JOSEPHINE = 304
JOZEF = 305
JUGGERNAUT = 306
JUMPING_SPIDER = 307
KHUFU = 308
KILLER_BEE = 309
KILLER_BEE_LARVA = 310
KILLER_KLOWN = 311
KIRKE = 312
KOBOLD_MONSTER = 313
KOBOLD_DEMONOLOGIST = 314
KOMODO_DRAGON = 315
KRAKEN = 316
LABORATORY_RAT = 317
LAMIA = 318
LARGE_ABOMINATION = 319
LASHER_STATUE = 320
LAVA_FISH = 321
LAVA_SNAKE = 322
LAVA_WORM = 323
LEMURE = 324
LEOPARD_GECKO = 325
LICH = 326
LIGHTNING_SPIRE = 327
LINDWURM = 328
LIST_OF_MONSTERS = 329
LOM_LOBON = 330
LOROCYPROCA = 331
LOST_SOUL = 332
LOUISE = 333
LURKING_HORROR = 334
MACABRE_MASS = 335
MAGGIE = 336
MANA_VIPER = 337
MANTICORE = 338
MARA = 339
MARGERY = 340
MASTER_BLASTER = 341
MASTER_ELEMENTALIST = 342
MAUD = 343
MAURICE = 344
MELIAI = 345
MENKAURE = 346
MENNAS = 347
MERFOLK = 348
MERFOLK_MONSTER = 349
MERFOLK_AQUAMANCER = 350
MERFOLK_AVATAR = 351
MERFOLK_IMPALER = 352
MERFOLK_JAVELINEER = 353
MERFOLK_SIREN = 354
MERMAID = 355
METAL_GARGOYLE = 356
MICHAEL = 357
MIDGE = 358
MIMIC_MONSTER = 359
MINOTAUR_MONSTER = 360
MNOLEG = 361
MOLTEN_GARGOYLE = 362
MONSTER_ATTRIBUTES = 363
MONSTER_GENERATION = 364
MONSTERS = 365
MONSTROUS_DEMONSPAWN = 366
MOTH_OF_SUPPRESSION = 367
MOTH_OF_WRATH = 368
MOTTLED_DRACONIAN = 369
MOTTLED_DRAGON = 370
MUMMY_MONSTER = 371
MUMMY_PRIEST = 372
MURRAY = 373
NAGA_MONSTER = 374
NAGA_MAGE = 375
NAGA_RITUALIST = 376
NAGA_SHARPSHOOTER = 377
NAGA_WARRIOR = 378
NAGARAJA = 379
NAMELESS_HORROR = 380
NATASHA = 381
NECROMANCER_MONSTER = 382
NECROPHAGE = 383
NELLIE = 384
NEQOXEC = 385
NERGALLE = 386
NESSOS = 387
NIKOLA = 388
NORBERT = 389
NORRIS = 390
OBSIDIAN_STATUE = 391
OCTOPODE_MONSTER = 392
OCTOPODE_CRUSHER = 393
OGRE_MONSTER = 394
OGRE_MAGE = 395
OKLOB_PLANT = 396
OKLOB_SAPLING = 397
OOZE = 398
OPHAN = 399
ORANGE_CRYSTAL_STATUE = 400
ORANGE_DEMON = 401
ORB_GUARDIAN = 402
ORB_OF_FIRE = 403
ORB_SPIDER = 404
ORC = 405
ORC_HIGH_PRIEST = 406
ORC_KNIGHT = 407
ORC_PRIEST = 408
ORC_SORCERER = 409
ORC_WARLORD = 410
ORC_WARRIOR = 411
ORC_WIZARD = 412
PALADIN_MONSTER = 413
PALE_DRACONIAN = 414
PAN_MONSTER = 415
PANDEMONIUM_LORD = 416
PEACEKEEPER = 417
PEARL_DRAGON = 418
PHANTASMAL_WARRIOR = 419
PHANTOM = 420
PHOENIX = 421
PIKEL = 422
PILLAR_OF_SALT = 423
PIT_FIEND = 424
PLAGUE_SHAMBLER = 425
POLAR_BEAR = 426
POLYMOTH = 427
POLYPHEMUS = 428
PORCUPINE = 429
PRIESTS = 430
PRINCE_RIBBIT = 431
PROFANE_SERVITOR = 432
PSYCHE = 433
PULSATING_LUMP = 434
PURGY = 435
PURPLE_DRACONIAN = 436
PUTRID_DEMONSPAWN = 437
QUASIT = 438
QUEEN_ANT = 439
QUEEN_BEE = 440
QUICKSILVER_DRAGON = 441
QUOKKA = 442
RAGGED_HIEROPHANT = 443
RAIJU = 444
RAKSHASA = 445
RAT = 446
RAVEN = 447
RAVENOUS_MIMIC = 448
REAPER = 449
RED_DEVIL = 450
RED_DRACONIAN = 451
REDBACK = 452
REVENANT = 453
RIME_DRAKE = 454
RIVER_RAT = 455
ROBIN = 456
ROCK_TROLL = 457
ROCK_WORM = 458
ROTTING_DEVIL = 459
ROTTING_HULK = 460
ROXANNE = 461
ROYAL_MUMMY = 462
RUPERT = 463
RUST_DEVIL = 464
SAINT_ROKA = 465
SALAMANDER = 466
SALAMANDER_FIREBRAND = 467
SALAMANDER_MYSTIC = 468
SALAMANDER_STORMCALLER = 469
SALTLING = 470
SATYR = 471
SCORPION = 472
SEA_SNAKE = 473
SERAPH = 474
SERPENT_OF_HELL_COCYTUS = 475
SERPENT_OF_HELL_DIS = 476
SERPENT_OF_HELL_GEHENNA = 477
SERPENT_OF_HELL_TARTARUS = 478
SERVANT_OF_WHISPERS = 479
SHADOW = 480
SHADOW_DEMON = 481
SHADOW_DRAGON = 482
SHADOW_IMP = 483
SHADOW_WRAITH = 484
SHAMBLING_MANGROVE = 485
SHAPESHIFTER = 486
SHARD_SHRIKE = 487
SHARK = 488
SHEDU = 489
SHEEP = 490
SHINING_EYE = 491
SHOCK_SERPENT = 492
SIGMUND = 493
SILENT_SPECTRE = 494
SILVER_STAR = 495
SILVER_STATUE = 496
SIMULACRUM_MONSTER = 497
SIXFIRHY = 498
SKELETAL_WARRIOR = 499
SKELETON_MONSTER = 500
SKY_BEAST = 501
SLAVE = 502
SLIME_CREATURE = 503
SMALL_ABOMINATION = 504
SMOKE_DEMON = 505
SNAIL_STATUE = 506
SNAPLASHER_VINE = 507
SNAPPING_TURTLE = 508
SNORG = 509
SOJOBO = 510
SOLDIER_ANT = 511
SONJA = 512
SOUL_EATER = 513
SPARK_WASP = 514
SPATIAL_MAELSTROM = 515
SPATIAL_VORTEX = 516
SPECTRAL_THING = 517
SPELLFORGED_SERVITOR_MONSTER = 518
SPHINX = 519
SPIDER = 520
SPINY_WORM = 521
SPIRIT = 522
SPIRIT_WOLF = 523
SPOOKY_STATUE = 524
SPRIGGAN_MONSTER = 525
SPRIGGAN_AIR_MAGE = 526
SPRIGGAN_ASSASSIN = 527
SPRIGGAN_BERSERKER = 528
SPRIGGAN_DEFENDER = 529
SPRIGGAN_DRUID = 530
SPRIGGAN_ENCHANTER = 531
SPRIGGAN_RIDER = 532
STARCURSED_MASS = 533
STEAM_DRAGON = 534
STONE_GIANT = 535
STONE_GOLEM = 536
STORM_DRAGON = 537
SUBTRACTOR_SNAKE = 538
SUN_DEMON = 539
SWAMP_DRAGON = 540
SWAMP_DRAKE = 541
SWAMP_WORM = 542
TARANTELLA = 543
TENGU_MONSTER = 545
TENGU_CONJURER = 546
TENGU_REAVER = 547
TENGU_WARRIOR = 548
TENTACLED_MONSTROSITY = 549
TENTACLED_STARSPAWN = 550
TERENCE = 551
TERPSICHORE = 552
TEST_SPAWNER = 553
THE_ENCHANTRESS = 554
THE_IRON_GIANT = 555
THE_LERNAEAN_HYDRA = 556
THE_ROYAL_JELLY = 557
THORN_HUNTER = 558
THORN_LOTUS = 559
THRASHING_HORROR = 560
TIAMAT = 561
TITAN = 562
TOADSTOOL = 563
TOENAIL_GOLEM = 564
TORMENTOR = 565
TORPOR_SNAIL = 566
TORTUROUS_DEMONSPAWN = 567
TRAINING_DUMMY = 568
TROLL = 569
TROLL_MONSTER = 570
TWISTER = 571
TWO_HEADED_OGRE = 572
TYRANT_LEECH = 573
TZITZIMITL = 574
UFETUBUS = 575
UGLY_THING = 576
UNBORN = 577
UNBORN_DEEP_DWARF = 578
UNSEEN_HORROR = 579
URUG = 580
USHABTI = 581
VAMPIRE_MONSTER = 582
VAMPIRE_BAT = 583
VAMPIRE_KNIGHT = 584
VAMPIRE_MAGE = 585
VAMPIRE_MOSQUITO = 586
VAPOUR = 587
VASHNIA = 588
VAULT_GUARD = 589
VAULT_SENTINEL = 590
VAULT_WARDEN = 591
VERY_UGLY_THING = 592
VINE_STALKER_MONSTER = 593
VIPER = 594
WANDERING_MUSHROOM = 595
WAR_DOG = 596
WAR_GARGOYLE = 597
WARG = 598
WARMONGER = 599
WASP = 600
WATER_ELEMENTAL = 601
WATER_MOCCASIN = 602
WATER_NYMPH = 603
WHITE_DRACONIAN = 604
WHITE_IMP = 605
WIGHT = 606
WIGLAF = 607
WILL_O_THE_WISP = 608
WIND_DRAKE = 609
WIZARD_MONSTER = 610
WIZARD_STATUE = 611
WOLF = 612
WOLF_SPIDER = 613
WOOD_GOLEM = 614
WORKER_ANT = 615
WORLDBINDER = 616
WORM = 617
WRAITH = 618
WRETCHED_STAR = 619
WYVERN = 620
XTAHUA = 621
YAK = 622
YAKTAUR = 623
YAKTAUR_CAPTAIN = 624
YELLOW_DRACONIAN = 625
YNOXINUL = 626
ZOMBIE = 627
ZOT_STATUE = 628
src.dcss.state.mutation
Module Contents
Classes

Mutation

Represents a mutation in the game.

MutationMapping

Assists parsing what mutations the player has from websocket data

MutationPDDLMapping

Assists writing pddl what mutation the player has

class src.dcss.state.mutation.Mutation

Bases: enum.Enum

Represents a mutation in the game.

ACUTE_VISION_MUTATION = 1
ANTENNAE_MUTATION = 2
BEAK_MUTATION = 3
BIG_WINGS_MUTATION = 4
CAMOUFLAGE_MUTATION = 6
CLARITY_MUTATION = 7
CLAWS_MUTATION = 8
COLD_RESISTANCE_MUTATION = 9
ELECTRICITY_RESISTANCE_MUTATION = 10
EVOLUTION_MUTATION = 11
FANGS_MUTATION = 12
FIRE_RESISTANCE_MUTATION = 13
HIGH_MP_MUTATION = 14
HOOVES_MUTATION = 15
HORNS_MUTATION = 16
ICY_BLUE_SCALES_MUTATION = 17
IMPROVED_ATTRIBUTES_MUTATION = 18
IRIDESCENT_SCALES_MUTATION = 19
LARGE_BONE_PLATES_MUTATION = 20
MAGIC_RESISTANCE_MUTATION = 21
MOLTEN_SCALES_MUTATION = 22
MUTATION_RESISTANCE_MUTATION = 23
PASSIVE_MAPPING_MUTATION = 24
POISON_BREATH_MUTATION = 25
POISON_RESISTANCE_MUTATION = 26
REGENERATION_MUTATION = 27
REPULSION_FIELD_MUTATION = 28
ROBUST_MUTATION = 29
RUGGED_BROWN_SCALES_MUTATION = 30
SHAGGY_FUR_MUTATION = 31
SLIMY_GREEN_SCALES_MUTATION = 32
STINGER_MUTATION = 33
STRONG_LEGS_MUTATION = 34
TALONS_MUTATION = 35
TENTACLE_SPIKE_MUTATION = 36
THIN_METALLIC_SCALES_MUTATION = 37
THIN_SKELETAL_STRUCTURE_MUTATION = 38
TOUGH_SKIN_MUTATION = 39
WILD_MAGIC_MUTATION = 40
YELLOW_SCALES_MUTATION = 41
OFFHAND_PUNCH_AUX_ATK_MUTATION = 101
OFFHAND_PUNCH_W_CLAWS_AUX_ATK_MUTATION = 102
OFFHAND_PUNCH_W__BLADE_HANDS_AUX_ATK_MUTATION = 103
HEADBUTT_AUX_ATK_MUTATION = 104
PECK_AUX_ATK_MUTATION = 105
KICK_W_HOOVES_AUX_ATK_MUTATION = 106
KICK_W_TALONS_AUX_ATK_MUTATION = 107
TAIL_SLAP_AUX_ATK_MUTATION = 108
TAIL_SLAP_W_STINGER_AUX_ATK_MUTATION = 109
BITE_W_FANGS_AUX_ATK_MUTATION = 1010
BITE_W_ACIDIC_BITE_AUX_ATK_MUTATION = 1011
BITE_W_ANTI_MAGIC_BITE_AUX_ATK_MUTATION = 1012
PSEUDOPODS_AUX_ATK_MUTATION = 1013
TENTACLE_SPIKE_AUX_ATK_MUTATION = 1014
TENTACLE_SLAP_AUX_ATK_MUTATION = 1015
TENTACLES_SQUEEZE_AUX_ATK_MUTATION = 1016
CONSTRICTION_AUX_ATK_MUTATION = 1017
class src.dcss.state.mutation.MutationMapping

Assists parsing what mutations the player has from websocket data

mutation_menu_messages_lookup
class src.dcss.state.mutation.MutationPDDLMapping

Assists writing pddl what mutation the player has

mutation_pddl_lookup
src.dcss.state.pddl
Module Contents
Functions

get_pddl_problem(→ str)

Returns a complete pddl state string ready to be passed to a planner, given the domain name, objects, init facts,

src.dcss.state.pddl.get_pddl_problem(domainname: str = 'dcss', problemname: str = 'test_prob', objects: [str] = None, init_facts: [str] = None, goals: [str] = None, map_s: str = None) str

Returns a complete pddl state string ready to be passed to a planner, given the domain name, objects, init facts, and goals.

Parameters:
  • domainname – name to match to the corresponding pddl domain file, by default this is “dcss” to match the “models/fastdownward_simple.pddl” domain file.

  • problemname – name to identify this state file, change it if you’d like something more descriptive

  • objects – all objects to be included under the :objects clause

  • init_facts – all facts to be included under the :init clause

  • goals – all goals to be included under the (:goal clause and if more than one is given, will automatically be listed as part of an “(and” clause

Returns:

a string containing a complete pddl state file, ready to be given to a pddl planner

src.dcss.state.player
Module Contents
Classes

MovementSpeed

Generic enumeration.

AttackSpeed

Generic enumeration.

class src.dcss.state.player.MovementSpeed

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

UNKNOWN = 0
VERY_SLOW = 1
SLOW = 2
AVERAGE = 3
QUICK = 4
VERY_QUICK = 5
class src.dcss.state.player.AttackSpeed

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

UNKNOWN = 0
BLINDINGLY_FAST = 1
EXTREMELY_FAST = 2
VERY_FAST = 3
QUITE_FAST = 4
ABOVE_AVERAGE = 5
AVERAGE = 6
BELOW_AVERAGE = 7
QUITE_SLOW = 8
VERY_SLOW = 9
EXTREMELY_SLOW = 10
src.dcss.state.skill
Module Contents
Classes

SkillName

Represents a skill

SkillMapping

Assists parsing what skill the player has from websocket data

Skill

Represents a skill of a player, including its current level and whether the player is training it (and by how much).

class src.dcss.state.skill.SkillName

Bases: enum.Enum

Represents a skill

NULL_SKILL_SPECIAL_CASE = 0
FIGHTING = 1
LONG_BLADES = 2
SHORT_BLADES = 3
AXES = 4
MACES_FLAILS = 5
POLEARMS = 6
STAVES = 7
UNARMED_COMBAT = 8
BOWS = 9
CROSSBOWS = 10
THROWING = 11
SLINGS = 12
ARMOUR = 13
DODGING = 14
SHIELDS = 15
SPELLCASTING = 16
CONJURATIONS = 17
HEXES = 18
CHARMS = 19
SUMMONINGS = 20
NECROMANCY = 21
TRANSLOCATIONS = 22
TRANSMUTATION = 23
FIRE_MAGIC = 24
ICE_MAGIC = 25
AIR_MAGIC = 26
EARTH_MAGIC = 27
POISON_MAGIC = 28
INVOCATIONS = 29
EVOCATIONS = 30
STEALTH = 31
class src.dcss.state.skill.SkillMapping

Assists parsing what skill the player has from websocket data

skill_game_text_lookup
skill_name_to_pddl_obj
class src.dcss.state.skill.Skill(skillname: SkillName, menuchoice: dcss.actions.menuchoice.MenuChoice, level: float, percent_currently_training: int, aptitude: int)

Represents a skill of a player, including its current level and whether the player is training it (and by how much).

NULL_SKILL_VECTOR
get_skill_vector()
get_skill_pddl()

Returns predicates about this skill consisting of:

(training_off ?skill - skill) (training_low ?skill - skill) (training_high ?skill - skill) (player_skill_level ?skill - skill ?amount - qualitative_quantity)

src.dcss.state.spell
Module Contents
Classes

SpellName

Represents a spell

SpellNameMapping

Assists parsing what spell the player has from websocket data

Spell

Represent a spell that a player can or has learned.

class src.dcss.state.spell.SpellName

Bases: enum.Enum

Represents a spell

NULL_SPELL_SPECIAL_CASE = 0
ABSOLUTE_ZERO = 2
AGONY = 3
AIRSTRIKE = 4
ALISTAIRS_INTOXICATION = 5
ANIMATE_DEAD = 6
ANIMATE_SKELETON = 7
APPORTATION = 8
AURA_OF_ABJURATION = 9
BEASTLY_APPENDAGE = 10
BLADE_HANDS = 11
BOLT_OF_MAGMA = 13
BORGNJORS_REVIVIFICATION = 14
BORGNJORS_VILE_CLUTCH = 15
CALL_CANINE_FAMILIAR = 16
CALL_IMP = 17
CAUSE_FEAR = 18
CHAIN_LIGHTNING = 19
CONFUSING_TOUCH = 20
CONJURE_BALL_LIGHTNING = 21
CONJURE_FLAME = 22
CORONA = 24
CORPSE_ROT = 25
DAZZLING_FLASH = 26
DEATH_CHANNEL = 27
DEATHS_DOOR = 28
DISCORD = 29
DISJUNCTION = 30
DISPEL_UNDEAD = 31
DISPERSAL = 32
DRAGON_FORM = 33
DRAGONS_CALL = 34
ENSORCELLED_HIBERNATION = 35
ERINGYAS_NOXIOUS_BOG = 36
EXCRUCIATING_WOUNDS = 37
FIRE_STORM = 38
FIREBALL = 39
FOXFIRE = 40
FREEZE = 41
FREEZING_CLOUD = 42
FROZEN_RAMPARTS = 43
FULMINANT_PRISM = 44
GELLS_GRAVITAS = 45
HAILSTORM = 46
HAUNT = 47
HYDRA_FORM = 48
ICE_FORM = 49
IGNITE_POISON = 50
IGNITION = 51
INFESTATION = 52
INFUSION = 53
INNER_FLAME = 54
INVISIBILITY = 55
IRON_SHOT = 56
IRRADIATE = 57
ISKENDERUNS_BATTLESPHERE = 58
ISKENDERUNS_MYSTIC_BLAST = 59
LEDAS_LIQUEFACTION = 60
LEES_RAPID_DECONSTRUCTION = 61
LEHUDIBS_CRYSTAL_SPEAR = 62
LESSER_BECKONING = 63
LIGHTNING_BOLT = 64
MAGIC_DART = 65
MALIGN_GATEWAY = 66
MEPHITIC_CLOUD = 67
METABOLIC_ENGLACIATION = 68
MONSTROUS_MENAGERIE = 69
NECROMUTATION = 70
OLGREBS_TOXIC_RADIANCE = 71
ORB_OF_DESTRUCTION = 72
OZOCUBUS_ARMOUR = 73
OZOCUBUS_REFRIGERATION = 74
PAIN = 75
PASSAGE_OF_GOLUBRIA = 76
PASSWALL = 77
PETRIFY = 78
POISONOUS_VAPOURS = 79
PORTAL_PROJECTILE = 80
RECALL = 81
RING_OF_FLAMES = 82
SANDBLAST = 83
SEARING_RAY = 84
SHADOW_CREATURES = 85
SHATTER = 86
SHOCK = 87
SHROUD_OF_GOLUBRIA = 88
SILENCE = 89
SIMULACRUM = 90
SLOW = 91
SONG_OF_SLAYING = 92
SPECTRAL_WEAPON = 93
SPELLFORGED_SERVITOR = 94
SPIDER_FORM = 95
STARBURST = 96
STATIC_DISCHARGE = 97
STATUE_FORM = 98
STICKS_TO_SNAKES = 99
STICKY_FLAME = 100
STING = 101
STONE_ARROW = 102
SUBLIMATION_OF_BLOOD = 103
SUMMON_DEMON = 104
SUMMON_FOREST = 105
SUMMON_GREATER_DEMON = 106
SUMMON_GUARDIAN_GOLEM = 107
SUMMON_HORRIBLE_THINGS = 108
SUMMON_HYDRA = 109
SUMMON_ICE_BEAST = 110
SUMMON_LIGHTNING_SPIRE = 111
SUMMON_MANA_VIPER = 112
SUMMON_SMALL_MAMMAL = 113
SWIFTNESS = 114
TELEPORT_OTHER = 115
TORNADO = 116
TUKIMAS_DANCE = 117
VAMPIRIC_DRAINING = 118
YARAS_VIOLENT_UNRAVELLING = 119
class src.dcss.state.spell.SpellNameMapping

Assists parsing what spell the player has from websocket data

spell_game_text_lookup
class src.dcss.state.spell.Spell(spellname: SpellName, skills: [dcss.state.skill.SkillName], fail_chance: int, level: int)

Represent a spell that a player can or has learned.

NULL_SPELL_VECTOR
get_spell_vector()
get_spell_pddl()
__hash__()

Return hash(self).

__eq__(other)

Return self==value.

src.dcss.state.statuseffect
Module Contents
Classes

StatusEffect

Represents a status effect, including abilities

StatusEffectMapping

Assists parsing what status effect the player has from websocket data

StatusEffectPDDLMapping

Assists writing pddl what status effect the player has

class src.dcss.state.statuseffect.StatusEffect

Bases: enum.Enum

Represents a status effect, including abilities

AGILE_STATUS_EFFECT = 1
ALIVE_STATUS_EFFECT = 91
ANTIMAGIC_STATUS_EFFECT = 2
AUGMENTATION_STATUS_EFFECT = 3
BAD_FORMS_STATUS_EFFECT = 4
BERSERK_STATUS_EFFECT = 5
BLACK_MARK_STATUS_EFFECT = 6
BLIND_STATUS_EFFECT = 7
BLOODLESS_STATUS_EFFECT = 92
BRILLIANT_STATUS_EFFECT = 8
CHARM_STATUS_EFFECT = 9
CONFUSING_TOUCH_STATUS_EFFECT = 10
CONFUSION_STATUS_EFFECT = 11
CONSTRICTION_STATUS_EFFECT = 12
COOLDOWNS_STATUS_EFFECT = 13
CORONA_STATUS_EFFECT = 14
CORROSION_STATUS_EFFECT = 15
DARKNESS_STATUS_EFFECT = 16
DAZED_STATUS_EFFECT = 17
DEATH_CHANNEL_STATUS_EFFECT = 18
DEATHS_DOOR_STATUS_EFFECT = 19
DEFLECT_MISSILES_STATUS_EFFECT = 20
DISJUNCTION_STATUS_EFFECT = 21
DIVINE_PROTECTION_STATUS_EFFECT = 22
DIVINE_SHIELD_STATUS_EFFECT = 23
DOOM_HOWL_STATUS_EFFECT = 24
DRAIN_STATUS_EFFECT = 25
ENGORGED_STATUS_EFFECT = 26
ENGULF_STATUS_EFFECT = 27
FAST_SLOW_STATUS_EFFECT = 28
FEAR_STATUS_EFFECT = 29
FINESSE_STATUS_EFFECT = 30
FIRE_VULNERABLE_STATUS_EFFECT = 31
FLAYED_STATUS_EFFECT = 32
FLIGHT_STATUS_EFFECT = 33
FROZEN_STATUS_EFFECT = 34
HASTE_STATUS_EFFECT = 35
HEAVENLY_STORM_STATUS_EFFECT = 36
HELD_STATUS_EFFECT = 37
HEROISM_STATUS_EFFECT = 38
HORRIFIED_STATUS_EFFECT = 39
INNER_FLAME_STATUS_EFFECT = 40
INVISIBILITY_STATUS_EFFECT = 41
LAVA_STATUS_EFFECT = 42
LEDAS_LIQUEFACTION_STATUS_EFFECT = 43
MAGIC_CONTAMINATION_STATUS_EFFECT = 45
MARK_STATUS_EFFECT = 46
MESMERISED_STATUS_EFFECT = 47
MIGHT_STATUS_EFFECT = 48
MIRROR_DAMAGE_STATUS_EFFECT = 49
NO_POTIONS_STATUS_EFFECT = 50
NO_SCROLLS_STATUS_EFFECT = 51
OLGREBS_TOXIC_RADIANCE_STATUS_EFFECT = 52
ORB_STATUS_EFFECT = 53
OZOCUBUS_ARMOUR_STATUS_EFFECT = 54
PARALYSIS_STATUS_EFFECT = 55
PETRIFYING_STATUS_EFFECT = 56
PETRIFIED_STATUS_EFFECT = 91
POISON_STATUS_EFFECT = 57
POWERED_BY_DEATH_STATUS_EFFECT = 58
QUAD_DAMAGE_STATUS_EFFECT = 59
RECALL_STATUS_EFFECT = 60
REGENERATING_STATUS_EFFECT = 61
REPEL_MISSILES_STATUS_EFFECT = 62
RESISTANCE_STATUS_EFFECT = 63
RING_OF_FLAMES_STATUS_EFFECT = 64
SAPPED_MAGIC_STATUS_EFFECT = 65
SCRYING_STATUS_EFFECT = 66
SEARING_RAY_STATUS_EFFECT = 67
SERPENTS_LASH_STATUS_EFFECT = 68
SHROUD_OF_GOLUBRIA_STATUS_EFFECT = 69
SICKNESS_STATUS_EFFECT = 70
SILENCE_STATUS_EFFECT = 71
SLEEP_STATUS_EFFECT = 73
SLIMIFY_STATUS_EFFECT = 74
SLOW_STATUS_EFFECT = 75
SLUGGISH_STATUS_EFFECT = 76
STARVING_STATUS_EFFECT = 77
STAT_ZERO_STATUS_EFFECT = 78
STICKY_FLAME_STATUS_EFFECT = 79
STILL_WINDS_STATUS_EFFECT = 80
SWIFTNESS_STATUS_EFFECT = 81
TELEPORT_PREVENTION_STATUS_EFFECT = 82
TELEPORT_STATUS_EFFECT = 83
TORNADO_STATUS_EFFECT = 84
TRANSMUTATIONS_STATUS_EFFECT = 85
UMBRA_STATUS_EFFECT = 86
VITALISATION_STATUS_EFFECT = 87
VULNERABLE_STATUS_EFFECT = 88
WATER_STATUS_EFFECT = 89
WEAK_STATUS_EFFECT = 90
WISP_STATUS_EFFECT = 91
ZOT_STATUS_EFFECT = 92
UNABLE_TO_BERSERK_STATUS_EFFECT = 93
class src.dcss.state.statuseffect.StatusEffectMapping

Assists parsing what status effect the player has from websocket data

status_effect_menu_messages_lookup
class src.dcss.state.statuseffect.StatusEffectPDDLMapping

Assists writing pddl what status effect the player has

status_effect_pddl_lookup
src.dcss.state.terrain
Module Contents
Classes

TerrainType

Represents terrain of a tile

class src.dcss.state.terrain.TerrainType

Bases: enum.Enum

Represents terrain of a tile

NULL_SPELL_SPECIAL_CASE = 0
WALL = 1
CLOSED_DOOR = 2
OPENED_DOOR = 3
TREE = 4
LAVA = 5
SHALLOW_WATER = 6
DEEP_WATER = 7
STAIRS_DOWN = 8
STAIRS_UP = 9
SHAFT_DOWN = 10
SHAFT_UP = 11
src.dcss.state.tilefeatures
Module Contents
Classes

TileFeatures

Contains feature data used per tile

class src.dcss.state.tilefeatures.TileFeatures

Contains feature data used per tile

Returns a factored state representation of the tiles around the player:

Example w/ radius of 1 - 9 tiles including the player’s current position and all adjacent tiles in every cardinal direction - each tile is represented as a factored state:

<objType,monsterLetter,hasCorpse,hereBefore>
  • objType = 0 is empty, 1 is wall, 2 is monster

  • monsterLetter = 0-25 representing the alpha index of the first letter of mon name (0=a, etc)

  • hasCorpse = 0 if no edible corpse, 1 if edible corpse

  • hereBefore = 0 if first time player on this tile, 1 if player has already been here

absolute_x
absolute_y
has_monster = 0
last_visit
Submodules
src.dcss.main
Make sure to run crawl before running this demo, see:

start_crawl_terminal_sprint.sh

Module Contents
Functions

main()

src.dcss.main.main()
src.dcss.main_external_demo
Module Contents
Classes

MyAgent

Attributes

my_config

class src.dcss.main_external_demo.MyAgent

Bases: dcss.agent.base.BaseAgent

get_action(gamestate: dcss.state.game.GameState)
src.dcss.main_external_demo.my_config
src.dcss.main_external_demo_fastdownward
Module Contents
Classes

FastdownwardAgent

Attributes

my_config

class src.dcss.main_external_demo_fastdownward.FastdownwardAgent

Bases: dcss.agent.base.BaseAgent

pddl_domain_file = ''
get_action(gamestate: dcss.state.game.GameState)
get_random_nonvisited_nonwall_playerat_goal()
get_plan_from_fast_downward(goals)
write_data_to_file()
get_blue_tile_goal(i)
get_random_simple_action()
requesting_start_new_game()

This function enables the agent class to decide to start a new game. By default this is false, and subclasses of BaseAgent should implement this function to return True whenever a new game should begin. This function is especially helpful when you have some arbitrary criteria for which you want an agent to stop.

src.dcss.main_external_demo_fastdownward.my_config
src.dcss.main_webserver

Demo of an RL agent on the sonja sprint in crawl 23.1

Make sure to run crawl before running this demo, see:

start_crawl_terminal_sprint.sh

Module Contents
Functions

main()

src.dcss.main_webserver.main()
src.dcss.main_webserver_direct_access

Demo of an RL agent on the sonja sprint in crawl 23.1

Make sure to run crawl before running this demo, see:

start_crawl_terminal_sprint.sh

Module Contents
Classes

WebSockGame

Functions

run_websockgame(game)

Attributes

commands

loop

class src.dcss.main_webserver_direct_access.WebSockGame
send_action(command: dcss.actions.command.Command)
get_game_state()
start()
src.dcss.main_webserver_direct_access.run_websockgame(game: WebSockGame)
src.dcss.main_webserver_direct_access.commands
src.dcss.main_webserver_direct_access.loop
src.dcss.main_webserver_direct_access_threading

Demo of an RL agent on the sonja sprint in crawl 23.1

Make sure to run crawl before running this demo, see:

start_crawl_terminal_sprint.sh

Module Contents
Classes

WebSockGame

Attributes

commands

class src.dcss.main_webserver_direct_access_threading.WebSockGame
send_action(command: dcss.actions.command.Command)
get_game_state()
start()
src.dcss.main_webserver_direct_access_threading.commands
src.dcss.main_webserver_external_2

Demo of an RL agent on the sonja sprint in crawl 23.1

Make sure to run crawl before running this demo, see:

start_crawl_terminal_sprint.sh

Module Contents
Functions

main()

display_date(end_time, loop)

Attributes

loop

src.dcss.main_webserver_external_2.main()
src.dcss.main_webserver_external_2.display_date(end_time, loop)
src.dcss.main_webserver_external_2.loop
src.dcss.websockgame
Module Contents
Classes

WebSockGame

class src.dcss.websockgame.WebSockGame(agent_class, config=WebserverConfig)
_load_ai()
_load_config()
_setup()
_setup_local()
run(local=False)

Indices and tables