Skip to content

Dynamically calculate unit counters #23

@TimJentzsch

Description

@TimJentzsch

Related to #7.

It would be nice to have a tool which allows you to select a unit and then get suggestions for units which counter that unit.
Probably combined with a selector for the current age to make the computation easier.

I think it would be possible to compute this dynamically from the unit stats.

Here's one potential approach:

(Countered unit: CU; Other unit: OU)

  • Take the HP and armor against OU of the CU: HP_CU, AR_CU.
  • Take the attack damage, bonus attack damage against CU and the attack speed of the OU: AD_OU, BD_OU, AS_OU.
  • Compute the effective attack damage of the OU against the CU: EAD_OU = max(0, AD_OU + BD_OU - AR_CU).
  • Compute the number of OU hits needed to kill CU: HK_OU = ceil(HP_CU / EAD_OU).
  • Compute the (approximate) time for OU to kill CU: HT_OU = HK_OU * AS_OU
  • Do the same in reverse to obtain HT_CU.
  • Calculate the counter ratio: CR = HT_CU / HT_OU.

This ratio is > 1 when OU counters CU (kills them faster than they are killed).
The higher the number, the stronger the counter.

Of course this can probably be improved in many ways, for example it would probably be good to factor in the resource costs of each unit.
When you consider two armies fighting, it might also make more sense to not ignore the hits and just talk about average damage per second to calculate the time to kill.
Corner cases like splash damage are also not considered in this approach.

I think this would be a very interesting and useful tool, but of course also requires a lot of work to get implemented.
Feel free to close this issue if it doesn't align with the scope of this project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions