2015-05-27 19:49:07

Hi, I am having some problems with sound rotation in bgt, and I'm not sure if it's the classes I'm using, the way I've set volume, or something else, and was wondering if I could get any suggestions. Basically my problem is that when things are in front of me, they sound like they're behind, and when they're behind, they sound like they're in front. There's also some other strange behavior going on, but I'm not sure if I could explain it in a post. I've tried to make the sound angle a negative of the players actual angle, but that doesn't seem to fix the problem.
I'll post links to some classes below.
https://www.dropbox.com/s/3nu7hdj31c5et … g.bgt?dl=1
https://www.dropbox.com/s/fvi6a0g6i4sxh … l.bgt?dl=1
These I got from a package of includes, and did not make.
https://www.dropbox.com/s/ftt153iohif5c … r.bgt?dl=1
This is the playerclass that uses both of these. Atm it's using the negative angle thing.
I also have a dropbox folder with a compiled version, and one with the full code that I could share if someone thinks that would help.
Sorry this post seems a little vague. I've been doing research and playing with it for a couple weeks now, and haven't had any luck.
Any suggestions would be greatly appreciated!

Prier practice and preparation prevents piss poor performance!

2015-05-27 23:17:03

As for the problem with not being able to determine whether or not a sound is in front or behind a player, unforunately BGT does not support any type of audio effects that could make this realistic. For example, many games might use a muffling effect in order to simulate a sound playing behind a player. I say this before looking at the classes, but I"ll take a look at them.

Go to Heaven for the climate, Hell for the company. - Mark Twain

2015-05-28 07:00:56

You can't do it with bgt's built-in sound support. Someone posted a bgt binding for the FMOD library, which does support 3d surround sound. You can find it in the forums.

2015-05-28 10:30:05

Yes, AK74 and I did it, but it's still very buggy. The system implements a full 3d sound system and a geometry system (to have the sound modified because of walls and obstacles). It still needs a lot of work before being used as it is sad

2015-05-28 12:12:13

I am very confused as to why my rotation algorithm screws up at distances. sad
As for behind/not behind, it might be a coordinate system issue, or there might be a negative sign in the wrong spot somewhere. It's easy to fix once you find it, but the trick is figuring out if it's a coordinate system mismatch or if it's in the position_sound functions themselves. It might also be a clockwise/counterclockwise thing (trig functions assume that positive angles are counterclockwise, but that's in the coordinate system where positive y is up/forward).


A better way to do this might be transformation matrices. I can't for the life of me remember how those work for more than 5 seconds after reading it (I've tried more than once, this *after* the appropriate classes from high school), but there's a decent Wikipedia article on the subject.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-05-29 07:57:08

You could also consider using another programming language. If you're starting to need things like 3d sounds, there's a good chance that your project is approaching a stage where bgt won't suit its needs.

Using a more mainstream language gives you a lot more options because chances are that someone has already written tools for tasks like collision detection, linear algebra/geometry, etc.

2015-05-29 16:20:49

Yeah, I've actually been regretting choosing bgt for a while now, because I've had to rewrite a lot, and just write some pretty basic stuff from scratch. It also handles pointers in a silly way, and makes linked lists and things like it incredibly difficult to code, ecause you can't create a class from within itself. I'm learning a lot from this though, so although it is frustrating, I don't mind all that much, and I'm determined to finish at least a concept demo in bgt. I'm beginning to think that game programming might not e something I'm going to get into, but it's hard to say. I'm familiar with the general programming concepts, but some of the game spacific stuff seems a little strange. Back on topic though, I found a pretty detailed post from 2012 that explains how sound panning and such was done in games like this, so I might just write something from scratch. Which will be painful.

Prier practice and preparation prevents piss poor performance!

2015-05-30 08:30:21

Wow you can't create linked lists in BGT?

2015-05-30 09:18:09

You can.


class node {
int value;
node@ next=null;
node() {value=0;}
node(int v) {value=v;}
bool hasNext() {return @next!=null;}
node insertNext(int v) {
node n(v);
@next=n;
return n;
}

}

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-05-30 20:59:12

Yeah, i remember bgt handling references similar to how java does it, so it makes sense that you should be able to do linked lists.

2015-05-31 00:36:19 (edited by Genroa 2015-05-31 00:40:03)

BGT isn't usin the Java reference system, it is using the C++ references system (similar to AngelScript). Java always use references to handle objects, whereas BGT C++ and AngelScript give objects by copy when giving them as function parameters. Because of that, you have to use kind of pointers, or handles. There is a great difference! smile

Any object oriented language is able to build linked list, even non object ones (the C language can use linked lists). So, yes, it's just a matter of algorithm design. wink So Dranelement, as CAE_Jones said, you can build a linked list in about 20 lines of code, like in most other languages. If you think it is impossible, then it is a problem with you, not a BGT language problem smile

Dranelement wrote:

You can't create a class from within itself

I didn't understand what you said, or you totally misunderstood the object oriented concepts sad

2015-05-31 08:44:10

I interpreted it as being unable to create an instance of a class within that class.
You can do this, but it requires paying attention to handles. You can't do this:

class A {
A a1;
}

But you can do this:

class B {
B@ b2;
}

And you can do just about anything in methods that you can do in any other function.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-05-31 13:52:28

This is logical smile you can hava a reference in a class definition, but if you declare an object, you would have a infinite recursive loop. All other languages works like that

2015-06-02 22:18:33

Hi,I've been looking at the topic aprone posted a couple years ago that describes how to do this, and I'm confused at one point. When we're told that 90 degrees, or 0.5pi radians, is south, how does that work exactly? I understand that computersthink of positive y as down in most cases. At the moment though, I'm not doing that, and just assuming positive y is north, because cos(0.5pi) = 0, and sin(0.5pi) = 1. If I'm doing this, do I need to change aprones conde in any way? or can I just take the end value that tells you whether the sould would be in front or ehind, and the one that tells you if it's to the right or left, and reverse them. The link to the topic is:
http://forum.audiogames.net/viewtopic.php?id=7458
Sorry for all the questions, again, and any suggestions qould be greatly appreciated! big_smile

Prier practice and preparation prevents piss poor performance!

2015-06-03 08:07:59

I don't think this would change left/right at all. I'm not sure, but I don't think it would affect behind-ness, either. Really, I think all you'd need to do is swap labels/variable names for north and south.
But I'd have to try it both ways to be sure.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-06-03 08:59:31

When I say 0.5 radians or 90 degrees, the convention is usually to measure the angle in the clockwise direction, starting from the positive x axis, or east.

2015-06-03 09:14:02

Is it? Trig functions seem to assume counter-clockwise?

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.