How to add a sound that an enemy AI can hear?

Posted by Chris on Game Development See other posts from Game Development or by Chris
Published on 2012-04-01T09:44:07Z Indexed on 2012/04/01 11:42 UTC
Read the original article Hit count: 281

Given:

  • a 2D top down game
  • Tiles are stored just in a 2D array
  • Every tile has a property - dampen (so bricks might be -50db, air might be -1)

From this I want to add it so a sound is generated at point x1, y1 and it "ripples out". The image below kind of outlines it better. Obviously the end goal is that the AI enemy can "hear" the sound - but if a wall is blocking it, the sound doesn't travel as far.

enter image description here

Red is the wall, which has a dampen of 50db.

I think in the 3rd game tick I am confusing my maths.

What would be the best way of implementing this?

© Game Development or respective owner

Related posts about ai

Related posts about game-mechanics