android - What is battle formula of strategy game? -
i try find algorithm strategy game battles travian or lord of ultima or ... every program wrote had bug calculating dead soldiers, examples of critical points is:
- in real world when 100 soldiers attack 1 soldier,its usual 100 soldiers alive , 1 defender soldier dead.
- finding winner of battle
data example is:
attacker: soldiers | defending-power | attacking-power | soldier count | ---------|-----------------|-----------------|---------------| | 20 | 45 | 5 b | 22 | 77 | 4 c | 41 | 32 | 7 d | 38 | 54 | 6 e | 27 | 41 | 6 defender: soldiers | defending-power | attacking-power | soldier count | ---------|-----------------|-----------------|---------------| | 44 | 12 | 6 b | 59 | 18 | 6 c | 73 | 40 | 7 d | 26 | 61 | 2 e | 7 | 24 | 4
i suggest both players' soldier counts follows exponential decay curve, being dependent on each others' soldier counts. in, @ point in time, soldier count of player x being reduced factor of (y's soldiers)*(y's attacking power)/(y's defending power), , same player y's soldier count.
if both players' strengths similar, both sides' soldier counts going down exponential decay curve, if 1 player's strength overwhelms other's, other side's soldier count feel linear drop on time. (yes, treat soldier count floating point until battle ends.)
getting algorithm match data process of determining how run calculation (basically, how big multiply factor by), determining if run both sides simultaneously or if 1 side reduces other's soldier count first, whether round or down @ end , whether attacking power/defending power part simple dividing 1 other, or whether have diminishing or runaway returns having advantage.
Comments
Post a Comment