Introduction
Welcome to Data & Dice, a Kings of War data analytics blog. As many of you are new readers, I’d like to introduce you to a crucial tool I’ve been developing and refining for about a year now: a comprehensive combat simulator for Kings of War. This simulator serves two primary purposes:
- Game Matchup Analysis: By loading both armies’ lists into the simulator, I can assess which units have advantages over others. This analysis helps in strategizing for upcoming matches by identifying favorable and unfavorable unit matchups. You’d think that might make me better at the game, but unfortunately, that is not generally the case.
- Unit Ranking and Elo Ratings: Behind the scenes, the simulator runs millions of unit-versus-unit combats to generate Elo ratings for all units. These ratings provide insights into each unit’s effectiveness across countless simulated encounters, offering a data-driven approach to understanding unit performance.
Based on comments on a Facebook thread, I wanted to give some additional insight into the simulator. In this post, I’ll provide a high-level overview of what the simulator does and how it works. Additionally, I’ll list all the special rules I’ve implemented so you can understand the depth of consideration that goes into each simulation–and then give me guidance on what else I should incorporate.
How the Simulator Works
The Kings of War combat simulator is designed to model 1v1 unit battles accurately by replicating the game’s mechanics and rules. Here’s a breakdown of its core components and processes:
Turn-Based Phased Simulation
The simulator follows the turn-based structure of Kings of War, with each turn divided into distinct phases. This structure ensures that actions and effects occur in the correct sequence, mirroring actual gameplay. The main phases are:
- Start of Turn Phase: Units apply effects that occur at the beginning of their turn, such as regeneration of wounds or activation of certain abilities.
- Movement Phase: Units move according to their speed and any movement-related special rules. The simulator calculates distances, checks for charges, and considers terrain effects.
- Start of Combat Phase: Pre-combat effects and special rules that activate before attacks are resolved here.
- Attack Phase: Units perform their attacks, factoring in melee or ranged combat modes. Attack rolls are made, and modifiers from special rules or conditions are applied.
- Damage Calculation Phase: Damage is calculated based on the number of successful hits and wounds inflicted, considering the defender’s defense and any defensive special rules.
- Post-Combat Phase: Effects that occur after combat, such as healing from Lifeleech or applying conditions like Disorder, are resolved.
- Nerve Test Phase: Units that have taken damage test their nerve to determine if they hold, waver, or rout. Modifiers from special rules or inspiring presence are considered.
- End of Turn Phase: Any end-of-turn effects are applied, and preparations are made for the next unit’s turn.
This phased approach allows the simulator to handle complex interactions between units and their special rules, providing an accurate representation of combat outcomes.
Special Rules Implementation
Special rules are integral to Kings of War, granting units unique abilities that can significantly influence battles. In the simulator, each special rule is implemented as an individual component, encapsulating its own logic and effects.
Mechanics of Special Rules
- Modular Design: Each special rule is a separate class derived from a base
SpecialRule
class. This design ensures that adding or modifying rules doesn’t affect the overall system’s integrity. - Phase Integration: Special rules have methods corresponding to the game’s phases, allowing them to activate and apply effects at the appropriate times.
- Unit Association: Units have a list of special rule instances attached to them. During each phase, the simulator calls the relevant methods on these rules, ensuring their effects are considered in simulations.
By implementing special rules individually, the simulator can accurately model their effects and interactions, providing realistic combat outcomes.
Combat Resolution Mechanics
When two units engage in combat within the simulator, several factors are considered to determine the outcome:
- Attack Calculations: The simulator calculates the number of attacks, factoring in any additional attacks from special rules like Slayer or Rampage. It rolls dice for each attack, applying modifiers to determine hits.
- Hit Modifiers: Terrain, unit status (e.g., hindered), and special rules can modify the required roll to hit.
- Damage Calculations: Successful hits are rolled against the opponent’s defense, considering modifiers from special rules like Crushing Strength or Piercing.
- Applying Damage: Damage is recorded on the defending unit, and effects like Lifeleech can heal the attacking unit.
- Nerve Tests: After damage is applied, the defending unit makes a nerve test to determine if it holds, wavers, or routs. Special rules like Brutal or Dread can affect this test.
Massive Simulations for Elo Ratings
To generate Elo ratings for units:
- Automated Combat Simulations: The simulator runs millions of combats between different units, covering a wide range of possible matchups and scenarios.
- Statistical Aggregation: Results are collected and analyzed statistically to assess each unit’s performance.
- Elo Calculation: Based on the outcomes, units are assigned Elo ratings that reflect their effectiveness relative to others.
This approach provides a data-driven metric for comparing units, helping players understand the strengths and weaknesses of various options.
Implemented Special Rules
The simulator currently includes the following special rules, each fully implemented to reflect their in-game effects:
- Big Shield
- Blast
- Brutal
- Cloak of Death
- Crushing Strength
- Dread
- Duelist
- Elite
- Ensnare
- Fly
- Fury
- Headstrong
- Individual
- Inspiring
- Iron Resolve
- Lifeleech
- Nimble
- Pathfinder
- Phalanx
- Piercing
- Rampage
- Radiance of Life
- Regeneration
- Scout
- Shambling
- Shattering
- Slayer
- Steady Aim
- Stealthy
- Strider
- Thunderous Charge
- Vengeance
- Very Inspiring
- Vicious
- Wild Charge
Conclusion
The development of this combat simulator has been a meticulous process aimed at faithfully representing the mechanics of Kings of War. By simulating combats with detailed consideration of special rules and unit characteristics, the simulator provides valuable insights for both tactical matchup analysis and broader assessments through Elo ratings.
I hope this overview has given you a clear understanding of how the simulator works and the depth of detail involved in its operation. As the simulator continues to evolve, I’ll be implementing more special rules and refining existing ones to enhance its accuracy and utility. If you have specific questions about how interactions are modeled, please let me know, and I can address here!
Thank you for reading, and I look forward to sharing more findings and updates with you in future posts.