Skip to content

Rework platformer into Castlevania-style castle labyrinth#13

Merged
AndrewAltimit merged 14 commits into
mainfrom
feature/platformer-rework
Feb 24, 2026
Merged

Rework platformer into Castlevania-style castle labyrinth#13
AndrewAltimit merged 14 commits into
mainfrom
feature/platformer-rework

Conversation

@AndrewAltimit
Copy link
Copy Markdown
Owner

Summary

  • Rearchitect platformer from linear race course to interconnected 2D castle labyrinth with 10 themed rooms (Entrance, Corridor, Great Hall, Library, Armory, Chapel, Crypt, Tower, Dungeon, Throne Room)
  • Add full combat system: melee attacks, 6 enemy types (Skeleton, Bat, Knight, Medusa, Ghost, Gargoyle), enemy projectiles, 7 power-up types
  • Implement custom WebGL2 sprite rendering pipeline: sprite atlas generation (285 sprites), per-sprite shaders with GBA-style color ramp, dynamic lighting (32 colored torch lights), binary alpha, pixel outlines
  • Add dynamic vertex batching (sprite_batch shader) reducing draw calls from 800+ to ~5-10 per frame
  • Add tile cache for O(1) static tile lookups, camera sub-pixel snapping, scene capacity fixes
  • Add weather system (rain, lightning, fog, ambient particles), post-processing (scanlines, bloom, vignette, CRT, color grading, chromatic aberration), per-room atmospheric theming
  • Add 16 GLSL shader programs: sprite, sprite_batch, parallax, water, whip trail, slash arc, magic circle, god rays, fog layer, health bar, post-process, plus existing unlit/gradient/ripple/glow/tronwall

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes (1 pre-existing golf proptest failure)
  • WASM client builds successfully with wasm-pack build
  • Visual verification: tiles render, players animate, enemies visible, lighting works
  • Browser test with multiple players in platformer mode
  • Verify all 10 room themes have distinct atmosphere (lighting, fog, particles)

