For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Rising default sound volume of a projectile

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
Post Reply
User avatar
Krull0r
Global Moderator
Posts: 543
Joined: Sun Jul 01, 2007 4:07 pm

Rising default sound volume of a projectile

Post by Krull0r »

Hi there

is it possible to rise the default sound volume of a projectile ( spawn sound ) without editing the source audio file?
I added some new sounds and I already pished the sound volume in the source file to the limit. If I rise it more it will clip like hell...

The problem is now that the sound is really really silent in-game


Greetz Krull0r
Image
User avatar
Feralidragon
OldUnreal Member
Posts: 239
Joined: Thu Jul 24, 2008 6:57 pm

Re: Rising default sound volume of a projectile

Post by Feralidragon »

I just did a quick check, and it seems that SpawnSound is only called natively, since there doesn't seem to be any UScript-level function playing it (in UT at least, didn't check Unreal, but it's probably the same).

This, coupled with the fact that the volume is too low, seems to indicate that the volume seems to be hardcoded to a a specific small value, although perhaps only Smirftsch may be able to confirm this.

If the projectile is entirely yours, you can simply not use the SpawnSound at all, and instead create your own sound property, set it with the sound you want, and play it from one of the *BeginPlay functions instead, in which you can fully control the volume.
Last edited by Feralidragon on Thu Feb 22, 2018 4:52 pm, edited 1 time in total.
User avatar
Krull0r
Global Moderator
Posts: 543
Joined: Sun Jul 01, 2007 4:07 pm

Re: Rising default sound volume of a projectile

Post by Krull0r »

Awesome!

Thank you very much =) that helped alot!

I'm really happy to be a part of this community, Unreal is an old game and there are still people who can help out in solving problems!
Image
User avatar
.:..:
OldUnreal Member
Posts: 1635
Joined: Tue Aug 16, 2005 4:35 am

Re: Rising default sound volume of a projectile

Post by .:..: »

SpawnSound is played within UnrealScript, but in most cases without params.
For example SlithProjectile:

Code: Select all

      function BeginState()
      {      
            i=-1;
            if (FRand() < 0.5)
                  DrawScale = 0.3 + 0.7 * FRand();
            Velocity = Vector(Rotation) * speed;      
            SetTimer(0.2,True);
            RotationRate.Yaw = Int(200000 * FRand()) - 100000;
            RotationRate.Pitch = Int(FRand() * (200000 - Abs(RotationRate.Yaw))) 
                                                - (100000 - Abs(RotationRate.Yaw)/2);
            LoopAnim('Flying',0.4);
            SurfaceNormal = Vect(0,0,0);
            bInAir=True;
            PlaySound(SpawnSound);
            if( Region.zone.bWaterZone )
                  Velocity=Velocity*0.7;
      }
That means you can either override the function to play at higher volume, or increase "TransientSoundVolume" of the projectile, or play same sound at multiple different sound slots.
1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD :P
(ಠ_ಠ)
User avatar
Masterkent
OldUnreal Member
Posts: 1469
Joined: Fri Apr 05, 2013 12:41 pm

Re: Rising default sound volume of a projectile

Post by Masterkent »

I just did a quick check, and it seems that SpawnSound is only called natively, since there doesn't seem to be any UScript-level function playing it (in UT at least, didn't check Unreal, but it's probably the same)
SpawnSound is used by UScript-level functions in both Unreal and UT. Just open UnrealShare.u or Botpack.u in any text editor and look up for string SpawnSound.
This, coupled with the fact that the volume is too low, seems to indicate that the volume seems to be hardcoded to a a specific small value
Sound volume is specified in the 3rd argument of PlaySound/PlayOwnedSound. For example, in UnrealShare.Rocket, we have

Code: Select all

PlaySound(SpawnSound, SLOT_None, 2.3);
where 2.3 specifies the volume. When the 3rd argument is not provided, the actor's TransientSoundVolume is used instead. For example, in UnrealShare.BruteProjectile, we have:

Code: Select all

PlaySound(SpawnSound);
In this call, the value of sound volume is assumed to be equal to the projectile's TransientSoundVolume, which is 1 by default.

