Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'max hear distance' parameter for mob footstep sounds #4361

Open
MarkuBu opened this issue Jul 26, 2016 · 12 comments
Open

Add 'max hear distance' parameter for mob footstep sounds #4361

MarkuBu opened this issue Jul 26, 2016 · 12 comments
Labels
@ Client / Audiovisuals Feature request Issues that request the addition or enhancement of a feature @ Script API Sounds

Comments

@MarkuBu
Copy link
Contributor

MarkuBu commented Jul 26, 2016

I start a short test game with the current version of mobs redo and increased values for max_block_generate_distance and max_block_send_distance

The problem is, that I can hear footstep sounds from everywhere, even if there is no other cave near. I guess, I can hear them in about 60-70 nodes, maybe more. But I would say that 10 nodes would be enough, maybe 15 nodes maximum

You can hear them everywhere and become crazy

@paramat paramat added the Request / Suggestion The issue makes a suggestion for something that should be done but isn't a new feature. label Jul 27, 2016
@paramat
Copy link
Contributor

paramat commented Jul 27, 2016

16 would seem enough to me +1.

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Jul 27, 2016

How can this be changed? Maybe, I can make a PR if I know in which file.

@SmallJoker
Copy link
Member

SmallJoker commented Jul 27, 2016

Here it is: https://github.com/minetest/minetest/blob/master/src/content_cao.cpp#L1216
According to the file sound.h the function call would look like this:

m_gamedef->sound()->playSoundAt(spec, false, VOLUME_HERE, getPosition());

But this function is only available in the extended class called OpenALSoundManager so there might be some more work to do than just changing the function call.

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Jul 27, 2016

Ok then someone else must do this. I don't have enough experience with C++ and the Minetest code

But this should be really fixed because it is annoying and useless

@paramat
Copy link
Contributor

paramat commented Sep 8, 2017

See closed duplicate #6131

@Wuzzy2
Copy link
Contributor

Wuzzy2 commented Sep 8, 2017

Relevant quote:

If I am not mistaken, the sound also has 100% volume for the entire hear distance which is very bad.
A mob which is 31 nodes away is as loud as a mob which is only 1 node away. And a mob which is 33 nodes away is silent.

(correct me if I'm wrong)

@paramat
Copy link
Contributor

paramat commented Sep 9, 2017

Relevant code is here https://github.com/minetest/minetest/blob/master/src/content_cao.cpp#L865

			if(!m_is_local_player && m_prop.makes_footstep_sound)
			{
				INodeDefManager *ndef = m_client->ndef();
				v3s16 p = floatToInt(getPosition() + v3f(0,
						(m_prop.collisionbox.MinEdge.Y-0.5)*BS, 0), BS);
				MapNode n = m_env->getMap().getNodeNoEx(p);
				SimpleSoundSpec spec = ndef->get(n).sound_footstep;
				m_client->sound()->playSoundAt(spec, false, getPosition());
			}

That seems to play the sound at the objects position though?

I guess that calls https://github.com/minetest/minetest/blob/master/src/sound.h#L84

	int playSoundAt(const SimpleSoundSpec &spec, bool loop, const v3f &pos)
	{
		return playSoundAt(spec.name, loop, spec.gain, pos, spec.pitch);
	}

Which calls https://github.com/minetest/minetest/blob/master/src/sound_openal.cpp#L581
I've worked on sound code before and i don't know why the volume would not attenuate with distance.

@paramat
Copy link
Contributor

paramat commented Sep 9, 2017

Here's a guess: The sound is attenuating but the gain is set too high somehow, and the volume is therefore hitting a maximum limit and removing the fade effect with distance, how about we try adding a low gain in 'spec' to see if this is the case?
Currently 'spec.gain' is not set so gain may be at the default of 1, which may be too high, footsteps are given low gains in MTGame.

EDIT: Actually 'spec.gain' is set in 'sound_footstep' so the gain should be correct. But maybe it's worth multiplying spec.gain by 0.5 or something to check?

@paramat paramat self-assigned this Sep 15, 2017
@paramat
Copy link
Contributor

paramat commented Sep 19, 2017

screenshot_20170919_160005

Tested with a NPC from mobs redo trapped in a glass corridor, and marked a line 30 nodes away, 30 being the default max hear distance in openAL.
Footstep sounds do attenuate with distance and become inaudible at 30 nodes.
I have noticed that the mob footsteps can be louder than the player's own when the mob is close, maybe we can reduce mob footstep volume a little to compensate, i can try multiplying spec.gain by 0.8 or whatever.
I agree 30 nodes is a little too far, 16 seems good, if i can i will reduce the max range.

@paramat
Copy link
Contributor

paramat commented Sep 19, 2017

PR #6440
Needs testing on a multiplayer server.

@paramat
Copy link
Contributor

paramat commented Oct 2, 2017

#6440 merged which will help reduce hear distance.
Changing thread title to include #6131

@paramat paramat changed the title Footstep sound max hear range of mobs is too high Add 'max hear distance' parameter for mob footstep sounds Oct 2, 2017
@paramat paramat added Feature request Issues that request the addition or enhancement of a feature and removed Request / Suggestion The issue makes a suggestion for something that should be done but isn't a new feature. labels Oct 2, 2017
@paramat paramat removed their assignment May 15, 2018
@paramat
Copy link
Contributor

paramat commented Aug 20, 2018

The problem is, that I can hear footstep sounds from everywhere, even if there is no other cave near. I guess, I can hear them in about 60-70 nodes, maybe more.

My tests do not support this, if this happens it must be a bug.

At the least i think we can reduce the distance to 16 nodes or less, hearing footsteps from 30 nodes is ridiculous. This i support.
A setting i am not sure, footsteps are something that makes sense to have a fixed max hear distance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@ Client / Audiovisuals Feature request Issues that request the addition or enhancement of a feature @ Script API Sounds
Projects
None yet
Development

No branches or pull requests

5 participants