Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Volume increase as approach 3D object

Author
Message
xcode77
5
Years of Service
User Offline
Joined: 31st Jul 2018
Location:
Posted: 5th Jun 2020 08:58
Hi all,
So, I'm back to shenanigans exploiting GetObjectZ( ) to trigger most of my in game events.
I was wondering how easy it is to increase volume the nearer I get to a 3D object.
I know we can set the volume of PlaySound( ) anywhere to 100 for max volume, so I was thinking moving from 0 (start point with no audible sound) to 1000 (where target object is playing at 100% volume) on a 3D plane.
I know how to test for a range using GetObjectZ( ) (thanks Scraggle!), and I"m guessing I need a for loop (or lots of if then else etc).
Any ideas on the best way to approach this?

Thanks in advance
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 5th Jun 2020 09:23
In your example it would be something like this:
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 5th Jun 2020 20:44
I ramp volumes up and down in my game based on monster location. Definitely adds something to the mix. Exactly the same principle applies to 3D. I just decide on min and max distances and ramp linearly based on distance. I also adjust the balance (l&r speakee) so monsters sound where they are.... but that might be tougher in 3D.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Jun 2020 22:32
xcode77
5
Years of Service
User Offline
Joined: 31st Jul 2018
Location:
Posted: 6th Jun 2020 22:42 Edited at: 6th Jun 2020 22:43
Thanks for the replies, I still haven't got it working well yet, WIP, will play around a bit more before asking more.

I don't think I need 3D positional audio, but nice idea David.
As my bus approaches the rail crossing I just wanted to ramp up the 'ding-ding-ding' railway/railroad crossing warning bell.

Thanks blink0k, I don't even know what a Doppler effect is! so I'll look at all that later, too complicated for me yet.
(and yes, google will be my friend later when I look it up!)
Mambazo
18
Years of Service
User Offline
Joined: 11th Dec 2005
Location:
Posted: 7th Jun 2020 17:11 Edited at: 7th Jun 2020 17:11
Have you looked at this?

https://forum.thegamecreators.com/thread/226303
If at first you don't succeed, sky-diving isn't for you.

Login to post a reply

Server time is: 2024-04-18 18:39:57
Your offset time is: 2024-04-18 18:39:57