[guide] Building Formulas

cheesasaurus

Guest
You can use the interface php to get info about units and buildings for each server. If you wanted the info for world 1:

building info: "http://us1.tribalwars.net/interface.php?func=get_building_info"
unit info: "http://us1.tribalwars.net/interface.php?func=get_unit_info"

You can also find it on the twstats website.
buildings: "http://us.twstats.com/us1/index.php?page=buildings"

timber cost of a building[wood]*[wood_factor]^([level of the building] - 1)
clay cost of a building[stone]*[stone_factor]^([level of the building] - 1)
iron cost of a building[iron]*[iron_factor]^([level of the building] - 1)
amount of villagers a building uses[pop]*[pop_factor]^(level of the building] - 1)
duration of creation, for lvl 1 and 2[build_time]*1.18*[build_time_factor]^(-13)
duration of creation, for lvl 3+[build_time]*1.18*[build_time_factor]^(level - 1 - 14/(level-1))


In the help page, if you look at the total points, you will see a pattern. Each successive level is worth about 1.2 times the points of the previous level. Knowing this, you can calculate how many points a building is worth.
Code:
points of a building = [points of the building at level 1]*1.2^([level of the building] - 1), rounded to the nearest integer
The amount of population a farm supports follows a similar pattern. Each successive level supports about 1.172103 times the population of the previous level (I'm not sure what the exact value the game uses is, but it's pretty darn close)
Code:
population the farm supports = 240*1.172103^([level of the farm] - 1), rounded to the nearest integer
similar thing for the warehouse
Code:
Capacity = 1000*1.2294934^([level of the warehouse] - 1), rounded to the nearest integer
and the timber camp, clay pit, and iron mine (except at level 0, they make 5 resources an hour):
Code:
production per hour = [30]*1.163118^([level of the building] - 1)
and the hiding place:
Code:
hidden resources = 150*(4/3)^([level of the hiding place] - 1)
and the wall:
Code:
factor for defending troops = 1.037^[level of the wall]
If the market is less than level 10, the number of merchants is equal to the market level.
If the market is level 10 or higher:
Code:
number of merchants = (market level - 10)^2 + 10

The time it takes for something to be built depends on the level of the building it's made in. All times are in seconds.

Buildings are constructed and expanded in the village headquarters. Multiply the duration of creation by the time factor of your village headquarters to get the actual amount of time it takes to make a building. The exact time factor is equal to 1.05^(-[level of the village headquarters])
Code:
actual build time = [duration of creation]*1.05^(-[level of the village headquarters])
Units are recruited in the barracks, stables, workshop, and academy. Multiply the build_time by the time factor of the building the unit's made in to get the actual amount of time it takes to recruit that unit. The exact time factor is equal to 2/3*1.06^(-[level of the building]).
Code:
actual build time of a unit = 2/3*[build_time]*1.06^(-[level of the building the unit is created in])
spear fighter - made in barracks
swordsman - made in barracks
axeman - made in barracks
archer - made in barracks
scout - made in stable
light cavalry - made in stable
mounted archer - made in stable
heavy cavalry - made in stable
ram - made in workshop
catapult - made in workshop
nobleman - made in academy

Research is done in the smithy. Multiply the duration of a research by the time factor of the smithy. The exact time factor is equal to 1.1^(-[level of the smithy]).

On a ten tech world, each successive research level takes 1.75 times the duration of the previous level. On a 3 tech world, each successive research level takes 3 times the duration of the previous level.

As far as I can tell, these are the research times for level 1 techs, without the smithy time modifier:
spear - 3960 seconds
sword - 5940 seconds
axe - 6930 seconds
archer - 3960 seconds
scout - 3960 seconds
lcav - 8910 seconds
m.archer - 9900 seconds
hcav - 9900 seconds
ram - 7910 seconds
catapult - 9900 seconds

The game speed is a setting that changes the durations (you can see what it's set to on the World Settings section of the statistics page. Multiply all research times by 1/[game speed].
 
Last edited by a moderator:

cheesasaurus

Guest
Version 8 changed the way construction times are determined. I just hadn't gotten around to updating this thread.

Every upgrade of the village headquarters causes buildings to be constructed 5% faster than before. That formula is still correct.

The change is this:

Code:
----Pre-Version 8----
duration of creation= [build_time]*[build_time_factor]^(level of the building] - 1)

----Post-Version 8----
duration of creation, for lvl 1 and 2 = [build_time]*1.18*[build_time_factor]^(-13)
duration of creation, for lvl 3+ = [build_time]*1.18*[build_time_factor]^(level - 1 - 14/(level-1))
Low-leveled buildings had their construction times drastically reduced, allowing the game to pick up speed earlier on and keep players engaged.

With this change, some low-leveled buildings like the rally point, academy, and church, which already had balanced construction times, would have been able to be constructed too quickly. So their base [build_time]s were increased, meaning there's little change in their actual construction times from version 7.
 

Vargard Obyron

New Member
Hi,

I've been doing a bit of excel on these formulas, but am not getting the same results as the running game for W64. I'm having trouble with the build times above level 3.

Any advice? I have applied the modifiers for the HQ levels.

Thanks in advance.
 

Sassenach

Guest
Thanks, guys. This is extremely helpful to a newb like myself.
 

AKZ123

New Member
Even though tribal wars is still on version 8, it seems the formulas has changed. Does anybody know what current formulas for build times are?
 

fiszu

New Member
Yes in config now is buildtime_formula = 2. Formula has been changed. I am waiting for a new formula