Sign in to follow this  
GiroKa

Formula for damage calibration RTS tower defence game

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 this post


Link to post
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 this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this