Add combat sfx #647

This commit is contained in:
scott-c 2020-07-04 13:14:55 +08:00
parent 3a1b4fa516
commit d316463eb3
33 changed files with 437 additions and 30 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New level of detail feature, letting you see all the world's terrain at any view distance. - New level of detail feature, letting you see all the world's terrain at any view distance.
- Point and directional lights now cast realistic shadows, using shadow mapping. - Point and directional lights now cast realistic shadows, using shadow mapping.
- Added leaf and chimney particles - Added leaf and chimney particles
- Some more combat sound effects
### Changed ### Changed

View File

@ -1,5 +1,8 @@
( (
{ {
//
// Character States
//
Run: ( Run: (
files: [ files: [
"voxygen.audio.sfx.footsteps.stepgrass_1", "voxygen.audio.sfx.footsteps.stepgrass_1",
@ -11,18 +14,74 @@
], ],
threshold: 0.25, threshold: 0.25,
), ),
ExperienceGained: (
files: [
// "voxygen.audio.sfx.character.experience_gained_1",
// "voxygen.audio.sfx.character.experience_gained_2",
// "voxygen.audio.sfx.character.experience_gained_3",
],
threshold: 0.5,
),
LevelUp:(
files: [
"voxygen.audio.sfx.character.level_up_sound_-_shorter_wind_up",
],
threshold: 0.5,
),
Jump: (
files: [
// Event not implemented?
],
threshold: 0.25,
),
Fall: (
files: [
// Event not implemented?
],
threshold: 0.25,
),
Roll: (
files: [
"voxygen.audio.sfx.character.dive_roll_1",
"voxygen.audio.sfx.character.dive_roll_2",
],
threshold: 0.25,
),
Climb: (
files: [
// TODO: sync with animation
//"voxygen.audio.sfx.footsteps.stepgrass_1",
//"voxygen.audio.sfx.footsteps.stepgrass_2",
//"voxygen.audio.sfx.footsteps.stepgrass_3",
//"voxygen.audio.sfx.footsteps.stepgrass_4",
//"voxygen.audio.sfx.footsteps.stepgrass_5",
//"voxygen.audio.sfx.footsteps.stepgrass_6",
],
threshold: 0.25,
),
GliderOpen: ( GliderOpen: (
files: [ files: [
"voxygen.audio.sfx.glider_open", "voxygen.audio.sfx.glider_open",
], ],
threshold: 0.5, threshold: 0.5,
), ),
Glide: (
files: [
// Event Missing or not implemented?
],
threshold: 0.5,
),
GliderClose: ( GliderClose: (
files: [ files: [
// Event Missing or not implemented?
"voxygen.audio.sfx.glider_close", "voxygen.audio.sfx.glider_close",
], ],
threshold: 0.5, threshold: 0.5,
), ),
//
// Sword
//
Wield(Sword): ( Wield(Sword): (
files: [ files: [
"voxygen.audio.sfx.weapon.sword_out", "voxygen.audio.sfx.weapon.sword_out",
@ -35,11 +94,29 @@
], ],
threshold: 0.5, threshold: 0.5,
), ),
Inventory(Collected): ( Attack(TripleStrike(First), Sword): (
files: [ files: [
"voxygen.audio.sfx.inventory.add_item", "voxygen.audio.sfx.abilities.swing_sword",
], ],
threshold: 0.3, threshold: 0.7,
),
Attack(TripleStrike(Second), Sword): (
files: [
"voxygen.audio.sfx.abilities.separated_second_swing",
],
threshold: 0.7,
),
Attack(TripleStrike(Third), Sword): (
files: [
"voxygen.audio.sfx.abilities.separated_third_swing",
],
threshold: 0.7,
),
Attack(DashMelee, Sword): (
files: [
"voxygen.audio.sfx.abilities.sword_dash",
],
threshold: 0.8,
), ),
Inventory(CollectedTool(Sword)): ( Inventory(CollectedTool(Sword)): (
files: [ files: [
@ -47,12 +124,220 @@
], ],
threshold: 0.3, threshold: 0.3,
), ),
//
// Hammer
//
Wield(Hammer): (
files: [
"voxygen.audio.sfx.weapon.sword_out",
],
threshold: 0.5,
),
Unwield(Hammer): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
],
threshold: 0.5,
),
Attack(BasicMelee, Hammer): (
files: [
"voxygen.audio.sfx.abilities.swing",
],
threshold: 0.7,
),
Attack(LeapMelee, Hammer): (
files: [
//
],
threshold: 0.8,
),
Inventory(CollectedTool(Hammer)): (
files: [
"voxygen.audio.sfx.inventory.pickup_sword",
],
threshold: 0.3,
),
//
// Axe
//
Wield(Axe): (
files: [
"voxygen.audio.sfx.weapon.sword_out",
],
threshold: 0.5,
),
Unwield(Axe): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
],
threshold: 0.5,
),
Attack(TripleStrike(First), Axe): (
files: [
"voxygen.audio.sfx.abilities.swing",
],
threshold: 0.7,
),
Attack(TripleStrike(Second), Axe): (
files: [
"voxygen.audio.sfx.abilities.swing",
],
threshold: 0.7,
),
Attack(TripleStrike(Third), Axe): (
files: [
"voxygen.audio.sfx.abilities.swing",
],
threshold: 0.7,
),
Attack(SpinMelee, Axe): (
files: [
"voxygen.audio.sfx.abilities.swing",
],
threshold: 0.8,
),
Inventory(CollectedTool(Axe)): (
files: [
"voxygen.audio.sfx.inventory.pickup_sword",
],
threshold: 0.3,
),
//
// Fire Rod / Regeneration Staff
//
Wield(Staff): (
files: [
"voxygen.audio.sfx.weapon.staff_out",
],
threshold: 0.5,
),
Unwield(Staff): (
files: [
"voxygen.audio.sfx.weapon.staff_in",
],
threshold: 0.5,
),
Attack(BasicMelee, Staff): (
files: [
"voxygen.audio.sfx.abilities.swing",
],
threshold: 0.8,
),
Attack(BasicRanged, Staff): (
files: [
// "voxygen.audio.sfx.abilities.staff_channeling",
],
threshold: 0.8,
),
Inventory(CollectedTool(Staff)): ( Inventory(CollectedTool(Staff)): (
files: [ files: [
"voxygen.audio.sfx.inventory.pickup_staff", "voxygen.audio.sfx.inventory.pickup_staff",
], ],
threshold: 0.3, threshold: 0.3,
), ),
//
// Bow
//
Wield(Bow): (
files: [
"voxygen.audio.sfx.weapon.sword_out",
],
threshold: 0.5,
),
Unwield(Bow): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
],
threshold: 0.5,
),
Attack(BasicRanged, Bow): (
files: [
// channeling sound.
],
threshold: 0.8,
),
Inventory(CollectedTool(Bow)): (
files: [
"voxygen.audio.sfx.inventory.add_item",
],
threshold: 0.3,
),
//
// Dagger
//
Wield(Dagger): (
files: [
"voxygen.audio.sfx.weapon.dagger_out",
],
threshold: 0.5,
),
Unwield(Dagger): (
files: [
"voxygen.audio.sfx.weapon.dagger_in",
],
threshold: 0.5,
),
Attack(BasicMelee, Dagger): (
files: [
"voxygen.audio.sfx.abilities.swing_sword",
],
threshold: 0.8,
),
Attack(DashMelee, Dagger): (
files: [
"voxygen.audio.sfx.abilities.sword_dash",
],
threshold: 0.8,
),
Inventory(CollectedTool(Dagger)): (
files: [
"voxygen.audio.sfx.inventory.pickup_sword",
],
threshold: 0.3,
),
//
// Shield
//
Wield(Shield): (
files: [
"voxygen.audio.sfx.weapon.shield_out",
],
threshold: 0.5,
),
Unwield(Shield): (
files: [
"voxygen.audio.sfx.weapon.sword_in",
],
threshold: 0.5,
),
Attack(BasicMelee, Shield): (
files: [
"voxygen.audio.sfx.abilities.swing",
],
threshold: 0.8,
),
Inventory(CollectedTool(Shield)): (
files: [
"voxygen.audio.sfx.inventory.pickup_sword",
],
threshold: 0.3,
),
//
// Inventory
//
Inventory(Collected): (
files: [
"voxygen.audio.sfx.inventory.add_item",
],
threshold: 0.3,
),
Inventory(CollectFailed): ( Inventory(CollectFailed): (
files: [ files: [
"voxygen.audio.sfx.inventory.add_failed", "voxygen.audio.sfx.inventory.add_failed",
@ -77,6 +362,10 @@
], ],
threshold: 0.3, threshold: 0.3,
), ),
//
// Consumables
//
Inventory(Consumed("Potion")): ( Inventory(Consumed("Potion")): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
@ -109,13 +398,13 @@
), ),
Explosion: ( Explosion: (
files: [ files: [
"voxygen.audio.sfx.explosion", // in code
], ],
threshold: 0.2, threshold: 0.2,
), ),
ProjectileShot: ( ProjectileShot: (
files: [ files: [
"voxygen.audio.sfx.glider_open", // in code
], ],
threshold: 0.5, threshold: 0.5,
), ),

