Battle Simulator Scenario

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:) :confused: :mad: :( :p ;) :D :o :rolleyes: :cool: :eek:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Battle Simulator Scenario

Post by Kruldar » Mon Nov 26, 2012 9:51 pm

Edit: Never mind, didn't read Soren's informative post.

Post by Soren » Sun Nov 11, 2012 4:33 pm

Orlor wrote:I don't know. What do you do and how good are you at first person shooters?


Wow, didn't actually expect to get a response to that. I'm currently in school majoring in computer science, I intend to have a career focusing in programming. I used to draw in high school and I am familiar with photoshop from work I do for my church. I am skilled with excel and as a general, if I don't know how to do something, I figure it out. I spend way too much time on Valor but I mainly need a job because I'm broke and college is expensive. And if you give me a few games practice I'll kill everyone in a first person shooter. I haven't played in years!

Post by Orlor » Sat Nov 10, 2012 9:36 pm

I don't know. What do you do and how good are you at first person shooters?

Battle Simulator Reverse Engineered

Post by Soren » Sat Nov 10, 2012 8:57 pm

So here is how the Battle Simulator works if you want to build it in Excel or simply want to understand better:

For the Attacker, you will have an Infantry Unit Percent, and a Mounted Unit Percent. These are calculated simply by the sums of type of attack over total attack power. So in excel it would look something like this:
ATTACKER
INFANTRY
((L*LA) + (Sn*SnA) + (Bk*BkA) + (R*RA) + (Bl*BlA)) / (SUM((L*LA) + ((Sn*SnA) + (Bk*BkA) + (Sc*ScA) + (K*KA) + (G*GA) + (R*RA) + (Bl*BlA)))

MOUNTED
((Sc*ScA) + (K*KA) + (G*GA)) / (SUM((L*LA) + ((Sn*SnA) + (Bk*BkA) + (Sc*ScA) + (K*KA) + (G*GA) + (R*RA) + (Bl*BlA)))

TOTAL ATTACK POWER
The total attack is the sum of all of your attackers, multiplied by the moral (as a percent). Then add to that, the sum of all of the attackers times the moral times the luck. (So assuming that your moral is at 100, and your luck is 10, then your attack gains an extra 10% power. Likewise, if luck is -10, then you lose 10% of your power.) So in excel it would look something like this:
(((L*LA) + (Sn*SnA) + (Bk*BkA) + (Sc*ScA) + (K*KA) + (G*GA) + (R*RA) + (Bl*BlA)) * moral) + (((L*LA) + (Sn*SnA) + (Bk*BkA) + (Sc*ScA) + (K*KA) + (G*GA) + (R*RA) + (Bl*BlA)) * moral)*luck

DEFENDER
You again have a percentage of Infantry Defense and Mounted Unit Defense. To find take the total defense, take the infantry defense of all units times the infantry attack percentage found above, and add it to the mounted defense of all units times the mounted unit attack found above, and you factor in the power of the wall. You can find a table of the bonus's provided by the wall on wiki. But for my example below, the wall level gives a troop defense bonus of 125%, and a basic bonus of 1270. In excel, it would take this form:
TOTAL ATTACK
(((INF DEF * INF ATK %) + (MNT DEF * INF DEF %)) + Wall Bonus) + ((((INF DEF * INF ATK %) + (MNT DEF * INF DEF %)) + Wall Bonus) * Troop Bonus %)

LOSS PERCENTAGES
You will obtain 2 percentages, one for offensive losses and one for defensive losses.
Attacker Loss = (Total Defense / Total Attack) << Carry this out to 4 decimal places for best results
Defender Loss = (Total Attack / Total Defense) << Carry this out to 4 decimal places for best results

EXAMPLES
ATTACKER SENT:
L = 0, S = 0, B = 2000, Sc = 0, K = 0, G = 2000, R = 0, Bl = 0, Sch = 2
Moral = 100
Luck = 10

From our Berserkers, we have an attack of 100,000 (2000B * 20ATK)
and from our Guardians, we have an attack power of 230,000 (2000G * 115ATK)
So our total base attack is 330,000

Therefore
Infantry % = 30.30% >> (100,000 / 330,000)
Mounted % = 69.70% >> (230,000 / 330,000)

Total Attack:
(330,000*100%)+((330,000*100%)*10%)
330,000+33000
363,000

DEFENDER SENT
L = 1000, S = 1000, B = 0, Sc = 0, K = 0, G = 500, R = 0, Bl = 0, Sch = 0
Wall = 25

Infantry Defense = 160,000 >> (1000L * 25DEF)+(1000S * 65DEF)+(500G * 140DEF)
Mounted Defense = 130,000 >> (1000L * 50DEF)+(1000S * 25DEF)+(500G * 110DEF)

Wall = 25, Therefore, Bonus = 1270, and Troop Bonus = 125%
Total Defense:
(((INF DEF * INF %) + (MNT DEF * MNT %)) + Bonus) + ((((INF DEF * INF %) + (MNT DEF * MNT %)) + Bonus) * Troop Bonus)
(((160,000 * 30.30%) + (130,000 * 69.70%)) + 1270) + ((((160,000 * 30.30%) + (130,000 * 69.70%)) +1270) * 125%)
(((48480) + (90610)) + 1270) + ((((48480) + (90610)) + 1270) * 125%)
140361 + (140361 * 125%)
140361 + 175451
315812

Percent Losses
Offensive: (Total Defense / Total Offense)
Offensive: 315812 / 363,000 = 87%

Defensive: (Total Offense / Total Defense)
Defensive: 363,000 / 315812 = 114.97%

Attacker
Lancer = 0 * 87% = 0
Sentry = 0 * 87% = 0
Berserker = 2000 * 87% = 1740
Scouts = 0 (Found Via different formula)
Knights = 0 * 87% = 0
Guards = 2000 * 87% = 1740
Rams = 0 * 87% = 0
Ballistas = 0 * 87% = 0
Scholars = 2 * 87% = 1

Defender
Lancer = 1000 * 114.97% = 1000 (You can't kill more than you have)
Sentry = 1000 * 114.97% = 1000 (You can't kill more than you have)
Berserker = 0 * 114.97% = 0
Scouts = 0 (Found Via different formula)
Knights = 0 * 114.97% = 0
Guards = 500 * 114.97% = 500 (You can't kill more than you have)
Rams = 0 * 114.97% = 0
Ballistas = 0 * 114.97% = 0
Scholars = 0 * 114.97% = 0

I have this worked out in an excel file along with a few other tools. What I haven't worked out perfectly yet are the formula's for the rams, ballistas, and scouts.
Rams do hit before your troops, but they do not inflict full damage on the wall. If you send enough rams to take the wall down from level 25, to level 20, your troops will hit a wall at level 23, before the rams finish taking it down to 20 for the next wave. I haven't figured out the exact percent or formula that determines the stopping point of this decrease in the wall level as of yet but when I do, I'll post it.


PS: Playmesh, can I have a job?

Post by Tazi » Mon Jul 02, 2012 3:48 pm

I was doing a battle simulation againt all sentries. In the first case, I went with all Knights and Defenders. In the second I added some Beserkers. In the second battle, I not only lose most of the Zerks, but more of both Knights and Defenders as well.

By your explanation, the Sentry infantry defense is used against the calvery. Does this really make sense?

Post by IdesOfMach » Tue May 22, 2012 5:45 pm

I have most of the battle simulator worked out, I just haven't figured out walls yet, and need to factor in morale and luck.

With combined troops, it works the defense as a percentage. I don't have time to post a real calculation right now, but just trust me on this, I built a spreadsheet and everything. Also, PlayMesh, if you want to give me some insight on the wall, would be great.

Combined Troop Types:

Say you have an army of lancers and knights. Say your total attack is 1000, with 900 coming from Knights, and 100 from Lancers.
The defender has 100 sentries. Each sentry has 65 infantry defense, and 25 cavalry defense. This gives you a total of 6500 inf. def., and 2500 cav. def.
However, only 10% of the attack is from infantry, and only 90% is from cavalry. So the calculator takes 6500*.1+2500*.9=total defense.
Then the troop loss percentage is (total offense)/(total defense) if defense wins, and vice versa if offense wins.
As a note, rams and ballistae are considered infantry.

Scouts:
If attacker wins, his scout deaths, REGARDLESS OF ANYTHING ELSE, are (number of attacking scouts)*-.08 + (number of defending scouts)*.5 , rounded UP.
If the result is negative, he doesn't lose any. If it's more than the number of scouts sent, he loses all.
As long as even one scout survives, he gets the report.

If attacker loses, he loses all scouts; the defending scouts are lost based on the calculation for all normal troop types.

Note that if no other troops are involved, the defender does not lose any scouts.

Multiple attacking units

Post by BlackWolf » Tue Apr 17, 2012 5:12 am

Hey, was just wondering whether you'd had any insights into how it works when you send both cavalry and infantry against a town?

Post by Aleric17 » Thu Mar 15, 2012 7:21 am

Bottom line is that it is a linear problem: the effect on the outcome of a change of x of some kind of troop is linear in x, as long as the same party wins. Therefore the result can be calculated with matrices, which is probably what the simulator uses.

Post by Kaleel » Tue Mar 06, 2012 10:23 pm

@TheBoyMort: You're welcome. And I've just discovered that the calculation is weighed based on defense points per population type. See the following scenario:


  • GIVEN:
    • ATTACKING ARMY: 3,000x Knights
    • DEFENDING ARMY: 3,000x Lancers & 750x Sentries & 1,500x Guardians


  • OVERVIEW CALCULATION:
    • 3,000 Knights x 110 attack points per Knight
      • Offense has total of 330,000 cavalry-attack points
    • 3,000x Lancers x 50 defense-against-infantry points = 150,000 defense-against-cavalry points
    • 750x Sentries x 25 defense-against-infantry points = 18,750 defense-against-cavalry points
    • 1,500x Guardians x 110 defense-against-infantry points = 165,000 defense-against-cavalry points
      • Defense has total of 333,750 defense-against-infantry points, so defense wins in this scenario. But by what margin? See below.


  • TROOP-VS-TROOP CALCULATION:


[LIST=|INDENT=1]
[*]150,000x Lancer-supplied defense-against-cavalry points / 333,750 total defense-against-cavalry points = 0.4494 = 44.94%, so Lancers reduce can absorb that much percentage of the damage.
  • 44.94% of 330,000 Knight-supplied cavalry-attack points = 148,302 Knight-supplied cavalry-attack points
  • 150,000 Lancer-supplied defense-against-cavalry points > 148,302 Knight-supplied cavalry-attack points, so Lancers win.
  • Surviving Lancers:
    • = 150,000 - 148,302 = 1,698
    • = 1,698 / 50 = 33.96
    • = 34 Lancers survived

[/LIST]


[LIST=|INDENT=1]
[*]18,750 Sentry-supplied defense-against-cavalry points / 333,750 total defense-against-cavalry points = 0.0561 = 5.61%, so Sentries can absorb that much percentage of the damage.
  • 5.61% of 330,000 Knight-supplied cavalry-attack points = 18,513 Knight-supplied cavalry-attack points
  • 18,750 Sentry-supplied defense-against-cavalry points < 18,513 Knight-supplied cavalry-attack points, so Sentries win.
  • Surviving Sentries
    • = 18,750 - 18,513 = 237
    • = 237 / 25 = 9.48
    • = 10 Sentries survived

[/LIST]


[LIST=|INDENT=1]
[*]165,000 Guardian-supplied defense-against-cavalry points / 333,750 total defense-against-cavalry points = 0.4943 = 49.43%, so Guardians can absorb that much percentage of the damage.
  • 49.43% of 333,000 Knight-supplied cavalry-attack points = 163,119 Knight-supplied cavalry-attack points
  • 165,000 Sentry-supplied defense-against-cavalry points > 163,119 Knight-supplied cavalry-attack points, so Guardians win.
  • Surviving Guardians:
    • = 165,000 - 163,119 = 1,881
    • = 1,881 / 110 = 17.1
    • = 18 Guardians survived

[/LIST]

...now all of that was the long, hard calculation. The easy way is (per the Simulator) is:

  • Attack points = 330,000 & defense points = 333,750.
  • Because Defense > Attack
    • % of loss of attack troops = 100%
    • % of loss of defensive troops = (attack points / defense points)
      • = 330,000 / 333,750
      • = 0.9887 = 98.87% defensive troop loss, 0.0112 = 1.12% defensive troop survival rate.
  • 3,000x Lancers x 98.87% troop loss = 2x966x Lancers killed, 34x Lancers survived.
  • 750x Sentries x 98.87% troop loss = 741x Sentries killed, 9x Sentries survived.
  • 1,500x Guardians x 98.87% troop loss = 1,483x Guardians killed, 17 Guardians survived.
Notice how the amount of troops survived almost identical? I took the long way around, but reached the same conclusion as the in-game algorithm. Frustrating, perhaps, but at least my homegrown method (which I thought about for DAYS) yields the same result. Which proves that the developers are a lot smarter than me, hah!

-Kaleel

Post by TheBoyMort » Mon Mar 05, 2012 5:29 pm

Wow Kaleel my thanks, you have taken my problem further than I thought anyone would!

My original motive was to ascertain whether you could build a balanced combined attack/defence city in a 3 tier research world using lancers and guards thereby doing away the need for sentries completely. You could then just build one type of self supporting city.

I now don't believe this is possible based on this problem and further experience in the game.

I think you may have uncovered somthing here but I need some time to digest your findings but I will try and get back to you!

Mort

Top