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?

**0**

# Formula for damage calibration RTS tower defence game

###
#1
Members - Reputation: **425**

Posted 30 January 2013 - 12:23 PM

###
#2
Members - Reputation: **325**

Posted 30 January 2013 - 09:02 PM

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.

###
#3
Members - Reputation: **425**

Posted 31 January 2013 - 07:05 AM

**Edited by GiroKa, 31 January 2013 - 07:09 AM.**