Objects generate sound effects / Proximity-based sound detection

0 favourites
  • 4 posts
From the Asset Store
Detects any kind of ad blocker. Very easy implementation into already existing projects
  • I'm working on a spy game and, before I go working on my own custom "audio" system for this mechanic feature, I wanted to confirm if there is a way to make it so my characters or objects in the game can generate sound effects at their location... And from that make it so other characters or objects can "detect" the sound if they're close enough. Kind of like a line-of-sight deal but with audio.

    Related, this would also include later adding a feature where the player hears the audio in stereo panning (louder on the left speaker if the sound was generated to the left of the camera or character's position, etc).

    It seems like I saw Construct having a feature where you could place "speaker objects" in the layout to represent that that object or another object attached to the speaker would generate a sound effect when prompted but I cannot find it.

    UPDATE: So, I found about half the info I was looking for, thanks to the included audio template that comes with C3. I had forgotten about that.

    The remaining issue is a VIABLE way to get enemies or objects to "hear" sounds. Given the built-in feature that allows sounds to be played back at lower dB depending on proximity and distance, what is a good rule-of-thumb measurement in pixels to determine when an object can reasonably "hear" a sound? I realize this is all subjective. But I would appreciate any input to help me sort this out.

    Does anyone have any suggestions or know what I'm trying to work out?

    Thank you so much for your help.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Have you seen Audio Positioning template?

  • Actually, yes, I had just looked that up late last night. LOL

  • I think I would actually stick clear of the audio system for deciding if they can "hear" you. A really simple version would to spawn an invisible sprite over the character, scaled by the "volume" of the action. If the sprite overlaps an enemy then the enemy hears you. If you don't want to use a sprite then you can do a simple "volume" vs distance check against each enemy. volume / (distance * distance ) > threshold

    This doesn't give you fancy stuff like directional audio or object occlusion. You could use line of sight in combination with a range limit for that ( the range being volume / (distance * distance ) ). Sound behaves very similar to light, which is what LOS is simulating. It's also possible to simulate audio reflection with LOS, but requires more work and soaks up more CPU time.

    This doesn't mean you can't use audio positioning for your game, but I think it should be for audio output only.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)