Feature: Add environment system with dynamic switching and ambiance support#50
Open
dangero2000 wants to merge 1 commit intoyncat:masterfrom
Open
Feature: Add environment system with dynamic switching and ambiance support#50dangero2000 wants to merge 1 commit intoyncat:masterfrom
dangero2000 wants to merge 1 commit intoyncat:masterfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Edge Case Handling:
Technical Implementation:
File Structure:
🤖 Code contributed by Claude Code (https://claude.com/claude-code)