Engine sounds

Make suggestions for improving one of the best games on the net!
Post Reply
User avatar
The Purple Panzer
Field Marshal
Field Marshal
Posts: 244
Joined: Tue Sep 23, 2003 8:13 pm
Location: Stonington, CT
Contact:

Engine sounds

Post by The Purple Panzer » Wed Dec 22, 2004 9:39 pm

The original Battlezone had a low-frequency engine rumble, which
shifted in frequency a little based on your tank's speed; this might be
a nice addition to the game.

It could add some computation to the clients, especially if you can hear others' tanks, and echoes and such are done right. But it might add
a dimension of realism to the game.

trepan
Dev Wizard
Dev Wizard
Posts: 704
Joined: Fri Feb 21, 2003 7:50 pm

Post by trepan » Wed Dec 22, 2004 9:40 pm

patches welcome

User avatar
The Purple Panzer
Field Marshal
Field Marshal
Posts: 244
Joined: Tue Sep 23, 2003 8:13 pm
Location: Stonington, CT
Contact:

Patches

Post by The Purple Panzer » Wed Dec 22, 2004 9:45 pm

Who's "Patches", and where is he welcome? :D

I'll think about it; I'll have to see what's used for the sounds now. I know
how to do audio reasonably well on a few platforms, but not in a platform-independent way, so it might be worthwhile to do it.

trepan
Dev Wizard
Dev Wizard
Posts: 704
Joined: Fri Feb 21, 2003 7:50 pm

Post by trepan » Wed Dec 22, 2004 9:56 pm

Mix it into the buffers, send 'em out ...
The platform independence has already
been taken care of on all the platforms
for which bzflag supports sound.

The one oddity may be that the sound
system does not appear to be setup for
continuous sounds. That shouldn't be
too hard to adjust.

Decent starting point is src/bzflag/sound.h
(go figure...) The lower level sound drivers
are kept in src/platform.

User avatar
The Purple Panzer
Field Marshal
Field Marshal
Posts: 244
Joined: Tue Sep 23, 2003 8:13 pm
Location: Stonington, CT
Contact:

Can't find files

Post by The Purple Panzer » Thu Dec 23, 2004 1:57 pm

I couldn't find "sound.h" anywhere; I started with the "Browse CVS" link
on BZFlag.org, and got to (for example):
http://cvs.sourceforge.net/viewcvs.py/b ... rc/bzflag/
and there is no file there named sound, with any extension. I wandered
around a bit in the directory structure, but couldn't find it.

Another question you (trepan) might have a quick answer to - what
environment is needed to build the system? I'm on Windows, and have
VC++, but not the latest version (I hate giving MS money for such things, unless it's absolutely necessary). Is the .net version required?

trepan
Dev Wizard
Dev Wizard
Posts: 704
Joined: Fri Feb 21, 2003 7:50 pm

Post by trepan » Thu Dec 23, 2004 2:43 pm

1. Look at the bottom of the link you posted. The sound
files are at the bottom, the listing is also case sensitive.

2. I haven't touched a windows machine in months, so
I'm probably not the right guy to comment on the req'd
windows development environment.

Decided to touch-up your avatar for the holidays?

User avatar
Valoche
Private First Class
Private First Class
Posts: 69
Joined: Fri Dec 20, 2002 5:39 pm
Location: France/Grenoble

Post by Valoche » Thu Dec 23, 2004 7:49 pm

What about tanks with ST?
Consider hearing only own tank engine, or state wether ST tanks should make engine noise.

Valoche

User avatar
The Purple Panzer
Field Marshal
Field Marshal
Posts: 244
Joined: Tue Sep 23, 2003 8:13 pm
Location: Stonington, CT
Contact:

Post by The Purple Panzer » Fri Dec 24, 2004 3:21 am

trepan wrote: Decided to touch-up your avatar for the holidays?
Yeah, initially I figured that Erwin Rommel done in purple, sans regalia,
would be silly enough, but he looked a bit too serious. It's still not
quite right; I want something that indicates that I like to have fun
seriously, not that I'm a serious person trying to have fun.

User avatar
The Purple Panzer
Field Marshal
Field Marshal
Posts: 244
Joined: Tue Sep 23, 2003 8:13 pm
Location: Stonington, CT
Contact:

Post by The Purple Panzer » Fri Dec 24, 2004 3:41 am

Valoche wrote:What about tanks with ST?
Consider hearing only own tank engine, or state wether ST tanks should make engine noise.

Valoche
A good point, and after my first glance at the code it looks like there are two different types of sound: local sounds, and world sounds. World sounds seem to be limited in number, and are discrete events (like a shot being fired). There seems to be a lot more flexibility with local sounds, which are also mono. So as a first pass I'd be tempted to try to do this as a local sound, meaning you only hear yourself. That's not ideal, but it'd be a start, and if people didn't like it there's no point in doing the more general problem.

The other issue (to me at least) is that if this is indeed a world sound, some consideration of echo should be made. This is probably not as hard as it sounds - given attenuation, only nearby perpendicular walls (to the direction of propagation) need be considered, and when they are this is a time-shifted addition of a reduced signal - but it will sort of mess up the code modularity I'd think, and I'm not sure quite how the control structure will look (it might have to search for echo walls fairly frequently).

I also don't yet know how to determine own tank's speed in code; I'd shift the spectrum of the engine up in frequency proportional to this, and increase amplitude as well (somewhere I have some documented rules for how to do this for real tank acoustic signatures) - it's a simple method, not exact, but quite good. It'd mean that the tank engine noise could be in a buffer which is played in a loop, and when tank speed changes one could change the playback sampling rate and gain based on tank speed, and not change the buffer contents - should be fairly straightforward.

Still thinking about it all -

jumpman
Private
Private
Posts: 4
Joined: Tue Feb 01, 2005 11:28 pm

Sound is good and how about doppler shifting.

Post by jumpman » Thu Feb 03, 2005 1:29 pm

Like the idea myself own tank sound should be
attenuated though or can be stopped by stopping
your own tank so you can hear other tanks which
are moving around, how about doppler shifting
the sound for approaching - retreating tanks , would
sound very realistic , at 25meters per second
(max tank speed) thats a very significant (~7%) doppler shift,
and this is easier to implement than echo (which would be good to
of course ) as well.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5184
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Thu Feb 03, 2005 4:59 pm

umm the game does doper and delay allready. It's just that the speeds are so low you don't realy hear anything.

You could make it less realisitic by increasing the dopler factors for the mixer if you wish. But the code is allready there and active and working.
ImageJeffM

User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Post by RPG » Thu Feb 03, 2005 10:11 pm

But the tanks don't emit engine sounds.

Is doppler coded into BZFlag or is it just something that is there by default?

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5184
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Thu Feb 03, 2005 11:28 pm

no the tanks don't do engine sounds, you could add one prety easy, just add a new repeating sound that stays with each tank.

Doppler is in, has allways been in, and has never been removed. So if you add a new environmental sound, just like jump, or a shot , then it would work. This is one of the core reasons bzflag still does it's own sound mixing, and does not take advantage of newer hardware 3d sound. But it does have the advantage of working consistently on all OSs. The mixing is done in the core game, before it even gets to the platform specific sound code.

The sound code is kinda funky, so it may not make the most sense where you have to put stuff, but it's all there. You may want to look at what was changed for theif, since this would be very similar.
ImageJeffM

Post Reply