Product Chat / What is the status on the functionality of 3D Sound / soundbinau.lua?

Author
Message
Bob Humid [2021]
Game Guru Backer
3
Years of Service
User Offline
Joined: 11th Jan 2021
Location: Cologne
Posted: 7th Dec 2021 03:07 Edited at: 7th Dec 2021 03:10
Esteemed sound-aficionados!

It´s been days (of nights) that I am painfully loosing at the script-war. I seem to overlook something. Also I read here (and on GitHub) that 3D-positioned sound was "messed up" some time earlier this year in GG Classic, leading to the instruction to use '70' as the maximum level of volume instead of '100'. Now if you look at the different scripts that float around here in this forum there is absolutely NO coherence regarding the maximum volume. One script uses '110', another is at '100'. And ONLY on github you can read about using '70'.

What I need to be able to do:
a) - Attach a MONO WAV (16 Bit / 44.1 KHz) of several seconds (around 7-10s) length containing the erratic babbling of a broken android character (AI 3) in a loop. It should get louder when I approach the character and fade away when I go away etc. - In the ideal game engine world this is of course 3D-positional.

b) - Attach a MONO WAV (16 Bit / 44.1 KHz) of similar length on an animated decal-entity representing some electric bolts flickering and doing a dangerous electrical sound.

Both these objects stay around 1000 units close to a crashed spacecraft in my game-prototype.

My problem is that there is no consistency on how those scripts react and work. Some rare times they work both (super rarely, almost never). Most of the time the sound of the "babbling character" will start FULL VOLUME if I use the existing REALSOUND.LUA or SOUNDBINAU.LUA-scripts, then get almost unhearable when you are very close. Suddenly it works one one of both objects, then it doesnt.

At least I managed to play my game-music in the background at playerstart at the same time while running the game.

Questions:
1. Should I use 70 or 100 for Maximum Volume for the mentioned scripts? And is this really dB (I know the logarithmic character of decibels - there are very nicely layouted diagrams which illustrate dBs perfectly)

2. (Very silly question): Do I have to use differently names of variables for scripts used by DIFFERENT entities? For example: Do I have to use "PlayerDist1" and "PlayerDist2" in each of two scripts? Wouldn´t they conflict if I use "PlayerDist" in all soundbinau.lua-scripts?

3. Characters don't have sound-slots, they use "soundsets" and those are numbered 1,2,3,4 instead of 01,02,03,04 (How uttely confusing). WHERE the heck do I place the WAV-file for the MAIN AI-script to find it?

Seriously. I am really thankful for any help. How are you guys dealing with sound? I mean "looped" sounds for humming machines, fires, waterfalls, churches etc. are a complete necessity, but I don´t see you guys complaing here about it NOT WORKING. This confuses me a lot. Are you all waiting for GG Max to finish your prototypes of GG Classic? And then how did PROTASCOPE come to existence, it sounds nicely done.
Where is the official information about the sound-system, the decibels (volume) etc.? How did AmenMoses find out that there are three sound-systems in GG Classic?

Thanx in advance for any help. And then tons of it! /.-)

Robert
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Dec 2021 13:07
Well to answer your last question, I looked in global.lua and the source code.

There are actually more than 3 if you include sound sets, raw sounds and music as well as global and entity sounds.

All very confusing tbh.
Been there, done that, got all the T-Shirts!
PM
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 7th Dec 2021 18:26
@Bob Humid [2021] attach your script.
Maybe there is just a small problem and someone can fix it quickly for you.
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
Bob Humid [2021]
Game Guru Backer
3
Years of Service
User Offline
Joined: 11th Jan 2021
Location: Cologne
Posted: 8th Dec 2021 00:28
Quote: "@Bob Humid [2021] attach your script.
Maybe there is just a small problem and someone can fix it quickly for you."


But that is exactly my problem. I am using the official soundbinau.lua and realsound.lua. I did not change anything. Both still use 100 as absolute volume. In GitHub Amen Moses talks with someone from development and they mention that settings should be set to 70.

Still the scripts use 100. Nobody updated them. I have no idea if this is a bug, I get the feeling that noone has a problem with immersive / 3D sound.

I will paste my scripts here tommorow when i am near my studio-machine.

AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2021 10:22
The max volume is 100 but it depends on your sound sample as to what that actually sounds like!

The sound used to be in decibels I think as anything less than 60 couldn't be heard at all but then for some reason it got changed to a more linear system which resulted in sound volume of 0 still being audible, it then got changed again to what we have now, i.e. volume values go from 0 to 100 but what that maps to in real terms is anyones guess!

