Determining Formula (Game Mechanics)

1.4k Views Asked by At

WARNING

I believe that the data below has errors in the defense strength, so is therefore not solvable. I will update it when I have more information. Thank you.


I play a game (Empire: Four Kingdoms) in which soldiers attack castles where other soldiers defend, and I'm trying to solve for the equation that they use in order to calculate losses.

I have some data points but am having a hard time determining the actual formula.

In general terms, if the attack strength stays the same, adding more defenders will lower the defenders losses (as may be imagined), but it is not linear (i.e. doubling the defending strength will not halve the losses).

Here are some data points that I have so far (in all scenarios below, all attackers were lost, but at this point I am only concerned with the defenders losses):

Qty Attackers, Qty Defenders, Attack Strength, Defense Strength, Qty Defenders Lost

52, 78, 11,954.8, 13,459.68, 69
52, 182, 11,954.8, 31,658.59, 44
52, 138, 13,041.60, 33,506.83, 35
52, 103, 11,954.80, 23,549.26, 39
52, 64, 13,041.60, 32,487.89, 17
136, 190, 17,912.83, 56,612.55, 7
42, 94, 4,869.23, 23,403.63, 7
42, 86, 4,869.23, 25,792.09, 4
42, 87, 4,956.00, 24,399.58, 5
42, 82, 4,956.00, 16,448.96, 13
46, 70, 4,724.38, 28,339.08, 5
46, 65, 9,537.00, 11,953.70, 45
46, 65, 9,537.00, 12,773.50, 41
52, 247, 8,816.08, 47,454.43, 15
52, 232, 10,032.36, 98,829.79, 8
52, 224, 8,816.08, 61,920.54, 12

2

There are 2 best solutions below

3
On

I tried some fits based on your guesses about the formula, but I did not find enough improvement to justify them over the basic guess $D=d\dfrac{s_a}{s_d}$ where $d$ is the number of defenders, $s_a,s_d$ are the attacker and defender strengths, and $D$ is the number of defender deaths. However, this is not a very good fit either. Although it follows the rough contours, it is often off by $10$ or more, with the worst outlier being the datapoint

$$a=136,\ d=190,\ s_a=17\,912.83,\ s_d=56\,612.55,\quad D=7,\quad \overset{\sim}D=57.99$$

making me suspect that there is a large random component to the data (which needless to say makes fitting it much more difficult). (Of course the best proof that there is a random component is getting different outputs for the same input, but barring that you can make certain claims about the complexity of the function if you get enough closely spaced input data with widely different output values.)

2
On

You get the same results most of the time not all of the time. There is a random variable used in calculating the result. That is from 30, 000 attacks experience.