Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CSound* CNEOBotSeekAndDestroy::SearchGunfireSounds(CNEOBot* me, const Vector* cu
break;
}

if (!(pSound->SoundType() & SOUND_COMBAT))
if (!(pSound->SoundType() & (SOUND_COMBAT | SOUND_PLAYER)))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking for feedback on whether it makes sense to use the SOUND_PLAYER flag in this way, or if it's cleaner to treat footsteps as a SOUND_COMBAT

{
continue;
}
Expand Down
5 changes: 5 additions & 0 deletions src/game/server/neo/neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,9 @@ void CNEO_Player::PlayCloakSound(bool removeLocalPlayer)
// effect lasts 0.5 seconds, but allow 200-300ms leeway with GetFogObscuredRatio cache window
m_botThermOpticCamoDisruptedTimer.Start(0.2f);
}

// For bots to notice cloak sound
CSoundEnt::InsertSound(SOUND_COMBAT, GetAbsOrigin(), SOUNDENT_VOLUME_CLOAK, 0.5, this);
}

void CNEO_Player::SetCloakState(bool state)
Expand Down Expand Up @@ -3060,6 +3063,8 @@ void CNEO_Player::PlayStepSound( Vector &vecOrigin,
surfacedata_t *psurface, float fvol, bool force )
{
BaseClass::PlayStepSound(vecOrigin, psurface, fvol, force);
// For bots to hear footsteps
CSoundEnt::InsertSound(SOUND_PLAYER | SOUND_COMBAT, GetAbsOrigin(), SOUNDENT_VOLUME_FOOTSTEP, 0.1, this);
}

bool CNEO_Player::IsCarryingGhost(void) const
Expand Down
34 changes: 34 additions & 0 deletions src/game/server/soundent.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,40 @@ enum
#define SOUNDENT_VOLUME_PISTOL 1500.0
#define SOUNDENT_VOLUME_EMPTY 500.0 // volume of the "CLICK" when you have no bullets

#ifdef NEO
// Used for calibrating bot detection distances for CSoundEnt::InsertSound()

// Murata shotgun sound uses SNDLVL_150dB with volume 1.0 [weapon_murata.single in game_sounds_weapons.txt]
// Human player recipient list hearing distance calculation:
// maxAudible = (2 * SOUND_NORMAL_CLIP_DIST) / attenuation [recipientfilter.cpp]
// SOUND_NORMAL_CLIP_DIST = 10000.0f [public/const.h]
// attenuation = SNDLVL_TO_ATTN(150) = 20.0f / (150 - 50) = 0.2 [public/soundflags.h]
// maxAudible = (2 * 10000.0) / 0.2 = 100000 units
// Volume multiplier: 100000 * 1.0 = 100000 units
// SOUNDENT_VOLUME_SHOTGUN = 1500.0
// ratio = 100000 / 1500 = 66.666...u

// Cloak sound uses SNDLVL_75dB with volume 0.7 [NeoPlayer.ThermOpticOn/Off in game_sounds_player.txt]
// Human player recipient list hearing distance calculation:
// maxAudible = (2 * SOUND_NORMAL_CLIP_DIST) / attenuation [recipientfilter.cpp]
// SOUND_NORMAL_CLIP_DIST = 10000.0f [public/const.h]
// attenuation = SNDLVL_TO_ATTN(75) = 20.0f / (75 - 50) = 0.8 [public/soundflags.h]
// maxAudible = (2 * 10000.0) / 0.8 = 25000 units
// Volume multiplier: 25000 * 0.7 = 17500 units
// SOUNDENT_VOLUME_CLOAK = 17500 / 66.666... = 262.5 units
#define SOUNDENT_VOLUME_CLOAK 262 // round down in context of int volume param

// Footstep sounds use SNDLVL_75dB with volume 1.0 [Lowest of StepLeft/StepRight in game_sounds_physics.txt]
// Human player recipient list hearing distance calculation:
// maxAudible = (2 * SOUND_NORMAL_CLIP_DIST) / attenuation [recipientfilter.cpp]
// SOUND_NORMAL_CLIP_DIST = 10000.0f [public/const.h]
// attenuation = SNDLVL_TO_ATTN(75) = 20.0f / (75 - 50) = 0.8 [public/soundflags.h]
// maxAudible = (2 * 10000.0) / 0.8 = 25000 units
// Volume multiplier: 25000 * 1.0 = 25000 units
// SOUNDENT_VOLUME_FOOTSTEP = 25000 / 66.666... = 375.0 units
#define SOUNDENT_VOLUME_FOOTSTEP 375 // round down in context of int volume param
#endif

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what to input for CSoundEnt::InsertSound as the volume parameter, so I estimated a rough scale based on the existing shotgun volume used elsewhere.


enum
{
SOUND_PRIORITY_VERY_LOW = -2,
Expand Down