Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically calculate unit counters #23

Open
TimJentzsch opened this issue Feb 2, 2023 · 2 comments
Open

Dynamically calculate unit counters #23

TimJentzsch opened this issue Feb 2, 2023 · 2 comments

Comments

@TimJentzsch
Copy link

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.

@robertvanhoesel
Copy link
Member

For reference here's an initial working implementation cf6a00a

@acstanton515
Copy link

For reference here's an initial working implementation cf6a00a

I am in favor of furthering this idea with more/similar statistics around unit counters and building a table of units to compare against for various user inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants