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

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

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

Post 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.
Last edited by Deadlock989 on Wed Feb 01, 2023 9:38 pm, edited 1 time in total.
Image

Donion
Factorio Staff
Factorio Staff
Posts: 163
Joined: Sun Aug 22, 2021 9:18 am
Contact:

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

Post by Donion »

Can you provide the test base?

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

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

Post by Deadlock989 »

Donion wrote:
Sun Jan 08, 2023 4:23 pm
Can you provide the test base?
PM sent.
Image

Donion
Factorio Staff
Factorio Staff
Posts: 163
Joined: Sun Aug 22, 2021 9:18 am
Contact:

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

Post 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).

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

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

Post 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.
Image

Post Reply

Return to “Modding help”