# Damage-calculating formula for turn-based RPG with a twist: I have developed a formula, do you the experts think it will scale up successfully?

I’m developing a turn-based combat system for an RPG. It’s a little different to your standard RPG though. The idea being, the faster the player solves the problem they are presented with each time it's their turn to attack, the stronger their attack is. I have come up with a very simple formula for this and have gone through examples at different levels to test scalability and it seems OK.

I just wanted to show the experts here and see if anyone could spot any issues with this formula for scalability or anything else I haven’t thought of. I also did some research online but couldn’t see examples of a similar model, though I did find more typical examples of damage calculating formulas.

For the game I am making, the input for the damage done is based on 2 things: there will be 20 seconds to answer a question, so the time taken to answer it is one factor; and, the level of the player. All decimal answers to this formula are rounded up to determine the damage and if you go over the time you miss your attack. The formula looks like this:

Damage = (20 - time taken) x level

Level in this will be counted through decimal points. Here are some examples:

Level 1: we would input 1.1 into the formula

Level 5: 1.5

Level 10: 2

Level 13: 2.3

Level 37: 4.7 ….etc.

Examples

If a player takes 8 seconds to answer the question and is level five, the formula works like this:

(20 - 8) x 1.5 = 18

The character would inflict 18hp damage.

If they were level 10 and answered in 12 seconds:

(20 - 12) x 2 = 16

The character would inflict 12hp damage.

If the player were level 29 and answered in 17 seconds:

(20 - 17) x 3.9 = 11.7 = 12

The character would inflict 12hp damage.

What do you all think? Any feedback is very welcome. Thank you for reading.

• The damage formula is only one part of the equation. In order to determine whether it scales appropriately for your goals, we need to know what those goals are, and what opposition this formula will be standing against. What are the signs you would look for to judge that this formula is performing as desired, and what are the signs of trouble that would go against your intended play experience? Jul 29, 2020 at 11:38
• Hi DMGregory, thanks for your response. I think success and failure are appropriate level of challenge for both skilled players and unskilled players, but hopefully the timed element will cater for that. PLus, I'm thinking that the enemy's attack strength will depend on the strength of the player's as well as a random strong attack. The game mechanics are going to be super simple, so this formula won't need to be adjusted with the addition of weapons/items that would increase strength or things like that. I suppose my question was more mathematical, as I'm not very confident in that area. Jul 30, 2020 at 3:38

I don't see anything explicitly wrong with it, as in the end, it all depends on you - how far are you willing to make adjustments (to the design). I would, however, from experience with scaling up the damage formula across 500 levels, recommend the following:

• Before you write a single line of code, do all computations in Excel/OpenOffice - you do not want to figure out scaling issues after half day of debugging - excel will allow you to see them within 10 minutes.
• have various tabs for various formulas (you will end up with many, which is fine - that's the fun part of experimenting)
• Any time you hit a limit relevant to your game (HP, level, whatever) - explicitly break the table, and put comments right below the row where it happens so you don't forget it once you start implementing it
• no player will figure out that your progression tree is hardcoded to the initial values. You can't beat the math, and the last thing you want is to introduce dozen conditions in code that will make it an undebuggable mess. Once the gameplay starts to change too much due to high values, just end the game there (assuming you adjusted experience progression in excel first).

Case in the point - Mass Effect 1. I just replayed it twice last week. They literally get away with simple linear scaling of experience points. Whether you are level 7 or 47, you still get level upgrade for same amount of activities done (even though the game makes it look like you need to get 10x more experience, but you don't really).

• Thanks for that. That's very helpful. I'm currently going through tutorials on Excel formulas after your advice and am learning a lot. I was just wondering if there was any particular way to run these formulas to find the limits of the formula, as per your 3rd point? At the minute I've just put in my formula and am putting in values now myself in the same cells, replacing them each time, but I wonder is there a way to set it to run all the calculations itself and list them all down the rows so I can look through all of them? Jul 29, 2020 at 9:23
• If you know of any resources I can learn from, or even just the name of this type of calculation so I can google it myself, please let me know. Thanks again 3D Coder! Jul 29, 2020 at 9:26
• Wait, you only computed one row ? No, the whole point of using Excel for this exercise is that you copy paste the first line 500 times and see, row by row, exactly what values you get per each Level, how it scales (without painful and tedious debugging), and see where exactly you might run into issues (because certain parameters will become too large). You try to cram as many variables into first row as you need, so you might have up to 25 columns (or more, if you need them). But you only do the work for very first row, then simply copy the row into as many rows as you want. Jul 29, 2020 at 16:39
• I learnt Excel 25 years ago from Help and by experimenting. I'm pretty sure that these days, there will be thousands of tutorials on youtube. You really only need to search for "create tables" and this should be enough. I actually use OpenOffice Calc now, it's free and open-source. Jul 29, 2020 at 16:42
• Thank you very much! I just wasn't sure what the process was called or entailed, so now I know I can research how to do it. I can see that I just copy and paste it all and only change the level to deduce if at any point it has any problems with that. Thanks again 3D Coder. Jul 30, 2020 at 3:30