Page 1 of 1

[Solved] Sounds not playing during cutscene but only in arbitrary locations

Posted: Sat Nov 12, 2022 3:00 pm
by Deadlock989
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.

Re: Sounds not playing during cutscene but only in arbitrary locations

Posted: Sun Jan 08, 2023 4:23 pm
by Donion
Can you provide the test base?

Re: Sounds not playing during cutscene but only in arbitrary locations

Posted: Sun Jan 08, 2023 6:38 pm
by Deadlock989
Donion wrote:
Sun Jan 08, 2023 4:23 pm
Can you provide the test base?
PM sent.

Re: Sounds not playing during cutscene but only in arbitrary locations

Posted: Wed Feb 01, 2023 12:29 pm
by Donion
Alright, I've finally looked into this. The reason why the sounds are not played at some of the locations in the provided save is that they are in fog of war at the time of starting the teleport and the destination chunk is re-charted later than the play sound events with the destination location fire (and fail).

Re: Sounds not playing during cutscene but only in arbitrary locations

Posted: Wed Feb 01, 2023 9:38 pm
by Deadlock989
Thanks, that's a huge relief. It never would have occurred to me that an uncharted area remains uncharted when a player controller in cutscene mode moves into it. By charting a very small area around the position of the sound just before you play it (the target entity's bounding box is ideal), the issue is solved.