# How to calculate building cost with production per hour?

I know that it may not detailed thread title but I will give more detail about my question.

I'm working on a strategy game, and can't find a solution about building cost or training cost. I spent 1 week to calculate it but I can't find the formula. I kindly request help from experienced developers.

Here is the example:

Building Name: Quarry Building Time: 15 seconds Production per hour: 25 Stones

I give this building random building cost for Level 1; 20 Stones, 15 Timber, and 10 Iron.

First of all, I thought this: Quarry at Level 1 is producing 25 Stones for p/h, and in 24 hours 600 Stones.

How can I calculate to give building cost for upper levels of Quarry? Is there any formula or we can give random cost for it?

Thanks!

• What does "upper level" even mean? I assume you want the player to upgrade quarries. What does that actually do? And is there an alternative to upgrading, like building more quarries, or is the player limited to one? Dec 7, 2016 at 11:53
• I mean with "upper level" that Quarry can be updated from Level 1 to Level 20. Players are needs to upgrade the quarry to increase production. For example, Level 1 Quarry produces 25 Stones p/h and building time is 15 seconds. Level 2 Quarry produces 37 Stones p/h and building time is 30 seconds. Dec 7, 2016 at 11:56
• This is called balance. You have to figure out the right balance yourself. You can try a formula but this probably does not help out much since either you can upgrade too fast or it takes way too many resources for the final levels. You can try to look at some established games and find out that they usually balanced it by hand. I believe there is some formula at work on the original TW but I guess there is a reason why they left this design. Dec 7, 2016 at 17:18

There is no particular formula for this. You have to work it out on your own, based on what you feel is balanced - which relies on all other factors in your game, e.g. you don't mention whether the player can have multiple quarries at the same "location" (say town or city), or how many things you can build at the same time, so we can't possibly have any idea whether the player would do better to build say 4x level 1 quarries vs. 1x level 4 quarry... never mind the in-play impacts of the time constraints.

Why not just keep things simple since it is early days for your game: double the time cost for each upgrade level, while increasing the production capacity by 25% of the original figure each time? Then if you feel you want to change those figures, do that. Remember, that is a linear function. You can also go for a non-linear function, e.g. time cost = level squared.

In essence, as they say to writers who are suffering from writer's block - "just write something! anything!", you need to do the same here, and then improve the function/formula from there.

• Thank you for your suggestions. I will write something based on your suggestions. :) Best regards. Dec 7, 2016 at 12:56
• "Arbitrary" is an option, yes but I want to try something different. For example, there will be something to effects for building and production time. I guess this will be harder option to write. Because I don't know now that how can I put this mechanic for cost. I will try the easy way first. :) Dec 7, 2016 at 13:44
• @wolfaust. Sure. It's the nature of prototyping. Getting used to building formulae is just a fact of life for game developers. You're not the only one having to do this. You have to get your bearings before you can get the final thing right. Even (especially) building a physical machine for the first time works this way... it takes time. Game devs are inventors. Just like inventors, it's trial and error. What gets better over time, is how fast you iterate over that trial and error. Dec 7, 2016 at 14:35

You can budget.

I have defined the exact maximum of any resource anyone can produce for the game lifetime (if they play 24/7 for the server duration).

Any entity you have that produces and/or costs something is given a % of the whole or partial budget.

Then its simple matter of making a curve do distribute the production and cost between the levels of entities you have. If you use stuff like excel and you link in the core figures allowing you to re-iterate the economy within a few key presses.

Also, since people don't play 24/7 any loss of productivity is an opportunity to sell.

Eye balling it like many game designers do is the primary cause of uninspired and broken economies.

You need to have base idea of your pace to wrap mathematics around. Math is just a tool after all. It doesn't serve if there is no purpose.

Learning to budget early on helps you refine your idea of balance while working. Just shoving "whatever" placeholders in without keeping track of the economic concept usually ends up in re-coding things because unforeseen parts of the economy force you to make adjustment to the functionality.