#6566 closed defect (fixed)

Han gather_grain animation is not chosen correctly for Spearman and Pikeman

Reported by: Langbart Owned by: Freagarach
Priority: Should Have Milestone: Alpha 27
Component: Simulation Keywords:
Cc: Patch: Phab:D4937

Description (last modified by Langbart)

I could not find the steps to reproduce the problem conclusively, but it happened to me at least twice and only with the Han. See the attached replay (animation_broke_rice_gather.txt) and the GIF below for more clarity. The unit still farms, but the gather_grain animation does not work properly.

possibly related

Similar sounding problem reported by borg via the forum

EDIT 12/Jun/22 with [26937]

The issue is still noticeable, see attached replay (farmMe_rP26937.txt ~3min mark) and GIF below for more clarity. The unit simply stops the animation, still gathering though.

EDIT 13/Jun/22

Reproduce: Add a small distance between the rice field and the drop point, so that the unit has to walk. The problem can only be observed for Han citizen-soldiers.

Seems to do with approach_rice.xml and the line <variant file="biped/approach_rice.xml"/> in the binaries/data/mods/public/art/actors/units/han/ files. Ref: [26937]

Update

to reproduce

  • Open Atlas and place a CC and a Han rice field next to each other without leaving a gap between them.
  • Place a han/infantry_spearman_b.xml and a han/infantry_halberdman_b.xml and start the simulation. (Only these two unit types - Spearman and Pikeman - are affected by the Han.)
  • Order them to gather
  • Wait until they reach the CC, the animation for gathering is not chosen.

issue

wiki/Actors#Randomnessandselections

If two variants have equal frequency values, they have equal chance of being selected.

I think in Atlas the top line is always chosen, moving the line for gather_grain above carry_food would also work, at least in Atlas.

  • binaries/data/mods/public/art/actors/units/han/infantry_spearman_b.xml

    a b  
    3333  </group>
    3434  <group>
    3535    <variant file="biped/base_spearman_shield_relax.xml"/>
     36    <variant file="biped/gather_grain.xml"/>
    3637    <variant file="biped/carry_food.xml">
    3738      <props>
    3839        <prop actor="props/units/helmets/han_ricehat.xml" attachpoint="helmet"/>
     
    4344    <variant file="biped/formations/anti_cavalry_back.xml"/>
    4445    <variant file="biped/attack_slaughter.xml"/>
    4546    <variant file="biped/gather_tree.xml"/>
    46     <variant file="biped/gather_grain.xml"/>
    4747    <variant file="biped/gather_fruit.xml"/>
    4848    <variant file="biped/gather_meat.xml"/>
    4949    <variant file="biped/gather_rock.xml"/>

possible solution

  • binaries/data/mods/public/art/actors/units/han/infantry_spearman_b.xml

    a b  
    3838        <prop actor="props/units/helmets/han_ricehat.xml" attachpoint="helmet"/>
    3939      </props>
    4040    </variant>
    41     <variant file="biped/attack_capture.xml"/>
    42     <variant file="biped/formations/anti_cavalry_front.xml"/>
    43     <variant file="biped/formations/anti_cavalry_back.xml"/>
    44     <variant file="biped/attack_slaughter.xml"/>
    45     <variant file="biped/gather_tree.xml"/>
    46     <variant file="biped/gather_grain.xml"/>
    47     <variant file="biped/gather_fruit.xml"/>
    48     <variant file="biped/gather_meat.xml"/>
    49     <variant file="biped/gather_rock.xml"/>
    50     <variant file="biped/gather_ore.xml"/>
    51     <variant file="biped/gather_ruins.xml"/>
    52     <variant file="biped/gather_praise.xml"/>
    53     <variant file="biped/build.xml"/>
    54     <variant file="biped/build_farm.xml"/>
    55     <variant file="biped/death_infantry.xml"/>
    5641    <variant file="biped/carry_meat.xml"/>
    5742    <variant file="biped/carry_wood.xml"/>
    5843    <variant file="biped/carry_stone.xml"/>
     
    6853    <variant file="biped/approach_praise.xml"/>
    6954  </group>
    7055  <group>
    71     <variant name="Idle"/>
     56    <variant frequency="1" name="Idle"/>
     57    <variant file="biped/attack_capture.xml"/>
     58    <variant file="biped/attack_slaughter.xml"/>
     59    <variant file="biped/gather_tree.xml"/>
     60    <variant file="biped/gather_grain.xml"/>
     61    <variant file="biped/gather_fruit.xml"/>
     62    <variant file="biped/gather_meat.xml"/>
     63    <variant file="biped/gather_rock.xml"/>
     64    <variant file="biped/gather_ore.xml"/>
     65    <variant file="biped/gather_ruins.xml"/>
     66    <variant file="biped/gather_praise.xml"/>
     67    <variant file="biped/build.xml"/>
     68    <variant file="biped/build_farm.xml"/>
     69    <variant file="biped/death_infantry.xml"/>
    7270  </group>
    7371  <material>player_trans.xml</material>
    7472</actor>

