-
Notifications
You must be signed in to change notification settings - Fork 0
Debugging
Tools and techniques for debugging the Dynamic Ambient System.
ambient debug info # Basic system state
ambient debug runtime # Show runtime duration
ambient debug tracks # Print all track states
ambient debug ui # Toggle debug overlay# Check system state
$ print(f"Active: {ambient.is_active}")
$ print(f"Arrangement: {ambient.active_arrangement.name if ambient.active_arrangement else 'None'}")
$ print(f"Layers: {ambient.active_layers}")
# Check track states
python:
for track_id, data in ambient.tracks.items():
print(f"{track_id}: playing={data['is_playing']}, vol={data['current_volume']:.2f}")The debug overlay shows real-time system information.
Using CDS:
ambient debug uiUsing Python:
$ toggle_ambient_debug() # If defined in debug_ambient.rpyThe overlay displays:
- System status (active/inactive)
- Current arrangement name
- Active layers
- Runtime duration
- Track list with:
- Playing status
- Current/target volume
- Track type
- Elevation status (for random tracks)
- Wave system state:
- Current wave progress
- Elevated track count
- Cooldown timer
- Timer counts
The system prints debug information to the Ren'Py console.
DynamicAmbientSystem: Registering 8 ambient channels.
DynamicAmbientSystem: Configuration loaded successfully.
DEBUG: Track birds target_volume: 0.00 -> 0.35, type=random
DEBUG: Checking track wind. Playing: True, Channel: ambient_3, Fade: 3.0
DEBUG: max_fade_time = 4.0, scheduling stop in 4.5s
DEBUG: Force stopping all ambient channels
DynamicAmbientSystem: Error loading configuration: [details]
Arrangement 'invalid_name' not found.
Layer 'missing' not found in arrangement 'scene'.
Error: Track ID 'unknown' has no filename and is not in registry.
Check:
-
Is the system active?
$ print(ambient.is_active)
-
Is the track in the current arrangement?
$ print(ambient.active_arrangement.tracks_config.keys())
-
Is the track configured correctly?
$ print(ambient.tracks.get("track_id"))
-
Does the audio file exist?
- Check file path in
audio_assets.yaml - Verify file is in
game/audio/folder
- Check file path in
Check current volumes:
python:
for tid, data in ambient.tracks.items():
print(f"{tid}: current={data['current_volume']:.3f}, target={data['target_volume']:.3f}")Check base volume:
$ print(f"Base volume: {ambient.base_volume}")Check arrangement multipliers:
$ print(ambient.active_arrangement.tracks_config)Check wave system state:
python:
print(f"Elevated count: {ambient.elevated_tracks_count}")
print(f"Wave limit: {ambient.current_wave_limit}")
print(f"Wave count: {ambient.wave_elevation_count}")
print(f"Cooldown end: {ambient.global_cooldown_end_time}")
print(f"Fading out: {ambient.tracks_fading_out}")Check track configuration:
python:
track = ambient.tracks.get("track_id")
if track:
print(f"Type: {track['type']}")
print(f"Chance: {track['play_chance']}")
print(f"Is elevated: {track.get('is_elevated', False)}")Check arrangement exists:
$ print("my_arrangement" in ambient.arrangements)
$ print(list(ambient.arrangements.keys()))Check for errors in console after calling:
ambient play "my_arrangement"The ambient_integration.rpy provides a settings screen with debug info:
Access: Settings → Ambient Settings
Shows:
- Volume slider
- System status
- Track information
- Control buttons
- System statistics
Add your own debug logging:
init python:
def log_ambient_event(event, details=""):
if config.developer:
print(f"[AMBIENT] {event}: {details}")
label some_scene:
$ log_ambient_event("Playing arrangement", "forest_morning")
ambient play "forest_morning"
$ log_ambient_event("Enabling layer", "rain")
ambient layer "rain" on- PyYAML installed in
game/python-packages/? -
dynamic_ambient.rpyingame/folder? -
audio_assets.yamlexists and is valid YAML? - Check console for error messages
- Audio files exist at specified paths?
- Files in supported format (OGG recommended)?
- System is active (
ambient.is_active)? - Volume not zero (
ambient.base_volume)? - Ren'Py music volume not muted?
-
libs/rpda/02-rpda-cds.rpyexists? - Ren'Py version 8.5.0+?
- Restarted Ren'Py after adding CDS file?
- Correct syntax (quoted strings, keywords)?
- Using
play_arrangement()not manual track control? - Track defined in both arrangements?
- Check strict isolation is working (console output)
- System state should auto-restore
- Check
__getstate__and__setstate__in code - Timers are recreated after load
python:
print(f"Active timers: {len(ambient.active_timers)}")
print(f"Track timers: {len(ambient.track_timers)}")python:
used = sum(1 for t in ambient.tracks.values() if t.get('channel') and t['is_playing'])
print(f"Channels used: {used}/{len(ambient.ambient_channels)}")The volume update loop runs at 10 Hz (every 0.1 seconds). If performance issues occur:
- Reduce number of active tracks
- Check for timer accumulation
- Monitor console for excessive debug output
If the system gets into a bad state:
# Hard reset
$ ambient.stop_ambient(fade_out=False)
$ ambient._cancel_all_timers()
$ ambient.load_config()
# Then restart
$ ambient.play_arrangement("default")Or restart Ren'Py to reinitialize everything.
RenPy Dynamic Ambient System v2.0.0 | Home | Installation | Quick Start | FAQ