Commit Graph
18 Commits
Author SHA1 Message Date
Matteo Benedetto e26464d843 Merge origin/new-newnassets: new LPC rat assets and animations
Cherry-picked from new-newnassets (3 commits):
- bdf5a8d Add new start animation asset for game launch
- 5f2d09f Fix rat animations and restore map tiles
- 2e2c5bb feat: add LPC-style rat assets, sprite generation scripts, and grid extraction tools

Conflicts resolved:
- engine/sdl2.py: kept 'if scale:' wrapper (compatible, default scale=True)
- units/rat.py: kept animation frame computation (partial_move * 4)
- 12 PNG files (BMP_BABY/MALE/FEMALE_*): kept new-newnassets versions

Cleanup applied: removed ~480 working artifacts not appropriate for the
production repo:
- 25 PNG in repo root (male_rats*.png, spritesheet*.png)
- 416 tile extracts in tools/lpc_extract/grid/
- scattered debug PNGs (bushes, preview, montages, etc.)
- early iteration scripts (animate_rat v1-v4, restyle v2-v10, etc.)

Kept: 32 new LPC-style sprites in assets/Rat_LPC_Style/, 4 animation
sprite sheets in assets/Rat_Animated/, 64 updated Rat sprites, 22
final-version generator scripts, plus all .py/.md updates.
2026-06-27 17:53:45 +02:00
Matteo Benedetto 2eccf504f5 Add semi-transparent tunnel cover overlay for internal passages
- Add sdl2.create_overlay_texture() and draw_overlay_texture(alpha) for
  transparent full-map overlays built from sub-tile surface blits.
- Add Graphics.regenerate_tunnel_cover() which builds an overlay of
  4 random grass sub-tiles (20x20) for every internal tunnel cell,
  defined as a tunnel cell surrounded by occupied cells (wall or
  tunnel) on all four sides. Cells with at least one open side are
  handled by cave_foreground and skipped here.
- Draw the tunnel cover in the game loop after top-layer units/effects
  but before cave_foreground and points, at 95% opacity (alpha=242)
  so the unit and effect passing underneath is just barely visible.
2026-06-16 23:06:17 +02:00
Matteo Benedetto 5afdf3705b Render rats inside internal tunnel passages
Previously Rat.draw() hid any rat whose center fell inside a tunnel.
The clipping helper only handled single-entrance cells and returned None
for internal passages/crossroads, causing rats to vanish entirely.

Now internal tunnel cells (those with 0 or 2+ open sides) draw the rat
normally so it remains visible while walking through the tunnel.
Single-entrance cells keep the partial clip effect.
Also fix the visible-ratio math for DOWN/RIGHT clipping: the old
formulas subtracted cell_size from a local coordinate, producing
zero or negative visibility.
2026-06-16 20:37:46 +02:00
Matteo Benedetto b1e9770991 Use wall-only neighbor checks for wall border rendering
Previously regenerate_background() used occupied() (wall or tunnel) to
choose wall border/corner tiles. This caused walls adjacent to tunnels
to render with inner corners as if the tunnel were solid ground.

Now wall border logic uses is_wall() so only actual wall neighbors
influence the shape. Tunnel neighbor checks for flower-suppression are
kept explicit.
2026-06-16 20:24:33 +02:00
John Doe 486cd6b7c5 Add non-regression test states and Bluetooth diagnostic script
- Introduced a new JSON file containing non-regression test states with detailed unit information, including positions, ages, and movement directions across multiple frames.
- Added a shell script for Bluetooth diagnostics that checks system information, Bluetooth binaries, running processes, D-Bus status, Bluetooth controller details, and audio stack status, providing a comprehensive overview for troubleshooting.
2026-05-17 23:36:24 +02:00
John Doe d9d7a4ac82 Update keybindings and enhance loading screen functionality
- Refactor keybindings for gas spawning across multiple configurations
- Implement new loading screen updates during game initialization
- Add tests to ensure all weapon actions are exposed in keybinding profiles
- Introduce new assets for explosion effects
2026-05-09 13:29:32 +02:00
John Doe eaafd92dc2 Enhance asset loading by removing unnecessary surface parameter and adding texture variants for grass and flowers 2026-03-28 16:53:22 +01:00
John Doe b60ffd87aa Refactor code structure for improved readability and maintainability 2026-03-28 16:05:08 +01:00
John Doe 02202e4d3d Add new PNG images for clean and preview outputs
- Added `image_clean.png` to the output directory for the clean image representation.
- Added `image_clean_preview.png` for the preview of the clean image.
- Introduced `image_svg_clean.png` for the SVG clean image representation.
2026-03-27 23:40:27 +01:00
John Doe b4224ed3a1 v1.1: Performance optimizations and bug fixes
Major improvements:
- NumPy-based collision system supporting 200+ units (~3ms/frame)
- Spatial hashing with vectorized distance calculations
- 4-pass game loop ensuring correct collision timing
- Blood overlay system with pre-generated stain pool
- Cached render positions and viewport bounds
- Spawn protection preventing rats spawning on weapons

Bug fixes:
- Fixed bombs not killing rats (collision system timing)
- Fixed gas not affecting rats (collision system timing)
- Fixed rats spawning on weapons (added has_weapon_at check)
- Fixed AttributeError with Gas collisions (added isinstance check)
- Fixed blood stain transparency (RGBA + SDL_BLENDMODE_BLEND)
- Reduced point lifetime from 200 to 90 frames (~1.5s)
- Blood layer now clears on game restart

Technical changes:
- Added engine/collision_system.py with CollisionLayer enum
- Updated all units to use collision layers
- Pre-allocate NumPy arrays with capacity management
- Hybrid collision approach (<10 simple, ≥10 vectorized)
- Python 3.13 compatibility
2025-10-24 20:04:26 +02:00
Matteo Benedetto c004edef8f Update asset loading to include transparent color and adjust white flash timing; enhance nuclear bomb scoring and gas unit die method 2025-08-21 19:00:32 +02:00
Matteo Benedetto 8a32aad877 OK 2025-08-17 18:49:07 +02:00
Matteo Benedetto c35fc9f1f7 mine implementation 2025-08-14 16:53:15 +02:00
Matteo Benedetto a4b6703d12 Enhance blood stain handling: combine existing and new blood surfaces for better accumulation and add surface management 2025-08-13 23:50:21 +02:00
Matteo Benedetto 243bb6d9bd Enhance blood stain mechanics: add dynamic blood surface generation and integrate blood stains into game rendering 2025-08-13 23:30:43 +02:00
Matteo Benedetto 689b21bf65 Add unit tests for UnitFactory functionality and initialize units package 2025-08-13 20:36:51 +02:00
Matteo Benedetto 0ad9cd47c6 Aggiungi supporto per SDL e sostituisci il sistema grafico basato su Tkinter 2024-12-14 23:00:22 +01:00
Matteo Benedetto a6a06d1d54 Aggiungi file .gitignore e nuove immagini BMP per il progetto Rat 2024-12-08 01:45:16 +01:00