Skip to content

Conversation

@dangero2000
Copy link
Contributor

This commit was contributed by Claude Code. I was skeptical of using AI tools on your code base, but after reading your blog and seeing you use it yourself, and considering the open sourced nature of Screaming Strike, I figured you wouldn't mind. This was previously about 3-4 commits long, but considering the previous commits were broken implementation, and that this one has fixed most if not all of the bugs, I decided to rebase into a single commit to keep the repo clean and uncluttered. The rest of this commit description is written by Claude Code with miner edits from me.

This commit adds an environment system to Screaming Strike that allows players to switch between different sound environments with footsteps, body falls, and optional ambient sound.

Features:

  • Environment selection in options menu (below item voice selection)
  • Dynamic environment switching without restart (like item voices)
  • Ambiance volume control (環境音ボリューム) in options menu, (it is recommended to set ambiance volume to no higher than 5)
  • Preview footstep sound when switching environments
  • Optional ambiance sound (amb.ogg) with volume control
  • Ambiance plays during gameplay and stops on quit/game over
  • Support for unlimited footstep (step*.ogg) and body fall (fall*.ogg) sounds, or as many sounds as your machine can reasonably load
  • Requires minimum 1 of each type, automatically loads all available
  • Backward compatible with existing saves

Edge Case Handling:

  • Validates environment on load: defaults to first alphabetically if previously-selected environment is deleted/missing
  • Complete fallback to old sounds (s_lf*.ogg, dead.ogg) when no environments exist
  • Fixed crash when attempting to navigate the environment list in the options menu when no environments are available, (it shows a message stating "No environments found")
  • Fixed infinite loop crash with environments which only contain 1 footstep sound

Technical Implementation:

  • gameOptions.py: Added environment and ambianceVolume options
  • ssAppMain.py: Added environment scanning, dynamic sound loading, and ambiance playback
    • getEnvironmentsList(): Scans data/environments/ for available environments (sorted alphabetically)
    • loadEnvironmentSounds(): Loads footsteps and body falls with fallback logic
    • startAmbiance()/stopAmbiance(): Controls ambient sound playback
    • Dynamic reload in optionChange() when environment is switched
    • Environment validation in initialize() for deleted/missing environments
    • Memory management: frees old sounds when switching environments
  • enemy.py: Modified to use environment-based footsteps and body falls
    • Randomly selects from available sounds with variation check
  • Added translations for all supported languages (en_US, ja_JP, tr_TR, v_VN)

File Structure:

  • data/
  • environments/
  • [environment_name]/
  • amb.ogg (ambiance - optional)
  • fall*.ogg (body falls - at least 1 required, unlimited supported)
  • step*.ogg (footsteps - at least 1 required, unlimited supported)

🤖 Code contributed by Claude Code (https://claude.com/claude-code)

This commit adds a comprehensive environment system to Screaming Strike
that allows players to switch between different sound environments with
footsteps, body falls, and optional ambient sound.

Features:
- Environment selection in options menu (below item voice selection)
- Dynamic environment switching without restart (like item voices)
- Ambiance volume control (環境音ボリューム) in options menu
- Preview footstep sound when switching environments
- Optional ambiance sound (amb.ogg) with volume control
- Ambiance plays during gameplay and stops on quit/game over
- Support for unlimited footstep (step*.ogg) and body fall (fall*.ogg) sounds
- Requires minimum 1 of each type, automatically loads all available
- Backward compatible with existing saves
- Environments sorted alphabetically for predictable defaults
- Robust fallback to legacy sounds when no environments exist

Edge Case Handling:
- Validates environment on load: defaults to first alphabetically if deleted/missing
- Complete fallback to old sounds (s_lf*.ogg, dead.ogg) when no environments exist
- Shows "No environments found" message when navigating with empty folder
- Fixed crash when navigating with no environments available
- Fixed infinite loop crash with single-sound environments

Technical Implementation:
- gameOptions.py: Added environment and ambianceVolume options with backward compatibility
- ssAppMain.py: Added environment scanning, dynamic sound loading, and ambiance playback
  - getEnvironmentsList(): Scans data/environments/ for available environments (sorted alphabetically)
  - loadEnvironmentSounds(): Loads footsteps and body falls with robust fallback logic
  - startAmbiance()/stopAmbiance(): Controls ambient sound playback
  - Dynamic reload in optionChange() when environment is switched
  - Environment validation in initialize() for deleted/missing environments
  - Memory management: frees old sounds when switching environments
- enemy.py: Modified to use environment-based footsteps and body falls
  - Fixed infinite loop bug when only 1 sound file exists
  - Randomly selects from available sounds with variation check
- Added translations for all supported languages (en_US, ja_JP, tr_TR, v_VN)

File Structure:
data/environments/
  └── [environment_name]/
      ├── step*.ogg (footsteps - at least 1 required, unlimited supported)
      ├── fall*.ogg (body falls - at least 1 required, unlimited supported)
      └── amb.ogg (ambiance - optional)

🤖 Code contributed by Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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