How jmltundercode/dexel_survival_dungeon works
Project type and purpose
• This is a 2D roguelike survival‐dungeon game written in Python, using Pygame for graphics/audio and NumPy for math/AI.
• The player navigates procedurally generated dungeons, fights AI enemies, and the core is a real‐time game loop.
File structure
• Top level:
• game (script or packaged executable)
• src (source code)
• requirements.txt, README, CI workflows, web (static site)
• src/ has these subfolders:
• assets – tiled maps, sprites, tilesets
• characters – player, enemy, attack waves, animations
• data – configuration tables (e.g. enemy stats)
• kinematics – steering behaviors (seek, wander, arrive)
• – dungeon generation & map logic
• utils – config loader, resource path resolver
• main.py – entry point & game loop
README
• Confirms Python 3.8+, Pygame 2.5.0, NumPy, PyInstaller
• Describes major features: procedural dungeons, AI behaviors, player controls
• Shows expected project tree for src/game vs. our actual src subfolders
Main components and how to represent them
a. Components
1. Entry & Bootstrap (main.py, configs)
2. Asset Manager (utils.resource_path, loads sprites, maps, tilesets)
3. Game Loop (initialize, update, render, event handling)
4. Input Controller (keyboard & mouse → player commands)
5. Game State / World Model (map layout, entities’ positions & stats)
6. Dungeon Generator (src.map.map, procedural layout & tile placements)
7. Entity System
– Player (src.characters.player)
– Enemies (src.characters.enemy + src.data.enemies)
8. AI & Physics
– Steering & kinematics (seek, arrive, wandering)
– Collision detection & resolution
9. Combat System (attack_wave, weapons & bullets management)
11. External Libraries (Pygame, NumPy)
12. Packaging / Deployment (game script, PyInstaller)
b. Relationships & data flow
• Startup: main.py → load configs → initialize Asset Manager → generate dungeon → spawn entities
• Game Loop Iteration:
1. Input Controller reads events → updates Player intent
2. AI & Kinematics compute new velocities/paths for enemies
3. Physics & collision resolve movements
4. Combat System resolves attacks → health/states updated
5. Renderer queries Game State → draws map, entities, UI
c. Architectural patterns & principles
• Component decomposition: each subsystem (input, AI, rendering) lives in its own package
• Single Responsibility: map generation separate from rendering; kinematics separate from character logic
• MVC‐style (rough):
• Model = Game State & Entities
• View = Renderer
• Controller = Input & Game Loop
• Resource centralization: Asset Manager handles all I/O for sprites, maps, sounds
d. Key technologies & libraries
• Python 3.8+
• Pygame (graphics, audio, event loop)
• NumPy (vector math for kinematics/AI)
• Tiled .tmx/.tsx format for maps
• PyInstaller for bundling
Elements
• Blue for core loop & controllers
• Green for game state/model
• Orange for AI/physics
• Purple for rendering/assets
• Gray for external libraries