Hi I am looking to understand the internal game logic of DCSS. Is there a good place to start to understand the game logic and the main control flow of the game ?
I’ve done some light modding, contributed some PRs to both mainline crawl and bcrawl.
My approach was to just pick something small I wanted to change, and dig in. One learns by doing. It worked for me.
(The first step is to clone the git repo and build crawl. I don’t know how much experience you have with coding.)
Do you have a aim/aims you’re working towards?
hi @petercordia . I have a CS background and have a good amount of programming experience mostly python, some C++.
In terms of my aim I want to modify the C++ internals to create a C++ interface that can used for a reinforcement learning simulator at the python level.
I know the general approach to take, but am having trouble figuring out the components of the codebase.
The game already has an extensive lua interface - players can write automation in their crawlrcs in lua to the point that the “qw” bot has won the game. If you’re not tied to Python - and lua is at least another exasperating whitespace language - that’s where I’d start.
I’ve also wanted to do something like that for some time. Haven’t gotten round to it yet.
Have you considered plugging the bot into the ascii interface? I expect it would be harder to get a neural network to make good decisions that way, but for me it would also be more rewarding.
You could ask the core devs on
- IRC: #crawl on Libera (or #crawl-dev to chat development)
(But I’m not making any promises on their behalf.)
Finally, I do still thing putting in some PRs helps understand the game. I now understand the basics of the control loop, as well as the user interface, though not to the level you need probably. I’m not sure I could have developed the level of understanding I have without adding in (or modifying) actual features. Digging through the code with git grep to try to figure out how to update the annotation interface or add sneak-attack stabbing powers to SpiderForm (bcrawl) I found all kinds of control flow that I never would have thought to look for. (I also learned a fair bit about C++ doing this)
@stoatsoup @petercordia Thank you guys for the suggestions.
@stoatsoup
The idea is essentially to create a gymnasium interface to the game, so there is a python dependency. But it is a good point to leverage the lua interface if possible.
@petercordia
Thanks for the pointer to the core devs. I will contact them for additional assistance.
You may want to have a look at: GitHub - dtdannen/dcss-ai-wrapper: An API for Dungeon Crawl Stone Soup for Artificial Intelligence research.
That project seems to a bit dormant right now, but I think the developer got pretty far (publishing on it, doing a tutorial at ICAPS).