I had two days off from work this week and spent most of that time working on Legend. Dungeon stocking continues to significantly improve. Enemy AI is in good shape, though ranged enemies need more tweaking. More polish is needed throughout.
Optimization
Game performance has been gradually declining. It was time for another optimization pass. I focused on eliminating allocations by removing LINQ uses and added caching. I’ve held off on implementing these optimizations because they increase code complexity. But, they’re necessary in frequently executed code blocks.
Improved Map Loops
After the map structure is generated, additional connections are created to add loops and reduce linearity. It frequently produced short routes to the exit, excessive alternate paths, and long, boring corridors. To improve its output, I added settings for maximum corridor distance to limit loop corridor lengths, minimum graph distance to add a loop to prevent useless loops, and minimum graph distance from the start node to the farthest node from the start node to prevent the route from the start node to the end node from getting too short. I also added a scoring system that favors shorter paths and nodes that are farther apart.
Improved Key Placement
Keys are now hidden in containers instead of being on the floor. A container can be an object such as a chest or straw pile, or an enemy. This was difficult to implement. I had to create a queue to track deferred placement entities and add a new map generator step to process the items in the queue after all other entities have been placed on the map.
New Content
- Room Modifiers: Illuminated, Poisonous Gas Traps, Fire Traps, Spike Traps
- Objects: Shallow Water
Minor Enhancements
- Straw piles and fountains can now be searched to reveal items and/or gold
- Minimap now displays unique sprites for chests and locked chests
- Puddles are now translucent
- Added missing tooltips to configuration editors for actors, items, game events, effects, status effects, and physical materials
Bug Fixes
- Stationary objects no longer receive movement-based status effects, e.g., Slow, Rooted
- Walking surface sound effects not playing
- Hidden doors shown on map
- Scrolls not burning when in the same cell as fire
- Straw terrain modifiers not displaying
- A thrown apple doesn’t trigger a fire trap
- Clicking Combine button doesn’t work (broke when adding game controller support)
Next week, I’ll keep working on dungeon stocking.

