Menu PocketGamer.biz
Search
Home   >   Features

Trillions upon trillions of variations: A data-driven look at a midcore battler’s meta

Azur Games’ Vasily Novoselov takes a deep dive into the data that drives the midcore battler Kingdom Clash
Trillions upon trillions of variations: A data-driven look at a midcore battler’s meta
Stay Informed
Get Industry News In Your Inbox…
Sign Up Today

Vasily Novoselov is a product analyst at Azur Games.

Analysing games that feature a huge number of interacting units or entities can be incredibly challenging. Take a typical CCG, for instance: a player may start with hundreds of cards and build a one-of-a-kind deck, leading to an enormous range of possible combinations.

In the midcore battler Kingdom Clash, we have dozens of different units, each of which can occupy a specific position on a battlefield – resulting in nearly limitless ways to arrange them. So, the main goal of this study is to identify the most popular builds and see whether there really is a metagame in the game.

At the time of writing, Kingdom Clash features 36 units, and each can be placed on any of the 49 (7x7) positions, with repeats allowed. So the number of possible arrangements is:

For perspective, there are estimated to be around 10^27 stars in the observable universe.

Answering something as straightforward as “Which army formation is the most popular among players?” isn’t easy. Even if you tried to list all unique formations and simply tally up how many players use each one, you won’t be able to find two that are exactly the same.

Answering something as straightforward as “Which army formation is the most popular among players?” isn’t easy.

Disclaimer: I’m slightly overstating the scale here – players don’t use all possible units, just the ones that give them the biggest advantage. So the actual number of “useful” formations is lower, but it’s still huge.

Nevertheless, we need a way to handle this variety. Let’s try to pinpoint the most popular builds and figure out whether a true metagame exists.

Answering these questions can help us understand how players choose units and which balance tweaks might be needed in future updates. And since we rely on a data-driven approach for decision-making, spotting useful insights is essential. Ultimately, this analysis will yield not just insights but also a tool for ongoing monitoring and decision-making.

Describing a formation

Let’s consider a few possible ways to store and represent a formation:

  • A table that specifies which unit occupies each position

{Position 1: Unit A, Position 2: Unit B, ...}

However, this approach doesn’t help us generalise the formations in any way, so it’s not really suitable for our analysis. While the exact positioning of units on the battlefield is important for determining who wins, we can set that aside for our current goal: measuring the popularity of each unit.

Essentially, we just want to know how many times each unit shows up, regardless of where it’s placed.

  • 2. A table that specifies which unit occupies each position

{Position 1: Unit A, Position 2: Unit B, ...}

This is already more useful, but there’s still no clear way to compare two different armies. Should we compare them unit by unit, or is there some other way?

Ultimately, I arrived at a more elegant approach:

  • A vector where each element corresponds to a specific unit, and the value is the number of times that unit appears in a formation. 

In other words, something like [3,0,1,0,…,2,0] for each formation. Not only is this a compact way to record a player’s army, but turning the formation into a vector also opens the door for using vector algebra to analyse and compare different lineups.

Defining the core units of a formation

From past research and in-game experience, it’s clear there’s some sort of meta (e.g., the widespread use of catapults + magic archers).

Note:  A “player meta” refers to certain strategies that the majority of players pick to achieve victory at a given time. In this article, the meta/player meta is the set of units that players choose most frequently for the best results.

A straightforward method is to take a simple average of all formation vectors. That won’t give us a perfect snapshot of the meta, but it’s a solid first approximation.

Beyond this core, players might include any units they happen to have. So we need a way to identify the units that appear the most in formations and then isolate them.

A straightforward method is to take a simple average of all formation vectors. That won’t give us a perfect snapshot of the meta, but it’s a solid first approximation.

By summing all formation vectors and then dividing by the total number of formations, we get the average formation vector, or what we can call the average formation.

Since the main formation core is just part of the total 49 units, we need to set a cutoff. Let’s say the “core” refers to 40 out of those 49 units. We chose 40 as an expert guess. Then we select the most common units until their total reaches 40.

This method assumes that the meta units – the ones players use most frequently – show up more often than non-meta units, so if we sort by the average number of units per formation, the meta units should rise to the top. This is how we get our approximate “average formation by hero.”

It’s important to remember this is still just an approximation. In practice, the meta might differ, but for a simple and understandable approach, defining a “conditional average formation by hero” works well enough for a first pass.

Visualising core units

In the previous step, we identified a core formation for each hero. However, in the real game, performance depends not only on which units are used but also on where they’re placed.

Since each unit in the game has unique offence and defence mechanics, each tends to have an ideal spot on the field where it can reach its full potential. So we need to convert our aggregated data back into a specific grid layout like `{Position 1: Unit A, …}`. A game designer familiar with the meta could do this manually, but let’s try to do it ourselves, placing the units algorithmically.

