Author Topic: Sound of player's hull being hit missing  (Read 8375 times)

0 Members and 1 Guest are viewing this topic.

Sound of player's hull being hit missing
Hi guys,

Trying to get help with what I thought was a problem of my computer/installation I stumbled upon something that might actually be an issue of the game itself. I noticed this behavior years ago when I first played FSopen but I didn't care much, until recently when it annoyed me enough to start looking for a solution. So here's the thing:

When your ship's hull gets hit by enemy lasers (because your shields are down) you should hear a sound. In original retail FS1 it sounded like this: https://tinyurl.com/ncdndbq.
In FSopen and all mods I've played so far (FSport, STR, BP AoA) when your hull gets hit you can't hear a thing. You hear only the shields.

After a few guys gave me some directions on IRC a did a little 'research" to find this:

In retail FS2 you get a sound for both shields and hull but they both sound exactly the same.
So I checked all the .vp's and it looks like this:

Retail FreeSpace 1 - freespace.vp
s_hit_2.wav - sound for shields
l_hit.wav - sound for hull

FreeSpace Open - sparky_fs2.vp
s_hit_2.wav - sound for shields - different from FS1 but seems correct
l_hit.wav - exactly the same as s_hit_2.wav

FreeSpace Port - fsport3_5.vp
s_hit_2.wav - sound for shields - same as retail FS1
l_hit.wav - file is missing

This would explain why I can't hear any sound for hull in FSport and STR but it doesn't explain why I can't hear it in FSopen main campaign.
And here is where I have 2 theories, both of which might be true at the same time actually:

1. Volition made a mistake while putting the wav's together - assigning 2 filenames to 1 actual sound while loosing the sound that sould be named l_hit.wav

2. FSopen doesn't trigger a sound when the hull is hit at all, meaning the l_hit.wav, even though present, is actually unused.


Now I don't know much about coding but I have a feeling that this can be quite easily checked in the code.

Hope I've put this together comprehensively enough. And ofcourse, it might be that I'm totally wrong and the whole thing works differently than I imagine :)

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Sound of player's hull being hit missing
I actually looked into this last night, and the answer is "neither of those things"; the source is trying to play the sound, and l_hit.wav being missing from FSPort doesn't matter as it can still see the l_hit.wav from FS2. In fact, there are two hull-hit sounds: l_hit.wav and m_hit.wav (for laser hull hits against the player and missile hull hits against the player, respectively).

However, these two sounds happen to be two sounds that the sounds.tbl comments describe as 3D sounds but actually are defined as 2D sounds (but with extraneous min/max distance information defined, which only matters for 3D sounds). The source tries to play them as 3D sounds, which should be doomed to failure: as long as the hit position isn't the exact location of the camera, the distance between where the sound is trying to play and where the player is listening from should always be >0, which means that it will never work with a 2D sound.

Here's the bizarre part: the relevant code has not, as far as I can tell, been changed since the original Volition source code release. This should never have worked. If it's working with the retail executable, that means something very screwball is going on here.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Re: Sound of player's hull being hit missing
Well, quite frankly, it is possible that I'm wrong about the sound playing in retail FS2. I tried playing the exact same mission with exact same difficulty and doing exactly the same things in both retail executable and FSopen with no mods. And there was a difference. In retail I always heard the sound more times before getting killed and I heard it even after the respective shield quadrant was down. So basically I kept hearing it until I got killed. In FSopen it got quiet after the respective shield quadrant was down.

But there could be at least 100 reasons for this.  Maybe the AIs in retail are shooting differently in some way? They could be, for example, hitting the remaining quadrants. Or maybe the FSopen engine plays the sounds differently - it waits for the sound to end before it can be played again?
I don't know but what I mean is - there is no way I can be 100% sure that what I heard was actually the l_hit.wav playing and not the s_hit_2.wav. So yes, maybe the retail doesn't work correctly too and I just had a feeling that it does.

But one question remains: You think Volition intentionally used one identical sound under two filenames, where each is used for a different action?
« Last Edit: November 23, 2015, 08:53:25 pm by Maverick_BB110CB »

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Sound of player's hull being hit missing
Or maybe the FSopen plays the sounds differently - it waits for the sound to end before it can be played again?
Well, it has a bit of code whereby two impact sounds can't play within 50 milliseconds of each other... but, again, that code hasn't changed since the Volition source.

If you want to be 100% sure that what you hear is actually the l_hit.wav sound, all you have to do is provide a different l_hit.wav file. Or a different s_hit_2.wav file, I guess.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Re: Sound of player's hull being hit missing
Uuuhm, how exactly could I do that? I had to implement my "advanced hacking skills" just to be able to look into the .vp's :D

