Dungeonz Versions Save

Everything for the game Rogueworld.

7.2

3 years ago

New

Sound manager

Going forward for improving audio coverage, I have added a sound manager file to the game to contain most of the audio related logic. (Not to be confused with Phaser's own internal sound manager, this provides a sort of game specific abstraction layer over the top of the Phaser one).

https://github.com/Arcanorum/dungeonz/blob/master/client/src/SoundManager.js

Basically each kind of sound and set of specific functionality around those sounds is contained within a scope. Currently these are:

Music

Longer audio pieces, that typically only play one at a time and should repeat.

Player

General things that only play for this specific user when they do something. Moving, interacting with something (i.e. opening a door), GUI feedback chirps, alerts.

Items

Organises the different kinds of sounds that can be played when a user does something with specific item types.

Sound types/taxonomy

Previously there was no way to differentiate kinds of items. For an action, the same sound would be played for every item. i.e. a metal clang sound would play even when equipping a staff or bow.

It is now possible to play a specific sound for a specific item, based on what what I have called it's sound type. This is defined in along with the rest of the item config in the main item configs list, or in the specific item file if it has one. For example: https://github.com/Arcanorum/dungeonz/blob/master/server/src/items/ItemValues.yml#L35 image

A sound type is basically an extra data property that any item can have, that defines what sound should be played for it for a given action.

For example: Iron, dungium and noctis armour can all use a sound type called "Metal clothing", which would just be the same sound to play for only those items. Similarly, mage robe, cloak, and ninja garb can all use a sound type called "Fabric clothing", which would be another different sound to play. These sound types can be applied to as many or as few (i.e. only one item) as you want.

Then this sound type, i.e. "Metal clothing" is added to each of the kinds of actions that it is relevant to. Such as being equipped.

Each kind of action can have a generic default sound, that is played for any item that doesn't have a specific sound type to use. The current actions for items are drop, equip, unequip, and use, where a specific sound to play for each item sound type for that action can be added. Such as: See the sound mananger file.

dropped: {
    default: state.sound.add("item-dropped")
    // TODO: Add sound type specific sounds here.
},
equipped: {
    default: state.sound.add("weapon-equipped"),
    // Add what ever kinds of sounds you want a particular item to play when equipped.
    // Should also be defined in the server item config in ItemValues.yml.
    "Metal weapon": state.sound.add("metal-weapon-equipped"),
    "Wood weapon": state.sound.add("wood-weapon-equipped"),
    "Metal clothing": state.sound.add("metal-clothing-equipped"),
    "Fabric clothing": state.sound.add("fabric-clothing-equipped"),
},
unequipped: {
    // TODO: Add default, and maybe some specific sound type ones.
},
used: {
    // Add what ever kinds of sounds you want a particular item to play when used.
    // Should also be defined in the server item config in ItemValues.yml.
    // "Food": // TODO: Add food consumed sound here
    // "Drink": // TODO: Add drink consumed sound here
}

The sound types added are up to the sound designer to decide for whatever they are working on, and shouldn't really need authorisation from me, so go nuts I guess.

Audio file type standardisation

Safari doesn't support Ogg files, so MP3 is now provided as a fallback. All audio files in the audio assets folder now need to be in both Ogg and MP3 format. https://github.com/Arcanorum/dungeonz/tree/master/client/assets/audio Any existing sounds that didn't have either MP3 or Ogg have had them generated and added.

Many already have an additional WAV version of the sound. It would be ideal for all sounds to have a WAV (or other high quality/lossess format) kept with the others, that will be the original source for the Ogg and MP3 ones to be generated from. image

The WAV files should not be loaded in the game directly.

Event responses

Additional data is now sent back to the relevant item related websocket events that contains the item type number, so the specific sound to play can be identified. See uses of data.itemTypeNumber throughout the inventory events: https://github.com/Arcanorum/dungeonz/blob/master/client/src/websocket_events/Inventory.js

I would like to move this kind of logic entirely to the client in the future to avoid the hastle of data being passed back and forth, but this works for now. Might look into it for #30 .