Best bet is to set the volume in the sound sample to be as loud as you want it and take that as your 100 value, then script it to reduce the volume to get the results you want.
Been there, done that, got all the T-Shirts!
PM
Bob Humid [2021]
Game Guru Backer
3
Years of Service
User Offline
Joined: 11th Jan 2021
Location: Cologne
Posted: 9th Dec 2021 15:58 Edited at: 9th Dec 2021 16:00
@AmenMoses:

I am a professional sound-designer, mixing- and mastering-engineer. I do know exactly how to level all things audio.

But thanx for the answers, I will then use 100 as the maximum.

What I don't understand is how you guys know what is up with sound? Where is it explained? There is no manual regarding this. I have come back to a more than one year old project that I really would like to see developed further and I am picking up you guys audio-scripts and those are all non-standarised / non-updated some reading 110 for maximum level etc. -

So, do you all design your games with completely erratic sound-levels? My problem is that I get DIFFERENT behaviours every time I test the level. It´s not reproducable...

I am still awya from my scripts, but none of them works properly. I researched for many hours in the complete forum, I revalidated the installation-files via Steam, I tried THREE different soundcards & ADDAs etc. - It´s still all more like a random-generator for audio-events in my projects (the old one and all test-projects I generate to get to the core of my problem) and I have NO IDEA how Synchromesh managed to develope PROTASCOPE. It´s a miracle for me!

Also, to be honest, I find the LUA-introduction regarding Game Guru quite confusing - so chances are I just don't understand scripting at all, while I was convinced that I did.
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 9th Dec 2021 17:59
music docs can be found here :


there is/are also broadcast videos links within GG app itself where Lee talks about the music system, probably outdated now (maybe)

As a musician, it's great to know there is someone on the forums who also understand mixing, sound levels etc.


Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++ VS2019, SQL, PL-SQL, JavaScript, HTML, Three.js, others
Hardware: ULTRA FAST Quad Core Gaming PC Tower WIFI & 16GB 1TB HDD & Win 10 (x64), Geforce GTX1060(3GB). Dell Mixed Reality VR headset, Aerodrums 3D
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 9th Dec 2021 18:01
Most people only use the PlaySound( e, slot ) function in scripts, a few may also make use of the global sounds for music or atmospherics.

In reality what we should all be doing is using the music system for music, global sound system for non-positional sound effects (i.e. background atmospherics or narrator stuff) and entity attached sound slots for positional sounds.

The sound sets are no longer used in the newer AI modules although I believe the system still works. The sound samples for it go in audiobank folder and are selected using the SetCharacterSoundSet(e), the folder they are in is set by the .fpe file for the entity, for example the classic german zombie has:
soundset = classics
soundset1 = audiobank\Classics\voice_sounds\male\roar.wav
in its .fpe file.
(I don't know why Lee stopped using that system btw.)

Anyhow, the scripts you refer to probably date back to when GG was DX9 based and the volume settings seemed to be logarithmic, possibly decibels. Under the covers the engine simply calls a DX function to play the sounds so the values will be whatever they mean to DX.

Sometime after the switch to DX11 I noticed that sound seemed to be different now and we had the so-called fixes I mentioned earlier, now I have no idea what the values mean but I do think that the standard volume fall off over distance doesn't seem to be severe enough and the 3D-ness of the sounds doesn't seem to be as good as it was back in the earlier builds.

The other problem that sound has in GG/MAX is that it doesn't take into account any objects between the player and the sound source, a zombie the other side of a wall sounds exactly the same as if the wall wasn't there, also the environment itself is not taken into account, i.e. with a rocky terrain all around you sounds are played the same as if you are surrounded by grass or indeed if you are indoors.

As to Lua commands we all learn the same way, by trial and error mostly. When all the source code was available in GitHub I used to go see what the commands actually did but I no longer have that ability.

Been there, done that, got all the T-Shirts!
PM
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 13th Dec 2021 08:40 Edited at: 13th Dec 2021 09:10
Quote: "But that is exactly my problem. I am using the official soundbinau.lua and realsound.lua. I did not change anything. Both still use 100 as absolute volume. In GitHub Amen Moses talks with someone from development and they mention that settings should be set to 70."

Just try this small script on one of your entities and play around with the settings and see if it works for you.
If it works on one of your entities then you can make a copy of this script and place more than one entity
down to test, and remember rename the script for each entity deferent and make sure you also change the
variables ( numbers ) other wise you will have two or more scripts with different names but all the variables
is the same that they use.


Edit:.
You can get away wit using the same script on two different entities and each place a deferent sound as long as you want them to control the sound at the same distance and volume. other wise you will have to rename and change the variables so each script controls each sound differently.
Current W.I.P
TheValley

Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
Bob Humid [2021]
Game Guru Backer
3
Years of Service
User Offline
Joined: 11th Jan 2021
Location: Cologne
Posted: 26th Dec 2021 16:56 Edited at: 26th Dec 2021 17:14
Thanx galore PCS & also the others for any answers. I am starting to understand now. I hope it's not an illusion... /.-)

@PCS:
I am still not near my studio and my GG-project, but I wanted to tell you that your "function fadesoud_init(e)" alone already looks much more like what we all need and want than what I have seen in the other scripts. A distand large machine like an an harvester on Arrakis can now have a WAY proportionally larger soundfield-radius than a burning barrel. Finally!

The thing with the need for giving "same-function-type variables" in entitiy-scripts different names btw. is NOT explained in the extensive LUA-workshop on Steam btw. - It should be added any time soon, since it's like a heavy game-stopper for people like me with scripting-capabilities only in Pascal or Turbo Basic XL (8-Bit fame - still it has Procedures already!).
I did not get the info about GLOBAL and LOCAL variables right before I did not read Messinas "An Introduction to Gameguru" a second round through! In his book LUA-scripting is also explained in a way that you just don't get it right in the first time. Having both textes available helps, but still: Unnecessarily confusing keeping in mind that LUA in effect IS a SIMPLE language.

I will report these days how it tourned out with your script.. /.-) Thanx again!

