[Solved] Sounds not playing during cutscene but only in arbitrary locations
Posted: Sat Nov 12, 2022 3:00 pm
I have a mod which providers teleporters. Teleportation involves a cutscene sequence which pans from one teleporter to another. Scripted visual and sound effects are triggered at various waypoints along the cutscene, positioned at either the source or destination teleporters.
As of fairly recently, sounds are failing to play at a small subset of destination teleporters unless the source teleporter is extremely close by. The sounds are played in three ways:
- As the sound property of an explosion prototype
- Directly by the cutscene stage waypoint trigger using surface.play_sound()
- Less directly in a staggered temporary on_tick() sequencer using surface.play_sound(), i.e. not triggered directly by the cutscene waypoint
So the method of playing the sound does not seem to matter - they just aren't played.
I have a test base with about 12 platforms. Sounds only fail to play on arrival at 2 of them. This happens consistently for those 2 platforms, which are nowhere near each other, unless I set up a new platform within a chunk or so and teleport from there. The surrounding entities for each platform are all very different. All the other platforms function correctly 100% of the time regardless of the distance transitioned.
Here is what I have tried so far to debug this:
- Inspecting every other nearby entity's sound info in debug mode
- Removing every other nearby entity except for power poles
- Increasing the audible_distance_modifier property of the sounds
- Adding wait times between cutscene waypoints before the sounds are played
- Removing max_per_sound_type limits on all entities
- Removing the idle drone that transmat platforms make
- Increasing the game's hidden setting that limits all sounds to a max of 192 up to 256
- Changing the game's sound system to the legacy Allegro backend
- Changing the surface.play_sound() methods to be positionless, i.e. play for all players on the surface regardless of location
- Use player.play_sound() instead of surface.play_sound()
None of these bore any fruit.
Can you think of anything I am missing?
My bonus question is: is the value of player.position accurately updated during a cutscene transition? This doesn't explain why some sounds work perfectly well over arbitrary distances between the source and destination of the transition but it might help me figure this out.
As of fairly recently, sounds are failing to play at a small subset of destination teleporters unless the source teleporter is extremely close by. The sounds are played in three ways:
- As the sound property of an explosion prototype
- Directly by the cutscene stage waypoint trigger using surface.play_sound()
- Less directly in a staggered temporary on_tick() sequencer using surface.play_sound(), i.e. not triggered directly by the cutscene waypoint
So the method of playing the sound does not seem to matter - they just aren't played.
I have a test base with about 12 platforms. Sounds only fail to play on arrival at 2 of them. This happens consistently for those 2 platforms, which are nowhere near each other, unless I set up a new platform within a chunk or so and teleport from there. The surrounding entities for each platform are all very different. All the other platforms function correctly 100% of the time regardless of the distance transitioned.
Here is what I have tried so far to debug this:
- Inspecting every other nearby entity's sound info in debug mode
- Removing every other nearby entity except for power poles
- Increasing the audible_distance_modifier property of the sounds
- Adding wait times between cutscene waypoints before the sounds are played
- Removing max_per_sound_type limits on all entities
- Removing the idle drone that transmat platforms make
- Increasing the game's hidden setting that limits all sounds to a max of 192 up to 256
- Changing the game's sound system to the legacy Allegro backend
- Changing the surface.play_sound() methods to be positionless, i.e. play for all players on the surface regardless of location
- Use player.play_sound() instead of surface.play_sound()
None of these bore any fruit.
Can you think of anything I am missing?
My bonus question is: is the value of player.position accurately updated during a cutscene transition? This doesn't explain why some sounds work perfectly well over arbitrary distances between the source and destination of the transition but it might help me figure this out.