Page MenuHomeWildfire Games

Fix formation auras
ClosedPublic

Authored by temple on Jul 28 2017, 1:57 AM.

Details

Reviewers
mimo
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP21006: Fix formation auras
Summary

Currently there are a couple of bugs with formation auras, i.e. with Athens' Iphicrates (since he's the only unit that has one).

The easiest way to reproduce the bugs is to have a group of units with Iphicrates and a single unit far away. Select them all, select a formation (the group will line up), and click to have them move somewhere. When the single unit joins the group they'll combine and line up in a new formation. But you'll notice that (1) the single unit doesn't have the +3 armor bonus like the other units and (2) when you remove a unit from the group or change the formation to "None", the units keep their armor bonus. (When units are promoted they lose the bonus, so there's some micromanagement involved in taking advantage of this bug.)

It seems both bugs are from rP14483, when "twin formations" were introduced.

  • To fix (1), when adding members we need to apply the current auras to new members and then apply the new auras to all members.
  • To fix (2), when joining two formations we need to remove members from their old formation (remove the auras) before adding them to the new formation.
Test Plan

Verify that the bugs are fixed. (Use Atlas or the "gift from the gods" cheat.)

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

temple created this revision.Jul 28 2017, 1:57 AM
Lionkanzen added a subscriber: Lionkanzen.
Lionkanzen removed a subscriber: Lionkanzen.
Lionkanzen added a subscriber: Lionkanzen.
bb added a subscriber: bb.Oct 30 2017, 9:08 PM

I doesn't seem to be able to reproduce the second issue (I can reproduce the first one and that is fixed).
Also for some reason when having 1 unit far away and clicking the "box" formation, the the box icon is not selected, while it is for all other formation.

binaries/data/mods/public/simulation/components/Formation.js
378–379

(whata copy-paste, didn't even change the comment, glad it is gone :P)

In D756#39076, @bb wrote:

Also for some reason when having 1 unit far away and clicking the "box" formation, the the box icon is not selected, while it is for all other formation.

That's weird. I found/fixed some other bugs but now I'm working on improving unit motion which could make any fixes irrelevant (since the formation code might get rewritten).

Here's a video of the second bug, where units keep the formation armor bonus after the formation's gone.

nother bug hopefuly get fixed and commit :) when formationed not possible to conquer building. its attacking

nother bug hopefuly get fixed and commit :) when formationed not possible to conquer building. its attacking

Introduced in rP20665.

temple updated this revision to Diff 5344.Jan 16 2018, 8:13 PM
temple added a reviewer: Restricted Owners Package.
temple set the repository for this revision to rP 0 A.D. Public Repository.

(no changes)

mimo added a subscriber: mimo.Jan 18 2018, 7:55 PM
mimo added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
375

This looks strange to me: you add the FormationBonus from the new ents only to those which already had a FormationAura. Is it mandatory that the new auras won't affect entities which previously were not affected? i guess no.

So i think the previous approach was simpler: remove the existing auras, and then add everything to all entities. But it seems that there was a bug in the previous way, line 393, which should have been
cmpAuras.ApplyFormationBonus(this.members) ?

temple added inline comments.Jan 23 2018, 9:08 PM
binaries/data/mods/public/simulation/components/Formation.js
375

?
In this section I apply the current formation auras to the new members.
In the next section I apply the new formation auras to all members.

mimo accepted this revision.Jan 24 2018, 6:50 PM

Yes, patch is indeed good (i misunderstood the way aura bonuses were applied :(

This revision is now accepted and ready to land.Jan 24 2018, 6:50 PM
This revision was automatically updated to reflect the committed changes.