Page 1 of 1

Bug: Monsters can be heard too far away

Posted: Sun May 06, 2012 7:53 pm
by Gambit37
I think the sound deadening effect of distance and walls is not pronounced enough in DSB. I can hear skeletons walking around in rooms that are 15 tiles away or more, this doesn't seem right. There's also virtually no volume drop-off as I walk even further away. This seems like a new bug as I don't remember it being like this before?

I think DM only made sounds for monsters up to 8 tiles at the most, and this would seem to be a reasonable distance for a dense dungeon.

Re: Bug: Monsters can be heard too far away

Posted: Sun May 06, 2012 8:32 pm
by Sophia
Hmm. There is a parameter when initializing FMOD that seems like it'd control this.
I'll try lowering the amount. Would you be up for a bit of testing?

I'll make the value tweakable, and what we come up with can be the new default. But, this way, if someone really hates the new setting, they can go back to the old way for their own dungeon. :D

Re: Bug: Monsters can be heard too far away

Posted: Sun May 06, 2012 8:35 pm
by Gambit37
Sure, happy to test it out :-)

Re: Bug: Monsters can be heard too far away

Posted: Wed May 09, 2012 11:54 pm
by Lunever
Any chance to consider walls?

Re: Bug: Monsters can be heard too far away

Posted: Sun Jul 15, 2012 1:01 pm
by Gambit37
There's a new soundfade parameter in DSB 0.53 and I've been testing it out.
I haven't yet found a good value for it. The default is 60, which has too little effect.
So I've tried changing it to 100, then 150, and it still doesn't seem right -- I can still hear water trickling from my fountain 9 tiles away and something buzzing in a room 12 tiles away. I think this is too far, though maybe others would disagree.
What is the range of this parameter and can you give any advice on the figures I should be looking at?

Re: Bug: Monsters can be heard too far away

Posted: Sun Jul 15, 2012 6:08 pm
by Sophia
Gambit37 wrote:What is the range of this parameter and can you give any advice on the figures I should be looking at?
No, not really. The number can go into the thousands if you want it to, but I doubt if that's really necessary. :mrgreen:

Re: Bug: Monsters can be heard too far away

Posted: Mon Mar 11, 2013 1:00 am
by Gambit37
It's been a while, but after lots of playing around with the soundfade parameter, I have some recommendations:

* Default value should be around 450
* DSB should automatically mute any sound when the party is > 10 tiles away from the source (ambient sfx, monster footsteps, spells exploding, etc.)

The muting is important, because even with very high soundfade values (700 or more) I can hear creatures on the other side of the map, well over 30 tiles away (albeit very quietly).

Being able to hear creatures so far away is messing with both realism and gameplay. You want the player to be able to hear creatures from a short distance away to build anticipation, interest or fear -- but hearing all creatures on the map at any distance is disconcerting and confusing and can set-up incorrect player expectations.

Of course, there may be exceptions: the dungeon designer may want to make some very distant ambient sounds audible to the player. In this case, perhaps an exvar could be set in the map sound item, such as "distance_mute = false" or something like that.

Re: Bug: Monsters can be heard too far away

Posted: Thu Apr 25, 2013 2:29 pm
by Gambit37
Hi Sophia, did you have any thoughts on the above?

Re: Bug: Monsters can be heard too far away

Posted: Fri Apr 26, 2013 2:17 am
by Sophia
I actually haven't done anything with the sound stuff.

Tweaking the value of soundfade is certainly something that I can do easily. Adding a hard mute is a little more difficult, and, to be honest, I'm not sure if I'd want to do that. While you make a good point, I can also see it coming back and biting me if a loud monster abruptly turns silent and the game seems unrealistic because of that.

Re: Bug: Monsters can be heard too far away

Posted: Fri Apr 26, 2013 10:10 am
by Lord_BoNes
Sophia wrote:While you make a good point, I can also see it coming back and biting me if a loud monster abruptly turns silent and the game seems unrealistic because of that.
Although that is true, shouldn't the "loud monster" get quieter as it moves farther away (up until the point of being muted).
Couldn't you do something like: sound 2 squares away = full volume, sound 4 squares away = 90% volume, sound 6 squares away = 80% volume, sound 8 squares away = 70% volume... sound 20 squares away = 10% volume. Using a percentage, the original volume isn't as much of a factor because 10% of loud isn't gonna be anywhere near as loud.