I hope SOUND-dependencies in Game Guru Max will be all graphically solved.



EDIT:
Slightly off-topic but related to my LUA-manual-rant: Anyone diving into LUA will instinctivly and automatically think that ALL LUA-code regarding an entity or a character should be done into one script which will then be the one attached in the "AI"-field of the entity. From what I read betwwen the lines here it is NOT done this way, to keep the scripts unique in functionality and to avoid messy code. To this day I still don´t know where you succesfull programmers put the rest of the code for AI, Quest-releated flags etc. in case the "AI"-field is already occupied with anything releated "soundxyz-lua"... Or I am constantly overseeing that part in the "manuals", or I start to mentally decay - I still hope for the best.
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 26th Dec 2021 17:39 Edited at: 26th Dec 2021 17:51
@Bob Humid [2021]
If the previous script do not work nicely try this one its just deferent with a small mod

Current W.I.P
TheValley

Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th Dec 2021 17:45
Quote: "ALL LUA-code regarding an entity or a character should be done into one script"


Can be done that way, but that tends to lead to a lot of replication of code.

Far better to use utility modules containing the heavy lifting and simply call it from the entities script as needed.
Been there, done that, got all the T-Shirts!
PM
Bob Humid [2021]
Game Guru Backer
3
Years of Service
User Offline
Joined: 11th Jan 2021
Location: Cologne
Posted: 27th Dec 2021 17:27
AmenMoses:
Quote: "Far better to use utility modules containing the heavy lifting and simply call it from the entities script as needed."


Mate, can you post me an example-script here as how this would read? Does not have to have the external "modules" - which I think are just the separate scripts like the infamous soundbinau.lua etc., right?
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 27th Dec 2021 18:54
utillib.lua is one of them.

To use a function in it you first have to add the following line to the top of your script:
local U = require "scriptbank\\utillib"

Then you can access any of it's functions, so for example to tell if the player is near an entity and looking towards it (useful for collectables) you could use:
if U.PlayerLookingNear( e, 120, 45 ) then

In this example if the player is with 120 units and the entity origin is with 45 degrees of the players eyeline then the function returns true.

For another example lets say you want to find the 10 dynamic entities closest to the player you could use:
local myList = U.ClosestEntities( 500, 10 )

In this example the list returned will contain the entity Ids of the nearest 10 entities within 500 units of the player.
The list will be in distance order so myList[1] will be the closest, myList[2] the next closest etc.
You can iterate this list like this:
for _, v in ipairs( myList ) do

Been there, done that, got all the T-Shirts!
PM
Bob Humid [2021]
Game Guru Backer
3
Years of Service
User Offline
Joined: 11th Jan 2021
Location: Cologne
Posted: 20th Jan 2022 21:16
Thanx again to everyone.

Well, I could fix my scripts that now I have working sound-emission on all objects / characters but one thing is still erratic and I think it is because something in the works of sound interacts quite different on characters than it does on simple entities.

I will post my scripts on the WE.

Login to post a reply

Server time is: 2024-04-20 01:17:09
Your offset time is: 2024-04-20 01:17:09