Jump to content
The Dark Mod Forums

Using sound_loss on visportals


Springheel

Recommended Posts

Sorry for the thread necromancy, but I was reminded of this issue by some discussion over at TTLG. Filed a bug report for it. Would be nice to have the added flexibility so sound to the player would finally flow more realistically.

 

Probably not for 1.08, since it would require testing, but hopefully the next release.

 

http://bugs.angua.at/view.php?id=3042

Link to comment
Share on other sites

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

When the sourcecode came down, this is one of the early things I thought about too. It's easy to control the volume to the player, maybe direction too. It's computing what's happening to the volume as it travels in the air that sounds tricky... To me anyway. I hope smart people look into it and I'll be very happy to see work on it. Sound has always been one of my favorite systems.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Yeah. The sound to the player is something I see mentioned by people often, and this issue would be the cause of it. I think it might give people the impression that it's also broken for the AI because they assume both systems are identical...based on how sound works in the real world. It has bothered me for a long time too, but I knew we couldn't do anything about it...until now. :)

Link to comment
Share on other sites

I think the sound travels pretty well if the map is v-portalled good.

 

Not testing for internal leaks is a big problem, but there are still some things the code just can't do which would be nice (like the situation in the OP).

Link to comment
Share on other sites

Is this only a matter that the sound loss is not applied when the sound to the player travels through a portal - or does the sound reaching the player not even use the portaling system?

 

I mean, sound is not as loud when a door closes, right? So in theory it would be just nec. to add one more spawnarg and internal variable to each portal, so the sound loss for both open and closes can be customized instead of being always 100% and X% (where X is when closed)?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Sound definitely cuts out to a large degree when a door closes. And I haven't heard ai through walls or anything in recent missions I've played which seemed to be well built (ie: I assume they were portaled nicely).

 

(with the exception of one door/portal up high on a balcony in one of Melan's maps which wasn't closing when I checked. It was also mentioned by someone in that thread, so that was clearly just a portal alignment issue)

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