On the other hand, isn't there a way to tell how loud a sound is, and use that to adjust the fading speeds of sounds... so loud noises stay loud longer, with quieter sounds fading faster (this is sorta how things work in reality, because of echoes and such... the louder the noise, the louder the echo... resulting in the sound bouncing more and travelling farther).

I'm not sure if DSB already does something like this... but, is it possible to use a sort of minor path-finding algorithm to shrink the volume due to walls and other obstructions (the initial volume of the sound is determined by the shortest path from the sound source to the party, or vice versa). It only has to be a quick a dirty A* pathfinder, nothing too complex.

Re: Bug: Monsters can be heard too far away

Posted: Fri Apr 26, 2013 1:45 pm
by terkio
I am playing [DSB] SNES PORT v1.51.
Indeed, the sound rendering doesn' t feel right.

I wonder wether DM could have 3D sound.
it would be great to feel the location of monster steps ( right/left + front/rear ).
http://en.wikipedia.org/wiki/3D_audio_effect

Re: Bug: Monsters can be heard too far away

Posted: Fri Apr 26, 2013 2:01 pm
by Gambit37
Sophia wrote:if a loud monster abruptly turns silent and the game seems unrealistic because of that.
I'd argue it's already unrealistic if you can hear a monster on the other side of 32x32 map... ;-)
If you make a test level with some random corridors in it, shove a skeleton in one corner and the party in the diagonally opposite corner, can you hear that skeleton? Maybe it's my system, so it would be good to know if you witness the same problem.
terkio wrote:I wonder wether DM could have 3D sound.
It already does! Sound on DM Amiga was proper 3D sound, and DSB uses FMOD which also enableds 3D sound. If you're not getting that experience, there's something a bit wrong....!

Re: Bug: Monsters can be heard too far away

Posted: Fri Apr 26, 2013 4:00 pm
by zoom
If I recall correctly, there is an awareness stat of monsters,no?
Some value that determines, whether the monsters do notice
the party. I also think there are two of these?
(sth along the lines of see , tremorsense/feel and hear champions)

to the point :
use that awareness concept and tie that to the sound
the monster produces. Since every monster
got different awareness values, this should be levelled to an
appropriate value. No new mechanism needed.
If the monster approaches the party, because it notices them,
and takes action this should also start to get heard by the player.
maybe adjust to some monsters are better at hearing than party
or oppositely do not hear as wellbut make a lot of noise.
to complicate it even more consider muting monster sounds by
equipped helmets or - due to noise- by nearby fountains.

aim is one sound variable that is linked to monster's action
because monsters already start to take action at some point.

Re: Bug: Monsters can be heard too far away

Posted: Mon Sep 03, 2018 10:31 am
by Gambit37
I've been looking at this again, 5 years later (!) and I still think this is wrong. With the new default soundfade parameter of 120, I can hear monsters all over the map from any position.

I built a 32x32 map with player start in the top left and a giggler trapped in a small room at the opposite corner. I can hear it moving around, 320 feet away. I don't think that's realistic.

This is definitely weird and I do think it should be changed. Monster sounds and other ambience need a hard mute when a greater distance away than a "realistic" cutoff. Would this be possible as an update Sophia?

Re: Bug: Monsters can be heard too far away

Posted: Tue Sep 04, 2018 11:19 pm
by Sophia
To be honest, I built the same test map you did and while I could hear the giggler, it was just barely, and I honestly didn't see a problem. Maybe I'm just losing my hearing in my old age... :shock:

Anyway, I can't say I'm excited about delving into all this again. A bigger issue is the version of FMOD used by DSB is so old that I can't even find documentation for the API any more.

The source code is out there, so maybe someone can do something with this. It's probably not going to be me, though. Sorry.

Re: Bug: Monsters can be heard too far away

Posted: Tue Sep 04, 2018 11:55 pm
by Gambit37
OK, fair enough. As a compromise, could you set the default value of Soundfade to around 400 in the INI file?This seems a better default to me, though maybe it's highly dependent on a user's individual hardware/volume... Kind of a weird issue overall and I don't blame you for not wanting to dig around in it again! 😁

