A Computational Approach to Generating Lore-Coherent D&D Encounters (Defence)
Dungeons & Dragons (D&D) is one of the most commercially successful open-ended, table-top role-playing fantasy games. The game has its own lore in the fantasy domain. The game has several settings and a predefined set of rules for each setting. Encounters are a very important part of the game where players are pitted against the monsters. The players are confronted with fantastical monsters in mathematically balanced encounters, overcoming which contributes to the calculation of player progress. The project aims to create Dungeons and Dragons (D&D) encounters with monsters that align with the lore. The encounters need to align with the lore to preserve immersion and verisimilitude. Up to now, there are no encounter generators that can automatically generate encounters that align with the lore. Even with the plethora of information available for D&D (or perhaps rather due to its abundance), the generation of an encounter that is coherent with the lore is a time-consuming and difficult process for a Dungeon master. As of now, the Dungeon master (DM), that is, the player who conducts the game need to try various combinations of monsters. For this application, information needs to be extracted from the D&D lore data. The project tries to deploy information extraction and information representation techniques to extract information from the available lore and generate encounters that align with the lore, according to the desired difficulty level. In this work, we first trained and deployed various state-of-the-art named entity recognition algorithms to extract monster entity names in the D&D lore text. These models were used to extract relationships between several monsters in the text. Then, we applied community detection algorithms to form monster communities with the available monster properties and the links between monsters available from the monster lore text. Then, we evaluated the communities compared with the publicly available encounters. Also, a Large Language Model (LLM) was finetuned with different datasets for generating encounters from the communities that we obtained. Next, we conducted a number of prompt engineering experiments on the trained LLMs, such that the output from the LLM would be a list of coherent monsters when a candidate monster is given in the input. The generated outputs were examined for the coherence of lore, theme, and environment. It was observed that the outputs were partially or fully coherent with the lore in about 66.0% of the 241 candidate monsters tested.