Replicate AmbientSound parameters to clients

Tutorials and discussions about Mapping - Introduce your own ones!
lafoxxx
Novice
Posts: 25
Joined: Sun Jun 01, 2025 7:31 pm
Personal rank: UNUSED

Replicate AmbientSound parameters to clients

Post by lafoxxx »

Hi.
Need to change AmbientSound's options (the sound itself) on clients.
Using SBPropertyChanger only works on Server side (obviously), no matter which ROLE is set under Network.
can you recommend better approach?

(I can try and attach the sound source to invisible Movers instead, so they will "play" the sound when close to desired location).
Red_Fist
Godlike
Posts: 2332
Joined: Sun Oct 05, 2008 3:31 am

Re: Replicate AmbientSound parameters to clients

Post by Red_Fist »

You might need to tell it first to then flip it, as opposed to just changing the value right away.
Start the actor out wrong (or one way) and set it the other way, as the game starts with a trigger.
Then switch it back for the next one or next time, each time.

Maybe it will stay working after that.
Binary Space Partitioning
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Replicate AmbientSound parameters to clients

Post by Barbie »

lafoxxx wrote: Sat Jun 21, 2025 11:28 pm Need to change AmbientSound's options (the sound itself) on clients.
Are you talking about things happen
⇨ at the server which you want to be also done on clients
or
⇨ while you are editing a map?

Changing SoundRadius, SoundVolume, SoundPitch and the AmbientSound itself (if it exists on client¹) should be transferred to clients according Actor's replication rules:

Code: Select all

replication
{
	…
	// Ambient sound.
	unreliable if( (Role==ROLE_Authority) && (!bNetOwner || !bClientAnim) )
		AmbientSound;
	unreliable if( AmbientSound!=None && Role==ROLE_Authority  && (!bNetOwner || !bClientAnim) )
		SoundRadius, SoundVolume, SoundPitch;
1) If the sound you have assigned is not loaded at client they cannot play it. Open map in Editor and then "Sound Browser": you can use only the sounds currently used and listed there.
"If Origin not in center it be not in center." --Buggie
lafoxxx
Novice
Posts: 25
Joined: Sun Jun 01, 2025 7:31 pm
Personal rank: UNUSED

Re: Replicate AmbientSound parameters to clients

Post by lafoxxx »

Hey,

I'm talking about
Barbie wrote: Sun Jun 22, 2025 9:51 am
⇨ at the server which you want to be also done on clients

When "Start practice session" it works, when "Dedicated" I only see successful messages in the Server console but don't hear the changes in Client game.

I've made sure all sounds are loaded by creating AmbientSounds with same sound (but very low volume) so the game could pre-load them (didn't work unless done that).

Attached files for testing.
To reproduce, touch the posters on the wall (first in Practice session then in Dedicated&LAN)
You do not have the required permissions to view the files attached to this post.
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Replicate AmbientSound parameters to clients

Post by Barbie »

There is no script code that activates the ambient sound of an actor, and so I assume the sound is started by engine. If the value of property "AmbientSound" changes after that, there is nothing that plays the new sound and so I'm wondering why it even works local.
:loool:

But it can be solved by a little bit of scripting; have a look at attached map and the MyLeveled custom Actors MusicTrigger and MultiTriggerableAmbientSound. (If you want to use that: Do you know how to get MyLevel things into your map?)

PS: texture file "CompuTex.utx" is missing.
PPS: you should have a look at these:
UnrealTournament.log wrote:

Code: Select all

ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker57 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker58 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker78 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker79 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker80 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker83 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker84 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker85 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker86 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker87 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker88 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker89 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker90 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker91 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker92 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker93 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'
ScriptWarning: WarpZoneMarker Autoplay.WarpZoneMarker94 (Function Engine.WarpZoneMarker.PostBeginPlay:000A) Accessed None 'markedWarpZone'

You do not have the required permissions to view the files attached to this post.
"If Origin not in center it be not in center." --Buggie
lafoxxx
Novice
Posts: 25
Joined: Sun Jun 01, 2025 7:31 pm
Personal rank: UNUSED

Re: Replicate AmbientSound parameters to clients

Post by lafoxxx »

Thanks Barbie! Works, even on Client.

I loaded them bu first opening your map then mine -- scripts stayed and I just reused them in my map.

I assume this "TriggerSound" is new and independent property -- when AmbientSound already exists it doesn't get changed and still plays (2 sounds at once, basically). But this can be worked around

P.s. strange, thought I attached it -- there's nothing important inside anyway, DefaultTexture works.
P.p.s these are leftovers from the map parts I removed to decrease the size. Didn't see they didn't get removed when preparing the test map.
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Replicate AmbientSound parameters to clients

Post by Barbie »