additional nitpick

Other actors, such as romans/infantry_spearman_b.xml, should receive a similar treatment.

Attachments (4)

animation_broke_rice_gather.txt (15.3 KB ) - added by Langbart 23 months ago.
anim_broke.gif (683.6 KB ) - added by Langbart 23 months ago.
farmMe_rP26937.txt (24.8 KB ) - added by Langbart 23 months ago.
farmMe_rP26937.gif (987.3 KB ) - added by Langbart 23 months ago.

Download all attachments as: .zip

Change History (18)

by Langbart, 23 months ago

by Langbart, 23 months ago

Attachment: anim_broke.gif added

comment:1 by wowgetoffyourcellphone, 23 months ago

Ref: https://trac.wildfiregames.com/changeset/26937

comment:2 by Langbart, 23 months ago

[26937] [Alpha 26] Remove the food.rice distinction and subsequent animation variants. Fixes some odd behavior. Fixes #6559 Fixes #6565 Refs #6566

comment:3 by Langbart, 23 months ago

will be checked tomorrow with the new Git update and is expected to be closed as well.

comment:4 by Langbart, 23 months ago

Description: modified (diff)

by Langbart, 23 months ago

Attachment: farmMe_rP26937.txt added

by Langbart, 23 months ago

Attachment: farmMe_rP26937.gif added

comment:5 by Langbart, 23 months ago

Description: modified (diff)

comment:6 by Langbart, 23 months ago

Description: modified (diff)
Summary: Gather_grain animation for Han sometimes does not work properlyHan gather_grain animation is not chosen correctly for Spearman and Pikeman

final update

comment:7 by Stan, 22 months ago

In 26961:

Fix missing animations for grain gathering for han units. This workarounds a bug in UnitAI and improves consistency with other actors. Show the rice hat for approaching, returning and gathering grain.
Refs #6566

comment:8 by Stan, 22 months ago

In 26962:

Fix missing animations for grain gathering for pikemen. is workarounds a bug in UnitAI and improves consistency with other actors.

Refs #6566

comment:9 by Stan, 22 months ago

In 26963:

Fix missing animations for grain gathering for swordsmen. This workarounds a bug in UnitAI and improves consistency with other actors.
Refs #6566

comment:10 by Stan, 22 months ago

In 26964:

Fix missing animations for grain gathering for spearmen. This workarounds a bug in UnitAI and improves consistency with other actors.
Refs #6566

comment:11 by Stan, 22 months ago

Milestone: Alpha 26Alpha 27
UnitAI.prototype.SetAnimationVariant@simulation/components/UnitAI.js:4584:7 
UnitAI.prototype.SetDefaultAnimationVariant@simulation/components/UnitAI.js:4607:9 
enter@simulation/components/UnitAI.js:2673:11 
FSM.prototype.SwitchToNextState@globalscripts/FSM.js:366:14 
FSM.prototype.ProcessMessage@globalscripts/FSM.js:274:8 
UnitAI.prototype.ProcessMessage@simulation/components/UnitAI.js:4347:15 
ResourceGatherer.prototype.StopGathering@simulation/components/ResourceGatherer.js:243:14 
ResourceGatherer.prototype.PerformGather@simulation/components/ResourceGatherer.js:286:8 
Timer.prototype.OnUpdate@simulation/components/Timer.js:139:44

WARNING: carry_food

UnitAI.prototype.SetAnimationVariant@simulation/components/UnitAI.js:4584:7 
enter@simulation/components/UnitAI.js:2461:11 FSM.prototype.SwitchToNextState@globalscripts/FSM.js:366:14 
FSM.prototype.ProcessMessage@globalscripts/FSM.js:274:8 
UnitAI.prototype.OnMotionUpdate@simulation/components/UnitAI.js:4268:15

WARNING: approach_grain

WARNING: GATHERING
WARNING: RETURNINGRESOURCE
WARNING: DROPPINGRESOURCES
WARNING: GATHER.APPROACHING
WARNING: GATHERING

It seems that when the field is too close, something is not reset properly.

comment:12 by Stan, 21 months ago

Component: Art & AnimationSimulation

comment:13 by Freagarach, 14 months ago

Owner: set to Freagarach
Patch: Phab:D4937

https://code.wildfiregames.com/D4937 should fix the UnitAI issue. I guess it would be nice if we wouldn't need to rely on stuff hidden away in UnitAI. '

comment:14 by Freagarach, 14 months ago

Resolution: fixed
Status: newclosed

In 27550:

Fix missing animation variant reset after committing resources in UnitAI.

Causing units to not show the gathering animation when close to a dropsite.
We might want to move this stuff to their respective components.

Differential revision: https://code.wildfiregames.com/D4937
Comments by: @Stan
Fixes #6566

Note: See TracTickets for help on using tickets.