The effective range of values that can determine the volume is limited. Minimal value 0 corresponds to silence, maximal value 1 corresponds to full volume. All values outside of the range [0; 1] are clamped (that is, values below 0 are treated as 0, values above 1 are treated as 1), so you cannot amplify sounds by means of increasing the volume to values above 1. In particular,

Code: Select all

PlaySound(SpawnSound, SLOT_None, 2.3)
is functionally equivalent to

Code: Select all

PlaySound(SpawnSound, SLOT_None, 1)
The only way to increase sound volume over the full volume (which you can get using a single call of PlaySound/PlayerOwnedSound) is to call PlaySound/PlayOwnedSound multiple times.
Last edited by Masterkent on Fri Feb 23, 2018 10:43 am, edited 1 time in total.
User avatar
Feralidragon
OldUnreal Member
Posts: 239
Joined: Thu Jul 24, 2008 6:57 pm

Re: Rising default sound volume of a projectile

Post by Feralidragon »

While it seems to be the case for many projectiles for them to be playing the SpawnSound at the UScript-level, that doesn't seem to be true for all of them, for instance:
http://uncodex.ut-files.com/UT/v436/Source_botpack/rocketmk2.html
http://uncodex.ut-files.com/UT/v436/Source_botpack/razor2.html

As you may notice, the SpawnSound is set in the defaults, but it's not played anywhere in those projectiles, nor in the main projectile class, which is where one would expect such a property to play from in the first place if things were correctly implemented.

