Refactor dungeons into reusable component for any story type #116
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "copilot/refactor-dungeons-to-be-reusable"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Dungeons were hardcoded into
dungeon_storyvia theadd_zonemethod, limiting them to a single story type. This refactors dungeon generation into standalone components that can be attached to any story.Core Changes
tale/dungeon/dungeon.py: NewDungeonclass encapsulates level generation, mob/item population, and LLM-based room descriptions with fallbacktale/dungeon/DungeonEntrance.py: NewDungeonEntranceexit class binds dungeons to normal locations via standard exit mechanismtale/dungeon/dungeon_config.py: NewDungeonConfigclass defines dungeon properties (name, description, races, items, max_depth)tale/zone.py: Addeddungeon_configproperty to Zone class for storing dungeon configuration in JSONstories/dungeon/story.py: Refactored to delegate toDungeonclass, removing 80+ lines of duplicate logictale/dungeon/dungeon_generator.py: FixedMobPopulatorto filter connector cells without locations, preventing KeyErrortale/driver.py: Updated to pass dungeon config from zone to dungeon entrance when building dungeonsDungeonConfig
Dungeon properties are now configurable per zone via
DungeonConfig:Usage
Example
See
stories/dungeon_example/for a complete implementation showing dungeon integration into a normal town story with dungeon configuration.Testing
Added
tests/test_dungeon.pyfor coreDungeonandDungeonEntrancefunctionality (5 tests)Added
tests/test_dungeon_config.pyforDungeonConfigand Zone integration (7 tests)Added
tests/test_dungeon_example_story.pyfor integration verificationAll 23 dungeon tests passing, including existing
test_dungeon_story.pyandtest_dungeon_generator.pyFixes neph1/LlamaTale#115
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
This is a great start. I think it's close to testable. I've pushed some changes and fixes. Can you please address my request for a DungeonConfig file, and pass it where needed.
The DungeonConfig should reside in the Zone class (and be stored there in the json).
This means a Zone can only have one Dungeon, or at least all dungeons would use the same config.
@copilot
@ -0,0 +1,65 @@from typing import Sequence, UnionPlease create a DungeonConfig class, where name, description, items and races can be defined
@copilot please check the review comments
@ -0,0 +1,65 @@from typing import Sequence, UnionCreated DungeonConfig class in
tale/dungeon/dungeon_config.pywith name, description, items, and races properties. It's integrated into the Zone class and can be serialized to/from JSON. Commit:a3b16c3DungeonConfig class has been created and integrated:
zone.dungeon_configzone.get_info()and loaded viafrom_json()Commit:
a3b16c3