Need more versatile code for creature-sounds

Want to discuss changes to the UOX3 source code? Got a code-snippet you'd like to post? Anything related to coding/programming goes here!
Post Reply
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Need more versatile code for creature-sounds

Post by Xuri »

In creatures.dfn it's possible to assign both a "basesound" and a "soundflag" for creatures. These soundflags represents the following:
// soundflags 0: normal, 5 sounds (attack-started,idle, attack, defence, dying, see uox.h)
// 1: birds .. only one "bird-shape" and zillions of sounds ...
// 2: only 3 sounds -> (attack,defence,dying)
// 3: only 4 sounds -> (attack-started,attack,defnce,dying)
// 4: only 1 sound !!
(Note that this is handled in void cEffects::playMonsterSound in sound.cpp, not in uox.h as the outdated comment states :)
However, for many creatures, especially ones added in the various UO expansions, the sound-ids do not follow any of these setups.

The order of sound effects for the Samurai Empire creature "Kappa", for instance, is "dying, attack, idle, attack-started, defence" (5 sounds) - while that of an "asian dragon" is "attack, dying, idle, defence" (4 sounds), and an etheral warrior has "attack, attack-started, dying, idle, defence" (5 sounds). Neither of these use any of the predefined setups, and none of them are the same.

We could go on defining a lot of new soundflags, but seeing as there are also creatures with sound effects that are spread out all over the place, it's not really a good solution.

I'm not sure what would be the best way to do this though. Suggestions, anyone?
-= Ho Eyo He Hum =-
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Well, it seems to me that OSI decided to ignore its own standardized sound listing. For that reason, we can no longer depend on BASESOUND then just adding an offset.

My thoughts would be to, rather than BASESOUND and SOUNDFLAGS, have

SOUND_IDLE=
SOUND_STARTATTACK=
SOUND_ATTACK=
SOUND_DEFEND=
SOUND_DIE=

Notably some of these may be left empty, as not all creatures have every type of sound. But this way we can specify a specific index to each sound, allowing them to be located in any order and anywhere in the file.
Scott
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Sounds good to me :)
-= Ho Eyo He Hum =-
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

The all-important factor, before anything is done, is ensuring that there isn't need for MORE versatility than that.

For instance I noticed that birds have multiple sounds for one body (according to the comment). Are these idle sounds, or the entire realm of sounds (IE multiple SETS of sounds for the same body style bird)? Oddities like these may require a different approach (and some more thought).
Scott
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Xu, I have gone ahead and added the support for the tags we discussed earlier. If there is more need we can add as necesarry. However there is no sense in making use of these changes until you have updated the creatures.dfn to match (IE no more basesound/soundflag)
Scott
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

*nod* I've already expanded the creatures.dfn file to include every valid body-id for creatures (which shows up in both 2D & 3D clients), totalling 346 entries - so I'll do that next :P
-= Ho Eyo He Hum =-
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Awesome work.

Also, for those creatures that don't have all of the sounds, do we want it to just not play a sound?

For instance, say a monster does not have a STARTATTACK sound... should we play the ATTACK sound? For those without the IDLE sound, no sound at all?... etc


My thought was to let the code be as dumb as possible (generic) and let the scripts decide. For instance, if the scripter decides he wants a monster that doesn't have a default STARTATTACK sound to have one, he can assign it, be it that creatures ATTACK sound, or whatnot.
Scott
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

I second that thought - if it doesn't exist in the script, don't let UOX3 assume, play nothing :)
-= Ho Eyo He Hum =-
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

You should have an executable in your mailbox to test it out when you get the new sound tags done. :)
Scott
Post Reply