However, if you manually spawn that rocket or razor, you do hear the SpawnSound being played anyway (as far as I remember, didn't try it recently), and given that Projectile has for certain a native component (due to the class definition), this leads me to believe that SpawnSound is at least also played natively with either a hardcoded value, or by using the TransientSoundVolume as you mentioned.


Which raises an interesting question: could it be that it actually started just as a property in Unreal, hence Unreal projectiles playing it at UScript level, but was later moved to the native code in UT, given that some UT projectiles do not explicitly play it?

Because the way I see it thus far, unless I am missing something here, then the SpawnSound will play twice in most projectiles then, one first at the native level, and then another at UScript-level, which depending on the used channel, may or may not override the already playing sound, hence perhaps not being noticed.


EDIT: In the meanwhile I checked the weapons themselves, and the UT eightball for example has this though:

Code: Select all

PlayOwnedSound(class'RocketMk2'.Default.SpawnSound, SLOT_None, 4.0*Pawn(Owner).SoundDampening);
I will check later on today if the SpawnSound is indeed played on its own by these projectiles without a weapon to confirm, or if they play simply because the weapon plays it for them.
I had forgotten how messy Epic's code was, nothing is where you would expect to be, goddamn...
Last edited by Feralidragon on Fri Feb 23, 2018 12:10 pm, edited 1 time in total.
User avatar
Masterkent
OldUnreal Member
Posts: 1469
Joined: Fri Apr 05, 2013 12:41 pm

Re: Rising default sound volume of a projectile

Post by Masterkent »

for instance:
http://uncodex.ut-files.com/UT/v436/Source_botpack/rocketmk2.html
http://uncodex.ut-files.com/UT/v436/Source_botpack/razor2.html

As you may notice, the SpawnSound is set in the defaults, but it's not played anywhere in those projectiles, nor in the main projectile class, which is where one would expect such a property to play from in the first place if things were correctly implemented.
That's an obvious rudiment, considering where these classes originate from. Find 10 similarities:


Botpack.RocketMk2UnrealShare.Rocket
ExplosionDecal=Class'Botpack.BlastMark' 
MyDamageType=RocketDeathMyDamageType="Exploded"
speed=900.000000speed=900.000000
MaxSpeed=1600.000000MaxSpeed=1600.000000
Damage=75.000000Damage=85.000000
MomentumTransfer=80000MomentumTransfer=80000
SpawnSound=Sound'UnrealShare.Eightball.Ignite'SpawnSound=Sound'UnrealShare.Eightball.Ignite'
ImpactSound=Sound'UnrealShare.Eightball.GrenadeFloor'ImpactSound=Sound'UnrealShare.Eightball.GrenadeFloor'
RemoteRole=ROLE_SimulatedProxyRemoteRole=ROLE_SimulatedProxy
LifeSpan=6.000000LifeSpan=6.000000
AnimSequence=WingAnimSequence=Armed
 Skin=FireTexture'UnrealShare.Effect16.fireeffect16'
Mesh=LodMesh'Botpack.UTRocket'Mesh=LodMesh'UnrealShare.RocketM'
DrawScale=0.020000DrawScale=0.050000
AmbientGlow=96AmbientGlow=96
bUnlit=TruebUnlit=True
bMeshCurvy=FalsebMeshCurvy=False
SoundRadius=14SoundRadius=9
SoundVolume=255SoundVolume=255
SoundPitch=100 
AmbientSound=Sound'Botpack.RocketLauncher.RocketFly1'AmbientSound=Sound'UnrealShare.General.Brufly1'
LightType=LT_SteadyLightType=LT_Steady
LightEffect=LE_NonIncidenceLightEffect=LE_NonIncidence
LightBrightness=255LightBrightness=126
LightHue=28LightHue=28
LightSaturation=0LightSaturation=64
LightRadius=6LightRadius=6
bBounce=TruebBounce=True
bFixedRotationDir=True 
RotationRate=(Roll=50000) 
DesiredRotation=(Roll=30000) 
 bCorona=True
 NetPriority=6.000000

Rocket.uc uses SpawnSound in function Flying.BeginState.
However, if you manually spawn that rocket or razor, you do hear the SpawnSound being played anyway (as far as I remember, didn't try it recently), and given that Projectile has for certain a native component (due to the class definition), this leads me to believe that SpawnSound is at least also played natively with either a hardcoded value, or by using the TransientSoundVolume as you mentioned.
That doesn't take place - at least in case of UT v436.
Last edited by Masterkent on Fri Feb 23, 2018 3:55 pm, edited 1 time in total.
User avatar
Feralidragon
OldUnreal Member
Posts: 239
Joined: Thu Jul 24, 2008 6:57 pm

Re: Rising default sound volume of a projectile

Post by Feralidragon »

Just went ahead and made a small test to confirm, and yeah, SpawnSound is only used at UScript-level, my mistake. :-[

I also realized where my misconception came from: I remember testing rockets by just spawning them, and "hear" them upon spawn, but it seems that what I was hearing was just the AmbientSound, which was strong and brief, kinda like the SpawnSound used implies ("ignite") leading me to believe it was the SpawnSound instead.

Clearly there's still a lot of stuff I forgot how it worked over the years while I was out, so next time I will thoroughly check and confirm things first through testing to avoid the risk of spreading any misinformation again.



@Krull0r: ... which means, that you don't need to do any of what I suggested at all, and as a matter of fact it would very probably be the wrong approach, sorry about that.
All you have to do is to check how the SpawnSound is already being used, given that since the Projectile class doesn't use it, it probably means you're extending or reusing an existing projectile subclass.

Still, I would advise against using TransientSoundVolume, since that would affect other sounds being played by the same actor, unless every PlaySound executed in the class you're targetting has a specific volume that doesn't depend on it already, at which point it may be OK-ish to do so.
Since, from where I stand, unless I am wrong again, TransientSoundVolume seems to be mostly meant to define how loud an actor is overall by default, and not to target a specific sound.

So it all goes down to exactly which projectile you're targeting with that, since each case is a case, and if you play the SpawnSound yourself, you have full control over its volume already. :)
Last edited by Feralidragon on Sat Feb 24, 2018 12:18 am, edited 1 time in total.
User avatar
Krull0r
Global Moderator
Posts: 543
Joined: Sun Jul 01, 2007 4:07 pm

Re: Rising default sound volume of a projectile

Post by Krull0r »

Okay :) I followed that discussion, very interesting stuff.

I already changed the spawn sound source it self. Since some projectiles have a visual spawn effect ( like MercFlare ) I added the spawning sound at that effect class. so I do not have any pitch issues with very fast projectiles.


But you helped me anyways. I learned a lot of new stuff with your advice. :)
Image
Post Reply

Return to “UScript Board”