Sorry for stupid questions. It's just that I don't know much about modding or coding really.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: Sound of player's hull being hit missing
It's simple, really. There should be a "data" folder in your FS2 folder. It has the same folder structure as the VPs (if some of the folders are not present, you can create them). Anything you put in there, with the same filename and location as a retail asset, will be loaded instead of that asset. Using mod folders is recommended for serious modding, but for testing purposes, sticking a replacement sound in the main FS2 data folder should work.

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Sound of player's hull being hit missing
Using mod folders won't work with the retail executable, which is the thing that needs testing.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Re: Sound of player's hull being hit missing
So I learned how to replace the files using VPmage (and demaged my installation in the process :D ). Actually it wasn't so complicated after all.
I replaced both l_hit.wav and s_hit_2.wav with two very distinct sounds so that I can easily tell what's playing. Aaand...

I'm sorry, I was wrong. The retail FS2 does not play the l_hit.wav when the hull is hit. It's quiet, same as FSopen.
s_hit_2.wav is played correctly but that wasn't the issue.

So, is there any way to fix this?
« Last Edit: November 24, 2015, 03:53:47 pm by Maverick_BB110CB »

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Re: Sound of player's hull being hit missing
And implement m_hit.wav while we're at it.
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Sound of player's hull being hit missing
It might be as simple as fixing the sounds.tbl entries; now that I know retail didn't handle it differently, I don't have to look for other causes.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Re: Sound of player's hull being hit missing
And implement m_hit.wav while we're at it.

Actually, you're right. That one seems to be not working correctly as well.

 
Re: Sound of player's hull being hit missing
So I educated myself further and managed to come up with something to fix this.

First I tried deleting the parameters of 3D sound for l_hit.wav and m_hit.wav in sounds.tbl but that didn't work. So I opened sounds.tbl from retail Freespace 1 and just copied the parameters from there. Works like a charm :)

So a made a small "lhitfix01-snd.tbm" file which looks like this and put it in <freespace 2 root dir>\data\tables:

Code: [Select]
#Game Sounds Start

$Name: +nocreate 36
    +Filename: l_hit.wav
    +Preload: no
    +Volume: 1.00
    +3D Sound:
        +Attenuation start: 30
        +Attenuation end: 100

$Name: +nocreate 37
    +Filename: m_hit.wav
    +Preload: no
    +Volume: 1.00
    +3D Sound:
        +Attenuation start: 30
        +Attenuation end: 100

#Game Sounds End

Works also with all mods I could quickly try.

Aditionally, I replaced the l_hit.wav in sparky_fs2.vp with the one from retail Freespace 1. Now everything is as it should be (for me at least).

I guess this is not exactly a standard way or the most efficient, but it works for me :)

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: Sound of player's hull being hit missing
Wait, is the sound table modular now? I've been wishing for it back when I was actively modding FS2... :)

 
Re: Sound of player's hull being hit missing
Wait, is the sound table modular now? I've been wishing for it back when I was actively modding FS2... :)

According to wiki it is. I wasn't sure about the syntax though but after few hours of searching I found these two topics:

http://www.hard-light.net/forums/index.php?topic=81311.0

http://www.hard-light.net/forums/index.php?topic=89343.0

 
Re: Sound of player's hull being hit missing
Wait, is the sound table modular now? I've been wishing for it back when I was actively modding FS2... :)
It's been for a while now :)

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Sound of player's hull being hit missing
So I educated myself further and managed to come up with something to fix this.

First I tried deleting the parameters of 3D sound for l_hit.wav and m_hit.wav in sounds.tbl but that didn't work. So I opened sounds.tbl from retail Freespace 1 and just copied the parameters from there. Works like a charm :)

So a made a small "lhitfix01-snd.tbm" file which looks like this and put it in <freespace 2 root dir>\data\tables:

Are you saying that the reason l_hit and m_hit didn't work is that they had the wrong parameters in sounds.tbl?

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Sound of player's hull being hit missing
They've had the wrong parameters from the beginning. They're the two sounds we have a special exemption in the code for; because otherwise they'd generate "Unexpected extra value" warnings (because they're 2D sounds that specify 3D sound min/max distance, which retail parsing just ignored).
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Sound of player's hull being hit missing
Ah, I see exactly what you mean.  Okay, new PR opened: https://github.com/scp-fs2open/fs2open.github.com/pull/474

 
Re: Sound of player's hull being hit missing
Are you saying that the reason l_hit and m_hit didn't work is that they had the wrong parameters in sounds.tbl?

So it seems. Because changing them fixed the problem :)
Maybe there are also some issues in the code but that's way beyond my understanding.

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Sound of player's hull being hit missing
Yep, all that's necessary is to change the column that has 0 for 2D sound to 1 for 3D sound.  That PR has code changes to do this automatically for those two retail sounds.