Don't set an AmbientSound for MultiTriggerableAmbientSound nor for MusicTriggers. Should MultiTriggerableAmbientSound play one sound at start without triggering?
"If Origin not in center it be not in center." --Buggie
lafoxxx
Novice
Posts: 25
Joined: Sun Jun 01, 2025 7:31 pm
Personal rank: UNUSED

Re: Replicate AmbientSound parameters to clients

Post by lafoxxx »

I expected it to play first one from the list at start, yes.
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Replicate AmbientSound parameters to clients

Post by Barbie »

lafoxxx wrote: Sun Jun 22, 2025 11:06 pm I expected it to play first one from the list at start, yes.
You can use an additional once-only "MusicTrigger" with huge radius so when a player appear, sound is played. Use the following MusicTrigger that has the "bTriggerOnceOnly" property:

Code: Select all

class MusicTrigger expands Triggers;

var() bool bTriggerOnceOnly;


function Touch(actor Other) {
local actor A;

	if (PlayerPawn(Other) == None)
		return;
	if (Event != '')
		foreach AllActors(class 'Actor', A, Event)
			A.Trigger(self, Other.Instigator );
	if (bTriggerOnceOnly)
		Disable('Touch');
}
I found other differences to AmbientSound:
  • Ambientsound's properties are not taken into account in net play.
  • When sound is not a looping one, it stops at end (in contrast to AmbientSound which loops it automatically).
  • I disabled restarting the same sound when retriggered - but that prevents playing the same sound after it has stopped. :facepalm:
"If Origin not in center it be not in center." --Buggie
lafoxxx
Novice
Posts: 25
Joined: Sun Jun 01, 2025 7:31 pm
Personal rank: UNUSED

Re: Replicate AmbientSound parameters to clients

Post by lafoxxx »

On a second check I've now noticed that the sound isn't looped during network play. It was looping when tested Offline, so it took a while to actually notice.
So, for now I'm using Pre-looped WAV sounds.

Question: possible to keep the sound playing when leaving and re-entering the area? Because when you re-enter the area there's no sound.
So far approach with huge TransientSoundRadius works only in Offline mode, and keeps playing in other areas as well.
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Replicate AmbientSound parameters to clients

Post by Barbie »

Before messing around with on- and offline issues I suggest to use a triggerable AmbientSound for each sound at the same place together with a controller that stops the current sound and starts the new one when triggered. So also the sound is playing when a player approaches.

Auto merged new post submitted 3 hours 11 minutes later

Test case ready - should work fine on- and offline.
1) Add an 'AmbientSoundTriggerable' for each sound and set its 'bInitiallyOn' accordingly.
2) Add a 'SoundTrigger' for each sound and set its 'AmbientSoundToActivate' to one of them added in (1) .
3) Add ONE JukeboxController and fill its array SoundTriggers with the added ones in (2) .
You do not have the required permissions to view the files attached to this post.
"If Origin not in center it be not in center." --Buggie
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Replicate AmbientSound parameters to clients

Post by Barbie »

Just another point: I downloaded a map that also uses CompuSFX.uax but it is another version:
CompuSFX.uax-CRC-1629F510.jpg
Did you remove something from that sound file?
You do not have the required permissions to view the files attached to this post.
"If Origin not in center it be not in center." --Buggie
lafoxxx
Novice
Posts: 25
Joined: Sun Jun 01, 2025 7:31 pm
Personal rank: UNUSED

Re: Replicate AmbientSound parameters to clients

Post by lafoxxx »

Barbie wrote: Sun Jun 29, 2025 12:11 am Did you remove something from that sound file?
I removed and readded same 4 files -- but this time the sounds in question are Looped (added Regions in WAV files) -- this Workaround
worked for people to check out the room.
Other sounds were added later, because this specific file is for the "main" map (work in progress) you could've seen.

I'll try with the newer version, thanks!
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Replicate AmbientSound parameters to clients

Post by Barbie »

lafoxxx wrote: Mon Jun 30, 2025 1:01 am I removed and readded same 4 files
Then please don't release that modified one with that name to the public - you will add one more file-mismatch-case. Maybe add a pre- or postfix or rename it completely.
"If Origin not in center it be not in center." --Buggie
lafoxxx
Novice
Posts: 25
Joined: Sun Jun 01, 2025 7:31 pm
Personal rank: UNUSED

Re: Replicate AmbientSound parameters to clients

Post by lafoxxx »

Just tried.
This version seems to work best, thanks a lot..
Barbie wrote: Mon Jun 30, 2025 12:34 pm Then please don't release that modified one with that name to the public - you will add one more file-mismatch-case. Maybe add a pre- or postfix or rename it completely.
Well.. all clients seem to have automatically updated the file in question with no problems.
Considering it's not yet officially released anywhere (aside from the Test server) I don't really see the issue here. But I agree and will likely use this approach to avoid confusion.