Generated with Claude Code (https://claude.com/claude-code)

AI Agent Bot and others added 14 commits February 23, 2026 06:56
Complete overhaul of the platformer game mode:

Game logic (breakpoint-platformer):
- Enemy system: Skeleton (patrol), Bat (sine-wave), Knight (2HP patrol),
  Medusa (float + projectiles) with per-type AI tick functions
- Melee combat: whip attack with hitbox, active frames, cooldown, damage,
  invincibility frames, death/respawn with time penalty
- Course generation: 300x30 tile grid, 15 rooms with branching paths
  (upper=safer/longer, lower=more enemies/shorter), room templates
  (Corridor, Staircase, TowerClimb, CathedralHall, CryptDepths, etc.)
- Rubber banding: leader gets +50% enemies, last place gets better items
- 7 power-ups: HolyWater, Crucifix, SpeedBoots, DoubleJump, ArmorUp,
  Invincibility, WhipExtend with Mario Kart-style tiered selection
- Race-only mode at 20Hz tick rate, "Castlevania Rush" name
- Compact u8 Tile serialization to stay under 64KB protocol limit

Client rendering (breakpoint-client):
- Sprite/texture pipeline: new sprite.vert/frag shaders, texture atlas
  support with NEAREST filtering, Quad mesh, Sprite material type
- Sprite atlas module with named regions, animation support, 41 sprites
- Camera: tighter Z=-15 framing, 3-unit lead in race direction
- Gothic theme: dark stone, blood-red spikes, gold finish
- 5 new audio events: Attack, Hit, Death, EnemyKill, Checkpoint
- HUD: HP hearts, death counter, active power-up, race position

674 tests passing, 0 clippy warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Complete overhaul of the platformer game mode:

Game logic (breakpoint-platformer):
- Enemy system: Skeleton (patrol), Bat (sine-wave), Knight (2HP patrol),
  Medusa (float + projectiles) with per-type AI tick functions
- Melee combat: whip attack with hitbox, active frames, cooldown, damage,
  invincibility frames, death/respawn with time penalty
- Course generation: 300x30 tile grid, 15 rooms with branching paths
  (upper=safer/longer, lower=more enemies/shorter), room templates
  (Corridor, Staircase, TowerClimb, CathedralHall, CryptDepths, etc.)
- Rubber banding: leader gets +50% enemies, last place gets better items
- 7 power-ups: HolyWater, Crucifix, SpeedBoots, DoubleJump, ArmorUp,
  Invincibility, WhipExtend with Mario Kart-style tiered selection
- Race-only mode at 20Hz tick rate, "Castlevania Rush" name
- Compact u8 Tile serialization to stay under 64KB protocol limit

Client rendering (breakpoint-client):
- Sprite/texture pipeline: new sprite.vert/frag shaders, texture atlas
  support with NEAREST filtering, Quad mesh, Sprite material type
- Sprite atlas module with named regions, animation support, 41 sprites
- Camera: tighter Z=-15 framing, 3-unit lead in race direction
- Gothic theme: dark stone, blood-red spikes, gold finish
- 5 new audio events: Attack, Hit, Death, EnemyKill, Checkpoint
- HUD: HP hearts, death counter, active power-up, race position

674 tests passing, 0 clippy warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Load atlas texture at app startup via HtmlImageElement onload callback
- Rewrite platformer_render.rs: all objects now use MeshType::Quad +
  MaterialType::Sprite instead of 3D Cuboid/Sphere meshes
- Animated sprite selection per AnimState (player) and EnemyType
- HP hearts rendered as sprite quads above each player
- Per-tile sprite mapping, power-up sprite mapping, projectile sprites
- Fix bridge.rs PlayerId type (u64, not u32) for WASM build

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The quad was facing -Z but the camera is at Z=-15 looking toward Z=0
(+Z direction). This caused the sprite UVs to be mirrored horizontally,
making the game appear right-to-left. Fix by winding the quad CCW when
viewed from +Z so the front face is toward the camera.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Camera was at Z=-15 looking toward Z=0 (+Z direction), which in
look_at_rh flips the X axis on screen, causing the entire game to
render right-to-left with swapped controls. Moved camera to Z=+15
so it looks along -Z where +X = right on screen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Complete 10-phase graphics upgrade for the platformer:
- 512x512 sprite atlas with 129 named sprites and animation tables
- 3-layer parallax scrolling backgrounds with custom GLSL shaders
- Multi-frame SpriteAnimation for all player/enemy/tile animations
- Auto-tiling for stone bricks (neighbor-based edge detection)
- Animated torches, checkpoints, finish gates
- Particle system (256-cap ring buffer): dust, sparks, blood, fire,
  smoke, magic effects with per-type colored powerup bursts
- Screen shake on damage/death, screen flash on hits/kills
- Attack trail afterimages, speed boots green trail, invincibility glow
- Death fade-out and respawn fade-in transitions
- Tile culling (only render visible columns around camera)
- Enemy death animations with fade-out

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…her, post-FX, particles, HUD

Complete 10-phase visual upgrade for the platformer game mode:

- Water shader with waves, caustics, and gameplay (movement slow + buoyancy)
- Dynamic torch lighting (16-light array, flicker, dark atmosphere)
- Whip arc shader and projectile trail effects with impact sparks
- Squash/stretch animation (1024x512 atlas, per-player visual state)
- Weather system (rain, fog) and foreground parallax layer
- CRT + bloom + vignette post-processing via render-to-FBO pipeline
- Enhanced particle system (512 cap, 6 new effects, continuous emission)
- HUD: powerup timer bar, course minimap canvas, checkpoint toast
- Theme-configurable torch ambient, water color, and post-FX intensities
- Context loss resilience for post-process FBO

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the flat 300×30 horizontal strip with a 192×120 tile castle
labyrinth (6×5 grid of 32×24 rooms, ~22 rooms per map). Rooms are
connected via MST + extra edges for multiple routes, themed by distance
from start (Entrance → Corridor → GreatHall/Library → Armory/Chapel/Crypt
→ Tower/Dungeon → ThroneRoom). Includes RLE tile compression, 2D
checkpoint system, room-distance rubber-banding, camera/culling for
vertical exploration, room-graph minimap, and sprite V-flip fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ting, parallax, post-FX, weather, HUD

Phases 5-10 of the anime dark fantasy visual polish:

- Phase 5: Slash arc + magic circle shaders, hit freeze on enemy kills
- Phase 6: Multi-layer water with caustics, foam, depth absorption, Fresnel
- Phase 7: 32 colored lights, per-room ambient color, god rays shader
- Phase 8: 6-layer parallax with sway and crossfade support
- Phase 9: Multi-pass post-processing: bloom, color grading, chromatic aberration, film grain
- Phase 10: Weather system (rain/lightning/fog/ambient particles per room), procedural health bar, room name reveal toast

New shaders: slash_arc, magic_circle, godrays, fog_layer, health_bar (10 files).
Expanded sprite.frag to 32 colored lights, rewrote water.frag and postprocess.frag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix atlas dimensions (2048x1024→1024x512, 32x64→16x32 sprites) to match
actual PNG on disk, fixing garbled/invisible sprites. Fix depth_mask leak
from parallax rendering that silently disabled depth writes for all
subsequent sprites.

Add MBAACC (Melty Blood) visual techniques:
- Binary alpha (step 0.5) for crisp pixel outlines
- Dark pixel outlines on characters/enemies via existing shader
- Explicit Z-layer painter's algorithm (8 depth layers)
- Character shadows (squashed dark silhouettes)
- BlendMode enum (Normal/Additive/Subtractive) on sprites
- Palette texture infrastructure (deferred activation)
- Per-material GL state restoration after every draw call

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restyle the platformer to match GBA-era Castlevania (Circle of the Moon,
Curse of Darkness) with dark ambient, high-contrast torch lighting, and
authentic color processing.

Color tuning across all rooms: darker ambient (~33% reduction), distinctly
orange torch fire, higher contrast/lower saturation color grading, per-room
tile tints (gray-mauve castle, teal-green underground, warm sandstone sacred,
blue-gray fortress), darker parallax with purple tint, more atmospheric fog
and dust particles.

Shader authenticity: GBA 5-bit posterization (floor * 31.0), 3-point color
ramp mapping (mauve shadows -> bronze midtones -> gold highlights blended
70% with original texture), dark plum pixel outlines matching Castlevania
sprite style.

Theme defaults: torch_ambient 0.06, bloom 0.55, vignette 0.7, scanline 0.15.
VFX recolored: orange-gold slash arcs, ghostly green projectiles, orange fire
speed trails. Graduated film grain for dark rooms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add visual-audit.spec.js Playwright test that captures 6 platformer
screenshots with color histograms for automated visual analysis.

Brighten the Castlevania GBA/DS restyle based on Gemini feedback:
- torch_ambient 0.06→1.0, radius 6.5→14.0, intensity 1.2→1.8
- Room ambient colors raised to 0.45-0.90 range (was 0.05-0.20)
- Tile tints boosted above 1.0 for sprite overdrive brightness
- Color ramp shadow/mid lifted, posterize 31→16 for authentic GBA banding
- Contrast neutralized (1.0), saturation raised to 1.05 (GBA LCD compensation)
- Shadow grade tints lightened to 0.78-0.92 to preserve dark detail
- Vignette 0.7→0.20, scanlines 0.15→0.05, CRT curvature 0.12→0.08
- Parallax alpha reduced for better tile/background contrast
- Shader min light floor: max(light, u_ambient*0.4)
- Fog color brightened to [0.12, 0.10, 0.18]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix player/enemy/VFX sprite atlas↔Rust frame count mismatches (phases 1-2)
- Fix parallax background atlas reference and per-room tinting (phase 3)
- Tune visual defaults: torch_ambient 0.15, posterize 48, ramp blend 0.35 (phase 4)
- Increase scene capacity to 2048 and reset object IDs each frame (phase 5)
- Add dynamic vertex batching with sprite_batch shaders for ~100x fewer draw calls (phase 6)
- Add TileCache for O(1) static tile lookups instead of per-frame HashMap (phase 7)
- Add camera sub-pixel snapping at 1/16 pixel grid for crisp pixel art (phase 8)
- Reduce weather particle counts and widen rain sprites (phase 9)
- Add per-room fog color propagation through shaders (phase 10)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename u_vp to u_mvp in sprite_batch.vert so the Rust uniform lookup
  actually finds it — tiles were invisible because the VP matrix was
  never uploaded to the batch shader
- Disable parallax background layers that sampled character/tile sprites
  from the atlas instead of dedicated background content

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AndrewAltimit AndrewAltimit merged commit 7d7bad3 into main Feb 24, 2026
10 checks passed
@AndrewAltimit AndrewAltimit deleted the feature/platformer-rework branch February 24, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant