[CF-Devel] sounds system

Michael Toennies michael.toennies at nord-com.net
Wed Jul 18 09:29:14 CDT 2001


I seperated this from other threads.

First, the SDL client has the whole sound interface now as the dx client
has.

SDL works here like a x channel sytem. You assign channel 0 for
music/bachground.
The other channels are used from mixer then. But normally, the client don't
notice
about this.

i saw this kind of sounds.

ambient sound
effect sound
static sound source
dynamic sound source

In this system all sounds fit. The problem with sounds is, that for example
a stepping sound
of a moving orc is fine - but when you now attach this sound as static sound
source to the orc -
you ever think about what happens when you face 50 orcs (what will often
happens)? Then the server
send 50 times the orc step noice which is of course very very bad. Well,
here is the system.


Ambient sounds

Ambient sounds are the background sounds. it *can* be music too, but i think
more about noices like
dropping water, bird noices, wind noices, etc.
In CF we can insert here a static system which depends on the map makers
idea about it.
The sounds will played randomly in a loop - after one noice has ended, the
other starts.
It is good to make here a 2 or 3 layer system (= channels) so some sounds
can overlap - this
will give a nice "sound ambient".
In some games, the have very nice ambient sounds - if you ever can, try ot
the game "Giants",
the have some big ambient sound files in the sound folders.
We must here assume that we don't have access to this ass kicking sounds -
so we make it somewhat
easier.

In other programs, the server analyze the map tiles and the structures - and
generate from this a
ambient sound table. This is often chained to sound sources, so this both
systems can overlap here.


Effect sounds

Effect sounds are fired and forget - like a spell noice. The client get
sound name and pan/volume data
and mix it in. Its all of this spell sounds or hit noices, etc.


Static sound sources

This sound sources works like torches in a dungeon. Instead of "lit" the
dungeon with light, they flood
it with sounds. This is used for several sounds and the sound itself is not
static. A waterfall for
example will become a rushing water sound as sound source ... when the
player comes in, the noice
starting and getting louder when they come nearer the waterfall. So, a sound
source needs pan/volume information too.

The problem is, that this noices will played from client sound system in a
loop.
Because the server has no knowledge about the status of played sounds of the
clients, the server
can't give here cmds, except from "start playing sound source xxx" and "stop
playing...".

So, best is, give the client, when the player entered a new map, a list of
set sound source - even in
big maps that will not be many. Than the client can count the sound
sources - but for this, we also
need the player map position. The client then loops the sounds. If the
player is "out of reach" of
a sound source, the client stops playing of it.


Dynamic sound sources

Well, this is more tricky. Assume this: You stand before a door. Behind the
doors are 10 dragons.
Well, moving dragons should make some noices. So, we include "dragon
sounds", like heavy steps and
deep breathing.

The problem is to determinate, the pan/volume of the sound, also, we don't
want play 10 of them.
This is maybe realistic but it will mess up your sound system. we don't talk
here about real or not -
we talk about to fake it in a way, the player accept as real.

The solution is, that every dragons has a attached dynamic sound source. But
the server stores only one
of it. When server goes through the map, he use only the nerarest dynamic
sound source, relative to the
player. So, the player hears always only ONE moving sound from the nearest
dragon. Same for 50 orcs.

This is not real trivial and when you look at it, you will see that many
games has here some problems.

And what is which looping? Here comes the trick: All sound are about 1.50
seconds long - and the server
only update the dynamic sounds all 2 seconds. This is the easiest methode,
all other start to be very
complex.


    
    


More information about the crossfire mailing list