Game Development Community

Lighning script issue? (all sounds play in 2d when called upon)

by Ryan Jaeger · in Technical Issues · 08/19/2005 (7:06 pm) · 7 replies

For some reason all the lighting sounds for my lightning setup seem to be playing in 2D regardless of the profile description settings. Normaly you'd think you accidently used stereo sounds but this is not the case for 3 of the audio profiles that im having the issue with.

If anyone could spot the culprit via scripting error let me know, if this is a known issue with the source let me know ill forward it to my coders as I have no access...


[The following is the lightingdata datablock located within environment.cs, pretty typical stuff]
datablock LightningData(ThunderStormA)
{
strikeTextures[0] = "~/data/textures/precipitation/lightning";
strikeSound = LightningHitSound;
directDamageType = $DamageType::Lightning; // added
directDamage = 99; // added, player default life is 100

// Make sure all 8 are assigned to an audioprofile.
// No matter if its the same datablock twice.
thunderSounds[0] = thunderSound1;
thunderSounds[1] = thunderSound2;
thunderSounds[2] = thunderSound3;
thunderSounds[3] = thunderSound1;
thunderSounds[4] = thunderSound2;
thunderSounds[5] = thunderSound4;
thunderSounds[6] = thunderSound5;
thunderSounds[7] = thunderSound6;
};
function LightningData::applyDamage(%data, %lightningObj, %targetObject, %position, %normal)
{
%targetObject.damage(%lightningObj, %position, %data.directDamage, %data.directDamageType);
}
//////////////////////////////////////////////////////////////////////////////


[The following is the lightning emiter located within any mis file that I need it to be in, Straight forward here]
new Lightning(LightningNameForEditorReferenceGoesHere) {
position = "0 0 2000";
rotation = "1 0 0 0";
scale = "100 100 1000";
dataBlock = "ThunderStormA"; //this links to the lightningdatablock used.
strikesPerMinute = "3";
strikeWidth = "2.5";
chanceToHitTarget = "100";
strikeRadius = "50";
boltStartRadius = "20";
color = "1.000000 1.000000 1.000000 1.000000";
fadeColor = "0.100000 0.100000 1.000000 1.000000";
useFog = "1";
locked = "true";
};

#1
08/19/2005 (7:07 pm)
[The following are the lighting audioprofiles located within a cs file named atmosphereSounds.cs]
Take note of the first three at the moment, these all use an audio description called "SoundMedExplosion3d"...
4,5,6 use an audio description that IS 2d and everything is normal there and so on...

//-----------------------------------------------------------------------------
// Thunder Sounds
//-----------------------------------------------------------------------------

datablock AudioProfile(thunderSound1)
{
filename = "~/data/sound/fx/environment/thunder_0001.wav"; <-- is a mono sound.
description = "SoundMedExplosion3d";
preload = true;
};

datablock AudioProfile(thunderSound2)
{
filename = "~/data/sound/fx/environment/thunder_0002.wav"; <-- is a mono sound.
description = "SoundMedExplosion3d";
preload = true;
};

datablock AudioProfile(thunderSound3)
{
filename = "~/data/sound/fx/environment/thunder_0003.wav"; <-- is a mono sound.
description = "SoundMedExplosion3d";
preload = true;
};

datablock AudioProfile(thunderSound4)
{
filename = "~/data/sound/fx/environment/thunder_roll_stereo_0001.ogg"; <-- obviously stereo 2D, works fine.
description = "Sound2d";
preload = true;
};

datablock AudioProfile(thunderSound5)
{
filename = "~/data/sound/fx/environment/thunder_roll_stereo_0002.ogg";
description = "Sound2d";
preload = true;
};

datablock AudioProfile(thunderSound6)
{
filename = "~/data/sound/fx/environment/thunder_roll_stereo_0003.ogg";
description = "Sound2d";
preload = true;
};

datablock AudioProfile(LightningHitSound)
{
filename = "~/data/sound/fx/environment/struck_by_lighting_0001.wav";
description = SoundHugeExplosion3d;
preload = true;
};
//////////////////////////////////////////////////////////////////////////////


[The following is the audiodescription that the 3d lighting sounds being triggered in the lightning script are using]
This description works perfectly fine (3d) with audio emitters and explosion sounds for other things (which is used alot)

datablock AudioDescription(SoundMedExplosion3d)
{
volume = 1.0;
isLooping = false;

is3D = true;
ReferenceDistance = 20.0;
MaxDistance = 400.0;
coneInsideAngle = 360.0;
coneOutsideAngle = 0.0;
coneOutsideVolume = 0.0;
type = $SfxAudioType;
environmentLevel = 1.0;
};
//////////////////////////////////////////////////////////////////////////////


[And yes I do have a $SfxAudioType channel name, nothing to do with the issue but I thought I'd mention it]
$SfxAudioType = 2; //General SFX Audio Channel
#2
08/20/2005 (9:24 am)
Ye but the thundersound is a 2d sound default in SDK 1.3, its only the strikesound that is a 3d sound.
#3
08/20/2005 (9:31 am)
I have them defined right here as 3d sounds:

datablock AudioProfile(thunderSound1)
{
filename = "~/data/sound/fx/environment/thunder_0001.wav"; <-- is a mono sound.
description = "SoundMedExplosion3d";
preload = true;
};

----------

datablock AudioDescription(SoundMedExplosion3d)
{
volume = 1.0;
isLooping = false;

is3D = true;
ReferenceDistance = 20.0;
MaxDistance = 400.0;
coneInsideAngle = 360.0;
coneOutsideAngle = 0.0;
coneOutsideVolume = 0.0;
type = $SfxAudioType;
environmentLevel = 1.0;
};
#4
08/20/2005 (10:23 am)
Ye but in the source code the thunder dont use a transform , its only the lightningstrike that does.
So it doesnt matter what you set in the datablock.
Its like you play a sound with alxplay(soundprofile) ,instead of use alxPlay(soundprofile,transform).
So the thundersound only use the description like a 2d Sound.
#5
08/20/2005 (4:35 pm)
Thats what I feared... Why on earth they would change that from how it worked in t2 I dunno... (thundersounds were 3d)
I'll have my code monkeys look at it, thanks for the replies...
#6
08/20/2005 (6:12 pm)
Ye but prepan your stereofiles instead ,you get alot better effect then using a direction sound.
Use only the direction for the strike, thats how i do it and it sounds lovely .
#7
08/20/2005 (6:34 pm)
I 'could' do that but I prefer the thunder sounds to sync visualy where they are coming from. (even though I AM using 3 stereo rolling thundersounds, and when lighting strikes near you and you hear one of those it wont have much of an impact...Guess ill change that)

So heres what im going to do:
a) All thundersounds will be directional hard htting close up sounds. (instead of the extra 3 stereo files in it, read [c])
b) The lightning strike sound will stay directional as normal.
c) For the stereo rolling tunder sounds I will either use a few standard 2d emitters with gap long gap times, or I will script it into the lighting.cs so it will be fully "insert and go" for mappers.