Page MenuHomeWildfire Games

[ai/petra] improve elephant class usage

Authored by Nescio on Aug 17 2020, 12:56 PM.


Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
rP24027: [Petra] update usage of Elephant class

This patch improves how the Petra AI uses the Elephant class:

  • For soldiers, remove the Champion requirement, in case mods have non-Champion elephants.
  • For mobile dropsites, replace Elephant with Unit, in case a mod adds e.g. an ox-cart or something (Xiongnu?).
  • Since D2511/rP23579, worker elephants can no longer build, but the AI assumes they can, and erroneously labels them as workers, therefore remove now obsolete lines.

This patch is unrelated to D2962, D2853, D2852, D2595.

Test Plan

Check for completeness and correctness. Verify the AI still works.

Diff Detail

rP 0 A.D. Public Repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Nescio created this revision.Aug 17 2020, 12:56 PM
Owners added a subscriber: Restricted Owners Package.Aug 17 2020, 12:57 PM

Build failure - The Moirai have given mortals hearts that can endure.

<command-line>:0:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <> for instructions.
make[1]: *** [obj/test_Debug/test_root.o] Error 1
make: *** [test] Error 2

Link to build:

Nescio requested review of this revision.Aug 17 2020, 1:07 PM
Silier added inline comments.Aug 27 2020, 3:20 PM
307 ↗(On Diff #13221)

this is questionable, it probably should check if entity is mobile dropsite instead elephnat + support, so we count for that unit

Nescio added inline comments.Aug 27 2020, 4:13 PM
307 ↗(On Diff #13221)

How to do that? Introduce a new class? And is including them here really meaningful, given they can't build?

ent.resourceDropsiteTypes() but yes, I am not sure it is worth. I already know how to break it when accounting for them.
question is if mobile dropsites are so valuable in early game so having them far away from initial cc would be worse than moving faster units to their location and build there.

Silier accepted this revision.Sep 6 2020, 10:37 AM

Ai works without errors.
As I think it would be good to make use of support elephant aura while building, mobile dropsite is more valuable moreover since ai has only one worker elephant.
Removing Champion class from siege unit check is ok-ish, as champion melee elephants are only melee elephant svn currently has.
Rest removals and changes to Unit class are ok.
I do not like unrelated style changes but idc too much.
Thank you for the patch.

This revision is now accepted and ready to land.Sep 6 2020, 10:37 AM
This revision was automatically updated to reflect the committed changes.