We’ll use a probabilistic method that places units as players would. Basically, we look at battle data to identify player behaviour patterns.

First, we find which cells each unit occupies most often. We can display this data as a 7x7 heat map, where each cell shows the share of all battles in which a unit appeared in that position (i.e., how many times the unit was in cell X, divided by how many battles that unit participated in).

We get something like this for each unit:

On the left, we see the Paladin, which usually goes in the front to buff surrounding units (and players generally don’t place two Paladins next to each other). On the right, we have catapults (major damage dealers but very fragile), typically placed on the fourth or fifth row, protected by other units.

Next, using these heat maps, we can place the units from our “average formation” onto the field. 

But there’s a snag if two units want the same cell. We’ll need some way to decide where each unit goes. For that, we can use something like the Hungarian algorithm.

Combining all these steps, we get the following pipeline for converting player formation data into ‘meta-build’ representations.

While this method finds a good arrangement, it doesn’t guarantee a perfect reflection of real player formations, because our heat map data might not be perfectly accurate. Also, the algorithm doesn’t try to make the formation symmetrical the way a real player might. But overall, it’s a decent approximation from a player’s perspective.

This algorithm is normally used to assign 'performers' to 'jobs' in a way that minimises cost. In our case, units are the performers, cells are the jobs, and the cost is how far each unit is placed from its most preferred spot (as indicated by our heatmap).

Although this algorithm does a good job of finding optimal positions, it doesn’t factor in the possibility that our average heatmap data isn’t truly ideal in every scenario. As a result, it can only approximate a real formation.

Combining all these steps, we get the following pipeline for converting player formation data into ‘meta-build’ representations.

Note: In actual gameplay, players often arrange their armies symmetrically or follow certain patterns, but the algorithm doesn’t strive for that. So the final layouts may not look very symmetrical, but overall, this method still provides a reasonable approximation of how a player might place units.

Finding formations similar to a meta-formation

After pinning down our “average” formations, we want to see how many actual player formations are close to that meta-formation. Converting everything into vectors comes in handy here as well. If we denote a formation by [a, b, c, d, …], where ‘a’ is how many of Unit A are present, ‘b’ is how many of Unit B, and so on, we can analyse similarity using vector methods.

We’ll get something like [0,0,5,1,0,0,0,6,…], which is a multidimensional vector that can be processed by vector models. 

If we imagine a simpler 3-unit setup, we’d have 3D vectors, which we can visualise more easily:

Once we represent each formation as a vector, finding the “closest” formation essentially boils down to finding the vector that’s closest. To do that, we can use cosine similarity, which tells us how similar two vectors are. In our case, it’s handy for defining similarities between formations.

Cosine similarity ranges from -1 to 1, where -1 indicates vectors that point in completely opposite directions, 0 means there’s no similarity, and 1 means they’re identical.

We calculate the cosine similarity for every pair of a player’s formation and each meta-formation. Then, by comparing these values, we can figure out which meta-build a given formation most closely matches.

Certainly, there are other methods that might be more efficient or yield more accurate results, but due to time constraints, I opted for this approach.

As you can see, the real player’s formation is pretty close to the one that is approximated by us. The placement of units can differ but the overall unit set is very similar.

By analysing how many player formations are similar to the average formation, I confirmed a bunch of hypotheses about the use of units by players.

By analysing how many player formations are similar to the average formation, I confirmed a bunch of hypotheses about the use of units by players. One of the interesting insights is that armies of one hero were very different from another hero’s armies. The units that were chosen by these players were countering the current meta of AoE damage by catapults. 

It would be interesting to monitor the dynamics of meta builds and seeing the adaptation of current game rules and meta by players.

Bonus: Clustering

Since we’re dealing with vectors, we could theoretically use clustering methods like k-means or others to identify meta-formations or find related builds. 

However, in a 36-dimensional space (one dimension for each of the 36 units), it’s extremely hard to verify whether those clusters actually make sense. In a 2D or 3D space, we can visualise the clusters and judge them more easily; with 36D, it’s impractical.

Also, bundling several formations into one cluster doesn’t necessarily ensure they’re truly similar in a meaningful way. Mathematically, vectors may be close to the cluster center, but the formations themselves could be very different.

For these reasons – and to avoid getting stuck on fine-tuning – I decided not to use clustering in this project.

Conclusions:

  • The analysis has shown that there is a clear meta in the game. Players focus heavily on certain units while ignoring others.
  • Armed with data-driven insights on primary player builds, we can adjust and balance less-popular units so the game becomes even more varied (and more fun).
  • We also gained a handy formation-analysis tool that lets us dive deeper into player behaviour.