Opened 4 years ago

Last modified 5 months ago

#5856 new defect

Improving Impact Sounds — at Version 1

Reported by: Stan Owned by:
Priority: Should Have Milestone: Backlog
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by Stan)

Currently no matter whether the projectile actually hits its target or what the target actually is, a generic impact sound is played.

It would be nice if the sound played was different depending on the target nature, and whether it actually hit it or not.

To do so, one needs to do the following.

Step1 : Removing BuildingAI hack.

Currently instead of using the consecrated path through UnitAnimation:198 BuildingAI:350 forces the game to play a sound, while that should be handled by the animation tag in the actors. This is the reason some building actors still have the following code:

<animations>
  <animation event="0.5" load="0.0" name="attack_ranged" speed="100"/>
</animations>

I propose to include the following variant in all the files that are supposed to shoot arrows. Comment are there as an indication, and will not be included.

art/variants/structures/base_defensive.xml:

<?xml version="1.0" encoding="utf-8"?>
<variant name="base" frequency="1">
  <!-- {string} - default: "" - m_FileName - file - Name of the dae / psa animation file -->
  <!-- {string} - default: "" - m_AnimName - name - Anim Name used by UnitAI and to find the SoundGroup -->
  <!-- {string} - default: "" - m_ID - id - Arbitrary Anim name for sync -->
  <!-- {integer} - default: 0 - m_Frequency - frequency - Frequency of the animation the -->
  <!-- {integer} - default: 1.0 - m_Speed - speed - (percentage of anim time) the number is divided by 100 -->
  <!-- {float} - default: 0.0 - m_ActionPos - event - m_ActionPos (percentage of anim time) -->
  <!-- {float} - default: 0.0 - m_ActionPos2 - load - m_ActionPos2  (Moment when to show/hide the projectile) (percentage of anim time) -->
  <!-- {float} - default: - 1.0 - m_SoundPos - sound - Sound offset (percentage of anim time) If not present, event is used instead --> 
  <animations>
    <animation event="0.0" file="" frequency="1" load="0.0" sound="-1.0" speed="0" name="idle" id="idle_01"/>
    <animation event="0.0" file="" frequency="1" load="0.0" sound="-1.0" speed="0" name="attack_ranged" id="attack_ranged_01"/>
  </animations>
  <props>
    <prop actor="props/units/weapons/arrow_front.xml" attachpoint="loaded-projectile"/>
    <prop actor="props/units/weapons/arrow_front.xml" attachpoint="projectile"/>
  </props>
</variant>

Plus: Writing a script to find the affected templates would be nice

Step 2 Move sound handling to MissileHit instead of doing it in UnitAI.

Currently we already know what sound we are gonna be playing when we set the callback for MissileHit. Instead of the sound, we should pass the id of the sending entity (to know what weapon was used) so that we can play different variants, depending on whether we hit the target and what the target is. For that I propose to use classes.

For the Organic class we should have three cases

  • Unit has no armor → "attack_impact_" + type.toLowerCase()+ "_flesh"
  • Unit has metal armor → "attack_impact_" + type.toLowerCase()+ "_metal"
  • Unit was missed → "attack_impact_" + type.toLowerCase()"

We could therefore add a armored class.

For the Structure class we could have two cases

  • Building is hit → "attack_impact_" + type.toLowerCase()+ "_stone"
  • Building was missed → "attack_impact_" + type.toLowerCase()"

For the Ship class we could have two cases

  • Building is hit → "attack_impact_" + type.toLowerCase()+ "_wood"
  • Building was missed → "attack_impact_" + type.toLowerCase()"

Change History (1)

comment:1 by Stan, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.