|
|
|
|
|
by henriquecm8
844 days ago
|
|
I am starting to learn gamedev, in specific I would like to make a stealth game. Ever since I first read about steam audio, I've wondered if it would be possible to use the sound propagation to determine if a npc has heard a sound. There are probably better ways to do this. And not always the most realistic approach is the best approach. But I've always found that some games are very inconsistent about how npcs hear you. Sometimes you are in a closed room and make very little sound, and they hear you from outside, other times you are in an open place and they don't hear anything. It seems like some games only check the distance to sound origin, without taking occlusion/attenuation into consideration. |
|
One total hack I would imagine would work alright is to render the scene twice, once displayed to the player and the other where the only light sources are the player's sound and walls/windows/etc just have some opacity changed. If the light around the enemy is above a threshold the player is detected. You wouldn't need to render the whole scene, just the area immediately around the player, and avoid doing it if there are no enemies.
Another hack that would be more involved would be to compute a kind of graph for the whole level and when a player makes noise, you propagate it through the graph using precomputed weights. You'd have to handcraft a graph for every level. But I could imagine this getting the best results in terms of performance and gameplay, since you could tune it per scene.