That seems to be the case - a cursory look into the code shows that a portal does not have a unique sound loss property - so all portals behave the same and the only difference can come from wether they are open or close (and theoretical how big their surface area ist, but I don't think the code even takes this into account).

 

Adding a "sound_loss_closed" and maybe even a "sound_loss_open" variable to each portal seems to be in order, as well as adjusting the formula so that they surface area is taken into account (either reducing the volume, or even shifting the sound).

 

While I could maybe add the variables, I have no idea about sound processing, so taking the values into account to modify the sound when it travels through the portal is not something I can do.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

That seems to be the case - a cursory look into the code shows that a portal does not have a unique sound loss property - so all portals behave the same and the only difference can come from wether they are open or close (and theoretical how big their surface area ist, but I don't think the code even takes this into account).

 

Adding a "sound_loss_closed" and maybe even a "sound_loss_open" variable to each portal seems to be in order, as well as adjusting the formula so that they surface area is taken into account (either reducing the volume, or even shifting the sound).

 

While I could maybe add the variables, I have no idea about sound processing, so taking the values into account to modify the sound when it travels through the portal is not something I can do.

 

Yeah, I think that pretty much covers everything although I don't know if we need an open vs closed portal setting. Right now there is no sound loss to the player unless the portal is closed, we just need that same sound loss to be applied to open portals. Whether the vis-portal is opened or closed should make a difference to the sound prop, since sound is pretty much a constant throughout a level. Closing a door or a window, on the other hand, will add a cumulative loss to what the portal is already doing...properly lowering the volume. Taking size into account would also help the accuracy of the propagation immensely.

Link to comment
Share on other sites

Portals also close when player turns his head and that doesn't change volume.

 

I think this is where it gets confusing since we had to combine vis-portals with audio portals.

 

Lets pretend that vis-portals are separate and that we have dedicated audio portals.

 

Audio portals allow the passage of sound at all times, unless blocked by a physical object (door, window) or are outside some

maximum range that we figure no AI would be able to hear from. So with that in mind, audio portals are always open...unless we close a door or window.

 

The other variable that we don't yet take into consideration for propagation to the player is portal size. If our system could automatically apply an approximate sound loss based on portal size, that would help greatly. Then when a door is closed an additional decibel level would be removed from that portal.

Link to comment
Share on other sites

Hm, if the portal closes when they player turns his head, then that shouldn't change the sound, only a door should do it. But I am not entirely sure I understand how the engine knows the difference between a portal closed due to a door, and closed due to "not in the players view". Hm.

 

Edit: The code to parse spawnargs and apply them is in void idLocationSeparatorEntity::Spawn() in game/Misc.cpp - although the portals cannot yet store additional info.

 

However, I am not sure if we shouldn't tie this into the SndProp code we already have. If it can propagate susp. sounds from the player (or whatever) to the AI, shouldn't it also be use to calculate the sound to the player? Otherwise, we'd still have two sep. systems that are basically doing the same?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Hm, if the portal closes when they player turns his head, then that shouldn't change the sound, only a door should do it. But I am not entirely sure I understand how the engine knows the difference between a portal closed due to a door, and closed due to "not in the players view". Hm.

 

A door has an additional sound loss setting attached to it, so when the portal closes the additional loss from the door is activated and then subtracted from the portal.

Link to comment
Share on other sites

A door has an additional sound loss setting attached to it, so when the portal closes the additional loss from the door is activated and then subtracted from the portal.

 

Yes, but the code does apply this sound loss only to the "sound propagation system". The sound the player hears doesn't seem to be affected by this, or is it? How does that work, has somebody some documentation about this?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Yes, but the code does apply this sound loss only to the "sound propagation system". The sound the player hears doesn't seem to be affected by this, or is it? How does that work, has somebody some documentation about this?

 

No, if you close the door then the player hears less sound. The closed vis-portal signals the system to use the sound_loss setting from the door to reduce the amount of sound going through the portal. That part works perfectly....but it's also the main issue. Sound loss to the player can only be made to work when a portal is closed by a door or forced shut. The problem is that all portals, open or closed, should influence sound at all times based on their size...not whether they are open or closed. A vis-portal in a 3 x 3 foot hole should reduce sound quite a bit, whereas a vis-portal the size of an entire wall would have little to no effect.

Link to comment
Share on other sites

No, if you close the door then the player hears less sound. The closed vis-portal signals the system to use the sound_loss setting from the door to reduce the amount of sound going through the portal. That part works perfectly.

 

So, let me summarize this:

 

* the portal has a certain amount of sound loss to the player, regardless on whether the vis portal is open or closed (it is say 0 DB of sound loss)

* when a door closes, it tells the portal to add a certain sound loss (say X DB)

 

So when a player turns his head, the sound loss is not affacted (because the sound loss does only change if you close/open a door).

 

And looking into the code, the sound propagation code is what applies this loss. And there portals already have a loss. (And if I get it right, the same propagation code is used for sound to AI and sound to player?)

 

What I see in game/SndPropLoader.cpp

 

]
savefile->WriteFloat(m_PortData[i].loss);

 

which means there is only one loss value (presumable the loss applied when the door is closed).

 

I guess this would all need a lot of code reading to understand how it works and where to add some code to make it better (and what exactly we need to do to make it better).

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

But why should open or closed portals without a door diminish sound?

 

Say I have a long straight street with 4 portals (used to gradually close the street off). I see a guard straight down the portals, say 80 feet away.

And say sound travels 80 feet straight.

 

If sound drops off through portals then the sound on one side of a portal would be louder than 1 foot away on the other side. So going through the portals it might only travel 50-60 feet. But if I only use one portal in that same street the sound would travel maybe 70-80 feet.

 

Portals seal the world so sound doesn't travel straight 80 feet correct? It travels 80 feet through portals. So if it winds around 3 portaled corners it still falls short of the 80 feet as a bird flies. (where it would go straight through buildings if no portals were present).

 

-----

I guess I'm confused, it seems to work perfectly to me. And I can't see why open airspace (open portal or even closed because player can't see around a corner) would diminish sound. It would also make the system unpredictable because it would depend on how many/few portals a given author used.

 

I do know that we need a system to block sound through portals if required, ie: transparent glass, becuase the glass itself should block noise. A guard right on the other side shouldn't hear you well, but since the portal has to close to block the sound he hears you right next to him (not behind a brick wall and pane of glass).

And I thought that sound loss prop was somewhat included in the systems set-up (I was trying to use it in a mansion quite awhile back).

 

------

Further more I thought the main issue with sound through portals was that sound goes through the middle of the portal. So in city sections with very large portals sound would actually travel from a guard, up into the air through the middle of the huge portal, then back down towards the player, thus already diminishing the distance it will travel.

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

But why should open or closed portals without a door diminish sound?

 

Thy shouldn't, but we wondered if the code might have a bug and do this accidentily.

 

Further more I thought the main issue with sound through portals was that sound goes through the middle of the portal. So in city sections with very large portals sound would actually travel from a guard, up into the air through the middle of the huge portal, then back down towards the player, thus already diminishing the distance it will travel.

 

That is another "bug" or "feature". :)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Further more I thought the main issue with sound through portals was that sound goes through the middle of the portal.

 

I thought so too but Ishtvan said that it doesn't.

 

But why should open or closed portals without a door diminish sound?

 

As in the OP, I had a room with a small opening in the floor. The volume of the guards walking around downstairs sounded far too loud because it was going straight from the floor below me to the portal and through the small gap. The result was that a guard on the floor below me sounded like they were about ten feet away on the same floor.

 

In reality, not much sound would get through a small opening like that, and a guard on the floor below should sound much further away.

 

In most cases, visportals should not cause any sound loss, but the option should be available for cases like windows or small openings.

Link to comment
Share on other sites

IIRC when you turn on "show-soundprop" or whatever the cvar is in the console (I'm 100% sure it's something different), it will render a green line of sound propogation from the source to the player, along with the volume. This is where I thought I recalled how sound travels through portals, since you can see the green line change directions at the portals.

 

I don't want to use my memory to say it went exactly through the middle without looking at it again though. I'm just saying that's a good way to get a visual image of what we're talking about... And that's how you test all these things like the role of doors, and head-turning, and big portals, and multiple-portals, and portals with sound-loss spawnargs on, etc. Assuming of course that that green line accurately represents what's going on (I'd think it would, otherwise what's the point.) Might not even hurt for someone to set up these situations and take a screenshot of them so it's very easy to unambiguously communicate everything going on to everybody just with the screenshots.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

But why should open or closed portals without a door diminish sound?

 

No no...we're not talking about ALL portals diminishing sound...only up to a certain size. The portals in your example would not be affected. Forget about vis-portals and think in terms of audio portals, the audio portal portion of a vis-portal is open at all times whether the vis portion is closed or not, only a door or some other object can block an audio portal. So, considering an audio portal is neither opened nor closed unless a door or window is placed in them, if a small portal were placed in the middle of a brick wall, the size should play some part in how much sound passes through.

 

post-3-0-93015200-1330735645.jpg

 

In the above graphic, the small portal in the wall should decrease sound but the larger portal should not. Especially if there were 5 floors in a building and the holes in the floor were perfectly aligned. The sound coming up through those holes should be diminished due to their size.

 

Say I have a long straight street with 4 portals (used to gradually close the street off). I see a guard straight down the portals, say 80 feet away.

And say sound travels 80 feet straight.

 

The portals in your scenario would have no additional loss.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 7 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...