Files
snow_trail/.pi/skills/panopticon/changelog.md

97 lines
6.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Changelog
*Last updated: Tuesday, April 7, 2026*
## Active Areas
| Area | Changes (30d) | Status |
|------|---|---|
| Main loop & systems | 9 churn | Active — explicit storage parameters |
| Dialog system | 10 churn | Active — projectiles, camera, rendering |
| Render core | 15 churn | Active — text pipeline, font atlas, globals |
| World state | 8 churn | Active — intent storage, component management |
| Player mechanics | 6 churn | Stable — character bundle, player states |
| Shader system | 4 churn | Active — gizmo lines, dissolve, snow light |
| Content pipeline | 1 churn | New — Blender export addon |
## Recent Changes
### System Signature Refactor (Major)
- **Completed**: All 16 systems refactored to take explicit `Storage<T>` parameters instead of `&World`/`&mut World`.
- **Pattern**: Functions receive only storages they need (e.g., `camera_follow_system` takes `&Storage<FollowComponent>`, `&Storage<CameraComponent>`, `&mut Storage<Transform>`).
- **Benefit**: Explicit data dependencies improve borrow checker clarity and code readability.
- **Main loop** (`src/main.rs`): Updated to pass individual storage fields at call sites rather than whole `World` reference.
- **Affected systems**: `camera_input_system`, `camera_intent_system`, `camera_follow_system`, `camera_noclip_system`, `camera_ground_clamp_system`, `dialog_camera_transition_system`, `dialog_camera_system`, `player_input_system`, `physics_sync_system`, `render_system`, `particle_intent_system`, `particle_update_system`, `trigger_system`, `dialog_system`, `dialog_projectile_system`, all state machines.
### Intent-Based Architecture
- **Completed major refactor** (3 weeks ago): Systems communicate through one-frame `Storage<T>` intents instead of direct function calls.
- **Intent types**: `FollowPlayerIntent`, `StopFollowingIntent`, `CameraTransitionIntent`, `SpawnParticleIntent`.
- **Consumer pattern**: Systems read intents from world storage, act on them, then remove them. Producers don't import consumer modules.
### Dialog System Suite
- **Dialog state machine**: Ink-based story progression with display timer, projectile phases, parry mechanics.
- **Projectile system**: Spawns physics-driven projectiles with parry windows; detects hits vs. evasion vs. parries (I/J/L buttons).
- **Dialog camera**: Auto-frames all dialog participants; transitions smoothly between follow-cam and dialog-cam via intent; computes centroid + spread.
- **Bubble rendering**: Billboard-based text with word-wrap, dynamic sizing (tail height → body dimensions), border/fill colors, RGBA text atlas.
### Text & Font Rendering
- **Font atlas pipeline**: Pre-rasterized glyphs (16×8 grid, 124px cells) from Departure Mono font.
- **Text measurement**: Character-width aware layout with line wrapping against max bubble width.
- **Vertex-based text**: Custom `TextVertex` (position, UV) fed into dedicated text pipeline with view-proj uniform.
### Particle System
- **Intent-driven spawning**: `particle_intent_system` reads `spawn_particle_intents` Vec, transfers configs into persistent `ParticleBuffers`.
- **Configurable emitters**: Burst count, lifetime range, speed range, directional spread (cone), gravity, size range, color gradient.
- **Snow particle integration**: Spawned continuously at camera position for screen-fill effect; `spawn_snow_particles` adds particles to `ParticleBuffers`.
### Render Pipeline
- **Global renderer via thread-local**: `render::global` module centralizes `Device`/`Queue` access for loaders and systems.
- **Draw call generation**: `render_system` reads `entities`, `transforms`, `meshes`, `dissolves` storages; generates `DrawCall` per visible entity.
- **Gizmo shader**: Fragment shader outputs world-normal as axis color (X=red, Y=green, Z=blue).
- **Snow light accumulation**: Persistent texture tracking deformation; blue-noise dithering maps snow brightness into tile pattern.
- **Dissolve shader**: Blue-noise masked alpha cutoff; controlled by `enable_dissolve` uniform.
### Tree Occlusion & Instances
- **Tree dissolve system**: Per-instance dissolve amounts lerp toward targets; updated via `tree_occlusion_system` which reads player transforms and cameras.
- **Instance buffer sync**: `tree_instance_buffer_update_system` syncs dissolve state changes to GPU buffer after state updates.
### Trigger & Event Flow
- **Sphere-based triggers**: `trigger_system` runs each fixed step; reads `triggers`, `transforms`, `player_tags` storages; fires `TriggerEvent` with `Entered`/`Exited` kinds.
- **Activation filtering**: `TriggerFilter::Player` specifies which entity types can activate.
- **Event queue**: Events collected in `world.trigger_events` and consumed by `dialog_system` to spawn bubbles.
### Player State Machine
- **State hierarchy**: Idle, Walking, Jumping, Falling, Leaping (dash), Rolling.
- **Physics per-state**: `state_machine_physics_system` applies damping on enter (Idle), horizontal input application (Walking), vertical velocity control (Jumping).
- **Transition logic**: Grounded checks, input presence, airtime duration.
### Editor & Inspector
- **Dear ImGui integration**: Inspector window with player state display, entity transform gizmos.
- **Entity selection**: Right-click picking calls `picking::pick_entity` with ray; gizmo renders for selected entity when editor active.
- **UI mode gating**: Systems check `editor.wants_keyboard()`/`wants_mouse()` to suppress game input during inspector focus.
### Blender Export Addon
- **Plugin**: `blender/addons/snow_trail_export.py` provides one-click glTF + EXR export from Blender 5.0.
- **glTF operator** (`SNOWTRAIL_OT_export_gltf`): Exports selected mesh objects to `assets/meshes/{blend_filename}.gltf` with configurable modifiers, vertex colors, materials.
- **Heightmap bake operator** (`SNOWTRAIL_OT_export_heightmap`): Calls `generate_heightmap.py` to bake terrain Z-position as 32-bit EXR to `assets/textures/terrain_heightmap.exr` (1024px default).
- **UI panel**: "Snow Trail" category in 3D viewport; auto-discovers project root by walking directory tree until `assets/` and `blender/` found.
## Stability
| Area | Last Changed | Status |
|---|---|---|
| Physics manager | 80+ days | Stable |
| Camera follow | 30 days | Stable — now takes explicit storage params |
| Movement component | 30+ days | Stable |
| Mesh loader | 30+ days | Stable |
| Spotlight sync | 30 days | Stable — explicit storage params applied |
| State machine physics | 30 days | Stable |
| Debug colliders | 30+ days | Stable |
| System signatures | New | Stable — refactor complete, no behavioral changes |
## Open Threads
- **Global renderer thread-local**: Marked for gradual migration to explicit `RenderContext` parameters on systems/loaders.
- **Dialog parry mechanics**: Gameplay tuning (PARRY_WINDOW_RADIUS, HIT_RADIUS) ongoing.
- **Tree occlusion performance**: Occlusion system runs every frame; no visibility culling yet. Scalability unknown for >100 trees.
- **Heightmap bake normalization**: Exported EXR uses raw Z-coordinate; game may need per-level scale application.