# Formula for damage calibration RTS tower defence game

This topic is 2180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Trying to establish a formula to figure out how many enemies should I load per level?

Variables:
Total Game time (sec)
Tower DPS
Tower Range
Enemy HP

Time Tower deployed (sec) = total Game time - Avrg Deployment time for all Tower.

Percent of Map in range = Total range area X 100 / total Level surface.

Actual Total Tower DPS = Total Tower DPS X Percent of Map in range.

Total HP for all enemy = Time Tower Deployed (sec) X Actual total Tower DPS

This does not take into account overkills so an arbitrary multiplier value should be added … .

Am I overthinking this?

##### Share on other sites

It looks like you've mostly got it figured out. However, there are some things you might want to tweak just a bit:

• You might want to calculate actual tower DPS for each tower individually, then just add all the values up to get the total DPS.
• This will help to account for issues such as overlap between towers' ranges.
• It will also remove the need to calculate the total map area that's within range of your defenses.
• Using fractional numbers is easier mathematically than using percentages because you can avoid having to constantly multiply and divide by 100. For example, instead of 50%, use 0.5.
• Since no defense setup is perfectly efficient, having some extra padding between the total enemy HP and the maximum theoretical damage is important; much of the time, enemies will be out of range. Multiplying each tower's DPS by the fraction of the field's area that's within its range (which is basically what you were doing for the DPS calculation, but see the above point) fixes most of this issue quite nicely, but random variation in the enemies' formations can still cut the towers' efficiency below the theoretical maximum, leading to a potentially overpowered wave.
• Adding some types of random  and/or periodic variation to the enemies' power level could create an ebb and flow of tension that will make the game more engaging to the player.

Overall, it looks like you're off to a good start. Once you've implemented the algorithm, you'll probably see things you'd like to tweak; in fact, most of the tuning for this type of algorithm will involve playing with different formulas and values. It's hard to predict how humans' skill level will affect the game, but enough tweaking can give a system that generally works pretty well.

##### Share on other sites
Thank for you for your answer I have started implementing the algorithm in a quick and dirty simulation program and I’ll be tweaking it along because like you said user behavior is tough to predict. The game level engine is built with triggers based on user behavior to keep the future gamers on their toes, so it makes each game level a slightly different experience for each player depending on their approach. Which make the algorithm a little more tricking. But it’s looking good so far. Thanks again. Edited by GiroKa

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 27
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634102
• Total Posts
3015531
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!