BIN
assets/voxygen/audio/sfx/abilities/arrow_shot_1.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/arrow_shot_2.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/arrow_shot_3.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/arrow_shot_4.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/fire_shot_1.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/fire_shot_2.wav (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/separated_third_swing.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/staff_channeling.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/swing.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/swing_sword.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/sword_dash.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/dive_roll_1.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/dive_roll_2.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/experience_gained_1.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/experience_gained_2.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/character/experience_gained_3.wav (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/audio/sfx/footsteps/snow_step_1.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/footsteps/snow_step_2.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/footsteps/snow_step_3.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/footsteps/water_splash_1.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/footsteps/water_splash_2.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/footsteps/water_splash_3.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/footsteps/water_splash_4.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/dagger_in.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/dagger_out.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/shield_out.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/staff_in.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/staff_out.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -89,7 +89,7 @@ use common::{
assets, assets,
comp::{ comp::{
item::{ItemKind, ToolCategory}, item::{ItemKind, ToolCategory},
CharacterAbilityType, InventoryUpdateEvent, object, Body, CharacterAbilityType, InventoryUpdateEvent,
}, },
event::EventBus, event::EventBus,
outcome::Outcome, outcome::Outcome,
@ -97,10 +97,11 @@ use common::{
}; };
use event_mapper::SfxEventMapper; use event_mapper::SfxEventMapper;
use hashbrown::HashMap; use hashbrown::HashMap;
use rand::prelude::*;
use serde::Deserialize; use serde::Deserialize;
use specs::WorldExt; use specs::WorldExt;
use std::convert::TryFrom; use std::convert::TryFrom;
use tracing::warn; use tracing::{debug, warn};
use vek::*; use vek::*;
/// We watch the states of nearby entities in order to emit SFX at their /// We watch the states of nearby entities in order to emit SFX at their
@ -254,6 +255,10 @@ impl SfxMgr {
if let Some(item) = self.triggers.get_trigger(&event.sfx) { if let Some(item) = self.triggers.get_trigger(&event.sfx) {
let sfx_file = match item.files.len() { let sfx_file = match item.files.len() {
0 => {
debug!("Sfx event {:?} is missing audio file.", event.sfx);
"voxygen.audio.sfx.placeholder"
},
1 => item 1 => item
.files .files
.last() .last()
@ -265,6 +270,8 @@ impl SfxMgr {
}; };
audio.play_sfx(sfx_file, position, event.vol); audio.play_sfx(sfx_file, position, event.vol);
} else {
debug!("Missing sfx trigger config for sfx event. {:?}", event.sfx);
} }
} }
} }
@ -277,19 +284,39 @@ impl SfxMgr {
match outcome { match outcome {
Outcome::Explosion { pos, power, .. } => { Outcome::Explosion { pos, power, .. } => {
audio.play_sfx( audio.play_sfx(
// TODO: from sfx triggers config // TODO: from sfx config?
"voxygen.audio.sfx.explosion", "voxygen.audio.sfx.explosion",
*pos, *pos,
Some((*power / 2.5).min(1.5)), Some((*power / 2.5).min(1.5)),
); );
}, },
Outcome::ProjectileShot { pos, .. } => { Outcome::ProjectileShot { pos, body, .. } => {
audio.play_sfx( // TODO: from sfx config?
// TODO: from sfx triggers config match body {
"voxygen.audio.sfx.glider_open", Body::Object(
*pos, object::Body::Arrow | object::Body::MultiArrow | object::Body::ArrowSnake,
None, ) => {
); let file_ref = vec![
"voxygen.audio.sfx.abilities.arrow_shot_1",
"voxygen.audio.sfx.abilities.arrow_shot_2",
"voxygen.audio.sfx.abilities.arrow_shot_3",
"voxygen.audio.sfx.abilities.arrow_shot_4",
][rand::thread_rng().gen_range(1, 4)];
audio.play_sfx(file_ref, *pos, None);
},
Body::Object(object::Body::BoltFire | object::Body::BoltFireBig) => {
let file_ref = vec![
"voxygen.audio.sfx.abilities.fire_shot_1",
"voxygen.audio.sfx.abilities.fire_shot_2",
][rand::thread_rng().gen_range(1, 2)];
audio.play_sfx(file_ref, *pos, None);
},
_ => {
// not mapped to sfx file
},
}
}, },
} }
} }