(Underdepths) Prepare for Pass 4

This commit is contained in:
AlexKucera committed 2026-08-13 09:05:25 +02:00
1 parent e2a47aba6b
commit 8249da7e9b
33 files changed
+123 -4173

No files matched your search

+82 -19
View File
@@ -20,7 +20,7 @@ engine/
combat.py # Damage calculation, hit resolution
serializers.py # JSON save/load
entities/
entity.py # Base Entity: position, glyph, color, name
entity.py # Base Entity: position, sprite key, name
player.py # Player: stats, inventory, leveling
enemy.py # Enemy: AI behavior type, stats
item.py # Item: type, effect, equipment data
@@ -29,10 +29,13 @@ ai/
data/
enemies.py # Enemy roster (stats per type)
items.py # Item catalog
constants.py # Tuning constants, colors, key bindings
constants.py # Tuning constants, palettes, key bindings
sprites.py # Pixel-art patterns: 2D palette-key grids per entity/tile/item
render/
renderer.py # Draw map, entities, UI panels
camera.py # Viewport offset (follow player)
renderer.py # Compose map, entities, UI panels (pure read of state)
sprites.py # Rasterize pixel-art grids to cached Surfaces
effects.py # Lighting/vignette, particles, screen-shake, HP bars
camera.py # Viewport offset (smooth easing follow player)
```
This is a guideline, not a cage. Merge files if it's simpler. The only hard rule: `GameSession` is the single source of truth for all mutable state, and it's what gets serialized.
@@ -306,21 +309,72 @@ New Game. The `?` key reopens it during play. Keep the explanation plain:
## Rendering
- **Tile size:** 16×16 pixels (use `pygame.draw.rect` with distinct colors per tile/entity type).
- **Viewport:** camera follows player, centered. Show ~50×30 tiles.
- **Colors:**
- Wall: dark gray `(60, 60, 70)`, visible; `(30, 30, 35)`, explored-not-visible.
- Floor: `(40, 35, 30)`, visible; `(20, 18, 15)`, explored-not-visible.
- Player: white `(255, 255, 255)` — draw as a filled circle or `@`-shaped glyph.
- Enemies: type-coded colors (Rat: brown, Goblin: green, Skeleton: white-gray, Orc: dark red, Wraith: translucent purple, Slime: bright green, Dragon: bright red).
- Items: yellow (weapons), blue (armor), red (potions), cyan (scrolls).
- Stairs: bright yellow `>`.
- **UI Panels:**
- Top bar: Floor N/10, HP bar (red/green), Level, XP bar.
- Right panel: message log (last 8 messages).
- Bottom: current equipment and sound state.
- Context prompt: on an item show `Press G to pick up <name>`; on stairs show `Press F to descend`.
- **Messages** scroll, newest at bottom. Color-coded: combat (white), damage taken (red), level up (green), items (yellow).
The look is **procedural pixel-art**: every entity, tile, and UI icon is a
hand-authored pixel pattern drawn with `pygame.draw.rect` — never a flat colored
square, never an external image file. Aim for a clean, detailed retro-roguelike
feel.
### Pixel-art sprites
- Define each sprite in `data/sprites.py` as a 2D grid of single-character
palette keys (e.g. `"."` transparent, `"K"` outline, `"W"`/`"s"`/`"h"` shades),
roughly 12×12 to 16×16 cells. `render/sprites.py` rasterizes a grid to a
`pygame.Surface` once (keyed by name + frame) and caches it; the renderer blits
the cached surface scaled to `TILE`.
- Every entity gets a DISTINCT, recognizable sprite — not a recolor of a blob:
- **Player (adventurer):** hooded figure; the equipped weapon (dagger/sword/
axe/hammer) and armor visibly change the sprite. 4-directional facing when
moving.
- **Rat:** small body, pink tail, round ears, whiskers.
- **Goblin:** green humanoid, pointed ears, crude weapon, loincloth.
- **Skeleton Archer:** white-gray bones, drawn bow, quiver, glowing eye sockets.
- **Orc Warrior:** hulking dark-red brute, heavy plate, tusks, big blade.
- **Wraith:** translucent purple wisps, tattered cloak, no legs, glowing eyes.
- **Green Slime:** glossy blob with highlight, two googly eyes, a drip.
- **Ancient Dragon:** large multi-hue red boss — horns, spread wings, scales, fangs.
- **Items:** pixel-art icons (weapon, armor, potion flask, scroll) with the
category accent (yellow / blue / red / cyan) as the dominant hue.
- **Stairs:** a pixel-art descending staircase / `>` arrow, glowing yellow.
- Animate: 2–3 idle frames cycled by turn/time (gentle breathe/bob via a sine
offset); attack = a short lunge; taking damage = a white hit-flash; death = a
poof. Small Slimes use a smaller, cuter variant of the slime sprite.
### Tiles & lighting
- **Walls:** pixel-art stone/brick with a lighter top edge and darker bottom for
depth (beveled), plus seeded per-tile variation so walls aren't uniform.
- **Floor:** subtle dithering / specular flecks and slight per-tile shade variation.
- **Lighting:** radial torch-light centered on the player out to `SIGHT_RADIUS`
(brightness falloff); tiles outside FOV are unlit (black); explored-not-visible
tiles are remembered but tinted dark blue-gray and dimmer. Soft screen vignette.
Walls occlude light (derived from the FOV grid).
- **Shadows:** a soft ellipse shadow under each entity and feature.
### Juice (procedural effects in `render/effects.py`)
- Particle bursts: hit sparks, critical-hit star burst, blood/slime/ash poof on
death, level-up stars, pickup sparkle, stairs shimmer. Pool and cap the counts.
- Screen-shake on player damage and big hits (decaying offset).
- Smooth camera that eases toward the player.
- Floating combat text is welcome (e.g. `-8`, `MISS!`, `CRIT!`).
### UI (polished)
- Bordered panels (1-px pixel frame, subtle inner bevel).
- Top bar: Floor N/10, HP bar (heart icon + green/red fill), Level, XP bar.
- Right panel: last 8 log messages, color-coded (combat white, damage red,
level-up green, items yellow).
- Bottom bar: equipment slots drawn as pixel-art icons, active effect timers, and
a sound on/off icon.
- Context prompt line: on an item show `Press G to pick up <name>`; on stairs
`Press F to descend` — styled as part of the UI, not console text.
- Use `pygame.font.SysFont` (no font asset files).
### Colors & viewport
- Base palette in `data/constants.py` (`PALETTE` / `COLORS`): walls dark gray
`(60,60,70)` visible / `(30,30,35)` explored; floor `(40,35,30)` / `(20,18,15)`.
Keep the type accent colors (rat brown, goblin green, skeleton white-gray, orc
dark red, wraith purple, slime green, dragon red; items yellow/blue/red/cyan;
stairs yellow) as the dominant hue of each sprite's palette.
- Viewport: camera follows the player; show ~48×28 tiles at `TILE` pixels (`TILE`
≥ 16; 20 recommended for a comfortable pixel-art canvas).
- Messages scroll, newest at bottom, color-coded.
## Audio
@@ -346,6 +400,7 @@ The game is DONE when ALL of these are true:
- [ ] How to Play is available from the menu and shown before a New Game
- [ ] Standing on an item/stairs shows the exact key needed; `g` pickup and `f` descent work
- [ ] Simple sound effects play when audio is available; missing audio devices fall back silently
- [ ] Entities, tiles, and items are drawn as distinct procedural pixel-art sprites (not flat colored squares); no external image files are loaded
### Systems Depth (judging criteria)
- [ ] **A* pathfinding** — enemies pathfind around walls toward the player (chase and flee behaviors). Visible when a goblin navigates a corridor to reach you.
@@ -359,6 +414,13 @@ The game is DONE when ALL of these are true:
- [ ] **Control usability** — an automated input smoke test places an item under the player, presses `g`, and verifies inventory; then places the player on stairs, presses `f`, and verifies the floor changes.
- [ ] **Audio safety** — generated effects need no asset files, mute works, and forced mixer-init failure does not crash.
### Visual Polish (judging criteria)
- [ ] **Procedural pixel-art** — every entity, tile, and item is a hand-coded multi-color pixel pattern; the 7 enemies + player + items + stairs are each visually distinct and recognizable (not recolors of one shape)
- [ ] **Lighting** — radial torch-light around the player, explored tiles remembered but dimmed, walls occlude light, screen vignette
- [ ] **Depth & shadow** — beveled/textured walls, per-tile floor variation, soft shadows under entities
- [ ] **Juice** — particle effects on hits/crits/deaths/pickups/level-ups/stairs, screen-shake on damage, easing camera, idle animation on entities
- [ ] **Polished UI** — bordered panels, HP/XP bars with icons, color-coded log, equipment shown as icons, styled context prompts; clean and readable
### Video Requirements (what must be visible in one continuous take)
- [ ] Core loop played: move, explore, fight, loot, descend
- [ ] Two systems interacting: e.g., enemy A* pathfinding through a generated dungeon while FOV limits what you see
@@ -380,3 +442,4 @@ The game is DONE when ALL of these are true:
- No character creation/class selection (one class: adventurer)
- No crafting system
- No NPC dialogue or shops
- No external image / sprite-sheet / font / data asset files — all visuals are procedural pixel-art drawn from in-code palettes with `pygame.draw` only