Re: Bug: Monsters can be heard too far away

Posted: Wed Nov 07, 2018 1:35 pm
by Gambit37
After a bit more testing of the DM dungeon I feel that this sound problem is game-breaking. It really gives away a lot of stuff and spoils the surprise of many encounters.

It turns out that the monster sound movement code is very simple, so I could tweak it easily to check if the party is close enough to hear the monster. (I'll use the same approach within other functions that play environmental sounds, such as doors or explosions.)

Feels much more like DM now :-)

Code: Select all

mhv_hearing_distance = 9

function mhf_can_party_hear(id)
	local i_lev, ix, iy = dsb_get_coords(id)
	local p_lev, px, py = dsb_party_coords()
	local distance = math.floor(math.sqrt(math.pow(math.abs(px-ix),2) + math.pow(math.abs(py-iy), 2)))
	if (i_lev == p_lev) then
		if (distance < mhv_hearing_distance) then return true else return false end
	end
end
Original function with extra check for party distance:

Code: Select all

function monster_step(self, id, group_leader)
	if (group_leader) then
	    if (self.step_sound) then
	        local lev = dsb_get_coords(id)
			local p_lev = dsb_party_coords()
			if (lev == p_lev) then
				-- check for party position, only play sound if within allowed range
				if (mhf_can_party_hear(id)) then
					play_arch_local_sound(self, id, "step_sound")
				end
			end
		end
	end
end

Re: Bug: Monsters can be heard too far away

Posted: Wed Nov 07, 2018 10:23 pm
by Sophia
I completely disagree about the magnitude of this problem but this is honestly the strength of DSB. If you don't like how I've done something, you don't have to endlessly argue or just accept that's how it's going to be; almost everything is exposed to Lua so you can modify things however you'd like. :mrgreen:

Re: Bug: Monsters can be heard too far away

Posted: Thu Nov 08, 2018 10:39 am
by Gambit37
Yep, I figured there should be an easy way to override it, thank you. :)

If I want to override parts of more complex functions, what's the best practice for that?

For short simple functions, I know I can create my own wrapper that then calls the original function, or simply duplicate and modify the original function.

But for longer functions with a lot of complexity, I don't want to duplicate or wrap the entire thing, because I only really need to affect a few lines. (Eg, door_tick(id, data) is quite long, but I only need to add the distance check around the sound handling part).

So, two questions:

1) What's the best way to modify a complex function, without duplicating it (and also possibly getting out-of-date with new changes to DSB base code)???

2) I've found that most sound calls end up calling the same function: local_sound. Would there be any downsides to adding my distance check in that small function?

Re: Bug: Monsters can be heard too far away

Posted: Fri Nov 09, 2018 12:42 am
by Sophia
Unfortunately, there is no good way to modify a complex function. The best you can do is to look for a smaller function to modify, or probably talk to me and I'll try to put in a hook or event or something to help you.

I think writing your own local_sound is probably the best idea, as long as it's not too low level for you.

One small optimization you can make is that for this sort of comparison is that using functions like pow and sqrt aren't actually necessary. You can just see if ((px-ix)*(px-ix) + (py-iy)*(py-iy)) is less than 81.

Re: Bug: Monsters can be heard too far away

Posted: Fri Nov 09, 2018 6:42 pm
by Gambit37
Sophia wrote: Fri Nov 09, 2018 12:42 amI think writing your own local_sound is probably the best idea, as long as it's not too low level for you.
Cool, thanks, yep I think I'm OK with doing that. I'm slowly getting to grips with the codebase and actually quite enjoying it now that I understand it better. I'd forgotten most of what I learned about DSB years ago, but after re-reading a lot of these old threads, it's coming back to me. Nice too to see how far DSB has come. It's an amazing engine, really flexible and fun to use :)
Sophia wrote: Fri Nov 09, 2018 12:42 amOne small optimization [...] see if ((px-ix)*(px-ix) + (py-iy)*(py-iy)) is less than 81.
Ha, yeah that's pretty obvious now you point it out! I just literally applied Pythagoras basic theroem and didn't consider reducing it down.