# Re: [Audyssey] Creating game levels to scale?

```Hi Philip,

Ouch! Basically, what you are telling me is instead of picking any
single method to handle sounds you have decided to implement all three
of the methods in order to insure a realistic environment. Sounds
reasonable, but it also sounds like a lot of work. As I sit here
typing this message I'm trying to think of how that would look like in
code. Perhaps something like this?```
```
// Get the player and object location
x1 = player.GetX();
y1 = player.GetY();
z1 = player.GetZ();
x2 = object.GetX();
y2 = object.GetY();
z2 = object.GetZ();

// Get the region and distance
region = player.GetRegion();
distance = GetDistance (x1, y1, z1, x2, y2, z2);
open = GetDoor (region);

// Play or update sounds
if ((distance <= 25 &&
open == true) ||
(region == object.GetRegion()))
{
// Start/update sounds
}

// Stop the sounds
if (distance >= 25 &&
open == false &&
region != object.GetRegion())
{
// Stop sounds
}

I'm not sure I got this right, but I think that is a rough idea how
you would go about checking distance, pathways, and region all in one
place without driving yourself crazy. If so it doesn't look too bad.
I'd be interested in seeing your method for handling this thorny
issue.

Cheers!

On 12/6/10, Philip Bennefall <phi...@blastbay.com> wrote:
> Hi Thomas,
>
> This exact problem struck me also when I started developing my current 2d
> game. The way I'm solving it is to have the distance calculations that stop
> sounds, but also to divide things into regions as you say. Then, I use
> pathfinding to see if there is an audible path between the player's current
> region and region x. If there is, play the sound based off of that source
> such as a doorway, or all over the stereo image if you find that there are
> plenty of open space between the two such as a large coridor leading into
> another. Pathfinding is obviously quite expensive so you will need to buffer
> and reuse rather than recalculate except when absolutely necessary, but I
> think you get the idea. I do not know whether you consider this to be too
> much of a time investment, but that's the approach that I'm going with in
> order to get both nice overlapping and efficient CPU usage.
>
> Kind regards,
>
> Philip Bennefall

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gam...@audyssey.org.
If you have any questions or concerns regarding the management of the list,