There was a question about fighting mechanics over at KaM forum (link). To sum up in one sentence – Is there an unfair advantage when 2 arbaletmen armies clash?
Imagine there are 2 armies of arbaletmen standing in front of each other. Top vs bottom, Red vs Blue. Order to attack arrives at the same moment to both armies. Who has an advantage? Place your bets and proceed inside:
One of the joys of having a working game engine is to be able to run it in crazy environments. One of such is stripping all of the rendering and terrain updates, keeping just the games logic, which being unleashed can run at crazy speeds of measured at around x1000.
I have configured our test-runner tool to simulate 1000 fights between 2 groups of xbows. Each group had 7 columns and 4 rows – total of 28 xbows. Groups were 4 tiles apart facing each other. Attack orders were placed on the same moment.
Results were recorded and displayed as a distribution chart:
X axis measures how many soldiers left alive in that team. Y axis measures how many times that result was met.
From the chart above we can see that each team was defeated (had 0 soldiers left) ~500 times. All other times some remained alive. In precise words, Top-Red won 50.4% of fights, Bottom-Blue won 49.6% of fights. The unfair advantage mentioned at the topics start, seems to be within 1%, which is negligible considering many other factors in play: tactics, attack orders timing, etc.
Other points of interest:
- Luckiest of times, one of the teams lost only 9 xbows while killing 28 enemies;
- Having single xbow survive is as likely as having 17 left alive;
- Most of the times (~28%) winning team has 7-9 xbows alive;
- Without deep inspection of the logs, longest winning streak for one of the teams was 9 victories in a row;
- 1000 fights take around 1.5 minutes.
That’s a nice finding. Suprising to me is the fact that it falls down at low surviving numbers lik 1-3. I would have guessed more.
The resulting red and blue graphs are in very good agreement (1000 is rather low in simulation) and show that indeed there is no bias.
Did you check in this simulation tool in the SVN rep? Is it standalone, easy to understand etc?
The distribution curve is a bit bell-shaped. Left half is low probably due to numeric advantage. As soon as one team gets an upper hand it wipes out enemies in progressive order.
The tool called Runner and is available in SVN and is included into KaM project group (or directly available in “.\Utils\Runner\”).
Most of the setup is made in code. I did not bothered prettifying it, because it is intended for our internal use at profiling and optimizations, as well AI tests.