Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
Featured Blog | This community-written post highlights the best of what the game industry has to offer. Read more like it on the Game Developer Blogs or learn how to Submit Your Own Blog Post
This article is devoted to the principles we used in order to calculate the balance in our tower defense game – Goal Defense.
Goal Defense was released in summer 2012 for iOS and Android.
We will number the difficulties we had to face and what was the ground for making this or that decision.
But first a few words about the game:
Goal Defense reached top6 and top7 of its categories in the US App Store;
We received a letter from Apple, saying that they were considering us for featuring;
Goal Defense was downloaded 425 000 times;
Its average rating is 5 stars;
The game has got tons of positive comments;
Goal Defense was reviewed by the most prominent editions in the industry: 148apps.com, appadvice.com, knowyourmobile.com etc.
Terms
Bowl (base) – an object to defend from enemies;
Creep – an enemy, aiming at conquering the base. In most cases it can’t attack turrets.
Turret – a fixed unit, placed by a player; impacts the enemies from some distance.
Wave – a few enemies, moving one after another at some distance. There’s a rather long pause between the waves when a player can place/upgrade the turrets and analyze the strategic situation on the field.
Tile – a cell of the field in the form of a hex. The maps, based on this figure are visually attractive. That was the main reason we chose it.
HP – creeps' health points. They are taken way when the creeps are attacked by the turrets.
An approach to calculation
The peculiarity of the genre defines that both the creeps and the turrets have a rather plain AI. Moreover, the turrets mustn’t move. These factors simplify the development of the game and thus, even in the frames of the limited functionality one can design an intricate and fascinating gameplay.
Let’s examine the frames the specifications Goal Defense had to fit in.
Each level has at least one walk-through algorithm.
A player should think thoroughly to win the game. This fact defines the sophistication of the game, in other words, how many times during the game and at which points a player has to make the right decision (sometimes doing nothing can also be the right decision).
On the other hand, the Balance can be defined as the value combination of all game turrets. Consequently, in case when a level can be won with only 1-2 types of turrets out of 10 the balance does leave much to be desired. The same way, a player’s tactics and strategy must depend on the map of the field and the types of enemies coming out on the ground.
In Goal Defense we faced a restriction of a hexagonal field of 14x7 tiles by the size with no scroll. These parameters influence the process of placement of the sportsmen. The focus of the game moves from “jamming” the field to “choosing wisely” the position of n-number of turrets. To make an example, now a player doesn’t have to build a fortress, but to define the position of the field players before the match.
Basic creep and basic turret
At the beginning of the game when the field is empty, the length of a creep’s route from the entrance point to the Bowl should be about 20 tiles.
We decided the speed of the creep should be 0.8 tiles/sec.
The radius and the speed of attack of the basic turret should guarantee the success of its attack on a single creep in the empty field.
The creep moving straight forward will be within the radius of the attack of a turret for 3-3.5 tiles of his way to the Bowl. Thus if we take the damage of the basic missile for 10, we can find the unit HP that will suit the constraints.
We get:
3.25 tiles/0.8 tiles a second = 4 seconds – the time a turret needs to make 8 shots and bring 80 HP of damage.
Consequently, the creep should have no more than 80 HP. Now in Goal Defense the HP=75 (it will take not less than 8 shots, but the player will be very upset to see a half alive creep with only 5HP getting to the Bowl and taking its lives away). Thus if the creeps come onto the field every 4 seconds, they can be destroyed with a single tower.
The balance of waves and game economy
The amount of the ingame currency (profit) the player gets from winning the previous wave should be enough to place/upgrade new turrets and beat off the next wave.
The player has to place new turrets every 1-2 waves. If the player manages to do without new assets, the balance is poor.
The sophistication of the level should mount up by its end to secure there’s no excess of the resources by the beginning of the next level.
The complexity of the choice of different variants of actions (where to place the tower, whether to upgrade the old one or to place a new one) should also rise up by the end of the level.
There’s always a moment when a player has exhausted all resources and opportunities for sportsmen placement/upgrade. Such a situation denotes that the player has reached the level maximum thought hasn’t managed to finish the game yet. In the best case scenario the level should be completed when the field is full for 60-70%.
The variants of the “devolution” of the situation on the field
The player has filled the field with players and has no vacant spots any more. This may happen either if the turrets are too cheap, or the field is too small. I’ve already mentioned, that the field is 14x7 tiles by size, so you should always keep this in mind.
The point above may result in the next: the player’s move can be predicted a few steps before. This is usually the case when the enemies come onto the field from one entrance point and there are no any obstacles on the field, in other words it’s absolutely open. The best strategy in this case would be to place the sportsman in jigsaw. Though in most cases this situation depends on level design than on the basic balance.
Unevenness of the profit. A situation is possible when placing a certain number of sportsmen in the “right” positions a player starts earning enough ingame currency to easily beat off the following waves. Why does this happen and how we deal with it, we’ll discuss in this article a bit later.
How to calculate the number of the creeps in the wave
In the ideal situation the wave of creeps would move along the row in a straight line. Let’s calculate how many creeps the turrets would have to destroy taking in account the speed of the first and the length of the route.
Basic postulates
Here are the main conditions:
With the attack radius, determined in the game, a single creep can be attacked by 3-3.5 turrets.
The speed of the attack of the turrets: 2 shots/sec, the damage – 10 points per shot,
HP of a creep – 75 (which means that he can survive 8 shots), the speed of the creep – 0.8 tiles/sec.
The creeps come in waves that have predetermined length. The latter determines by how many turrets the wave can be attacked simultaneously. The elongation of the wave length for a tile adds 1 sportsmen to the number of sportsmen.
The creeps come in waves of certain length and thus can be attacked by as many turrets as the length allows it. If we lengthen the wave for a tile, an additional turret can be placed.
The length of the wave can be calculates as N*dt*v, where N is the number of creeps, dt is the pause before the next creep appears on the field and v is the speed of the creep.
With dt equal to 0.5 (that’s the shortest pause possible to assure the creeps are separate from each other), with v equal to 0.8 tiles/sec and predetermined number of turrets we can find the duration of the attack of the turrets. To do this we have to divide the part of the route under the attack by the speed of the creeps. If we, on the contrary, multiply these parameters, we’ll find the total damage to the wave.
Let’s make an inequation:
H – the health of a creep in shots of a certain tower
K – the number of shots in second for a certain tower
L – the length of the route of the creeps under the attack
V and N – the speed and the number of creeps
For a basic turret and a basic creep we get:
(3+N*dt*v)*K*L/v>=N*h;
With the following value of the variables:
K=2; v=0.8; dt=0.5; h=8;
We get an intermediate result:
L*(7.5+2*N*dt)>=8*N;
If we take dt=0.5 and round of 7.5 to 8 (as the turrets can do more, than 3 tiles).
We will get:
(8+N)*L>=8*N
So, if the length of the route under the attack is more than 8 tiles, all the creeps will be destroyed regardless of their number. Thus, this formula will help us calculate how many creeps should be there in a wave in case of a route of a certain length.
Moreover, the number of creeps in a wave should be balanced to let a player get profit enough only to place 1-2 additional turrets, but not to overbuild the field.
User behavior
A player usually manipulates the turrets between waves. If there are 20 waves, a player will rearrange his team 20 times. Each time upgrading/selling/placing them.
But how many turrets can he place on the field without a scroll? If you remember, the size of the field is 14x6-7 tiles. Thus we get 14*6.5=91 tiles.
Let’s adopt the convention that the enemies’ entrance point is a single tile in the corner, opposite to the player’s base. If a player wants to lengthen the enemies’ route to have them under the attack longer, he will have to place 30 sportsmen as a minimum and 48 as a maximum. This will increase the length of the route up to 40-45 tiles.
With the speed of 0.8 tiles/sec. a route of 43 tiles will be covered by a single creep in 55 seconds and by a wave – in a minute. Taking into the account the fact that an average wave will cover that same distance in 30-40 seconds, we can find the game session time: 20 waves will take about 10-15 minutes (without speeding up) at some difficult levels. But in our experience, an intense and dramatic level can be created with just 10-11 waves. And, what is more important, a player won’t lose his enthusiasm and will be willing to restart a level even after a failure.
Here I want to remind you that if the length of the route is more than 8 tiles, basic creeps will never get to the base no matter what their amount is. So we need to find the HP creeps need to have in order to approach to the base in a wave.
Let’s get back to the previous formula:
(8+N)*L>=h*N
If the length of the route is 40, creeps’ HP should be at least 40*10=400, so that the turrets could not destroy them all no matter how many creeps there are in the wave. But 400 is 5 times more than that of a basic creep, which practically means that he has to outstay 40 blows from a basic tower.
(8+N)*40>=h*N
320+40N>=h*N
As h=50, we get:
320>=10*N, N<=32
With such N (the number of creeps in a wave) turrets won’t be able to destroy all creeps.
Taking in the account that the calculation was done for the basic turrets priced at 60 coins, we can find how much money a user has to earn (plus the balance at the start) in order to build a defense line (if you remember, it takes about 30 turrets). And thus we see that a user will need 1800 coins for 20 waves.
The calculation of first waves
At the beginning of the level the player gets enough money to place 3 turrets (thus the length of the route under the attack is 4 on average. If you remember, the full length under the attack is 6, but 3 turrets at once can’t reach all of its tiles). Then the number of creeps in the first wave should be
(8+N)*4>=8*N
32>4N, N<8
Where dt=0.5 sec.
This way each creep will bring not less than 5-6 coins so that after the first wave a player had enough money to buy a basic turretor an upgrade.
Knowing how much money a player will have by the end of the first wave, we can calculate the total damage the turrets of the second level can bring on AND find the number of creeps in the second wave. There definitely should be diverse types of creeps, turrets, but that’s the topic for my next article.
Read more about:
Featured BlogsYou May Also Like