Tech Tree test script

Discuss the future of Warzone 2100 with us.
Post Reply
MIH-XTC
Trained
Trained
Posts: 345
Joined: 31 Jan 2014, 07:06

Tech Tree test script

Post by MIH-XTC » 24 Aug 2019, 18:27

I wrote a tech tree calculator that
- Calculates total research time
- Checks if any items are unresearchable
- Ratio of researchPower to researchPoints

I couldn't get the tech-tree-chart-generator script to work but I don't think it calculates total research time, just visualizes the dependencies.

I uploaded it to my Github

Maybe I can attempt to make a pull request to add it to the Warzone tools dir. I don't know Git that well and it would be a good exercise for me to accomplish. Part of the reason I'm working on this stuff is to gain familiarity with Git. Uploading files with commits is easy but integrating and working with others is ???

EDIT:

I'm unable to verify the calculations, it appears WZ is not calculating research times properly...

For example, in T1 full base a player can research the first armor upgrade R-Vehicle-Metals01 that has 1800 researchPoints and it takes 85 seconds to research.

1800/85 = ~21 and this makes sense because the research module has 7 researchPoints and a research facility has 14.

Everything is fine so far...

But then when I research the first research upgrade R-Struc-Research-Upgrade01, the research time for R-Vehicle-Metals01 goes from 85 seconds --> 69 seconds which implies 1800/69 = ~26

How does a research center go from 21 researchPoints to 26 if all research upgrades increase research rate by 30 or 30%???? (21*1.3 = 27 not 26)

Even though all research upgrades increase research by 30 or 30% it would appear as if they're actually increasing by 25% based on the actual research times

To clarify, R-Vehicle-Metals01 takes:

85 seconds with research center and module (1800/85 = 21)
69 seconds with research center and first upgrade (1800/69 = 26)
56 seconds with research center and second upgrade (1800/56 = 32)
49 seconds with research center and third upgrade (1800/49 = 36)

but

21 * .3 = 27
21 * .3 + 27 = 33
21 * .3 + 33 = 40

so it doesn't appear the research upgrade values of 30 are actually 30%....

User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 812
Joined: 26 Sep 2016, 19:56

Re: Tech Tree test script

Post by Berserk Cyborg » 27 Aug 2019, 02:37

This is due to some confusion with how Warzone's upgrade logic works.

upgrade_value += ceil(base_value * change_value / 100) <=== as taken from rules.js's eventResearched.

Code: Select all

The research facility base value is 14.
14 += ceil(14 x 30 / 100)
14 += ceil(14 x 0.3)
14 += ceil(4.2)
14 += 5
19
...
19 += ceil(14 x 30 / 100)
19 += ceil(14 x 0.3)
19 += ceil(4.2)
19 += 5
24
So each research upgrade adds 5 points (all add 30%) to the final upgrade value. If there is a module on the facility, then a bonus constant of 7 points are added as a final step (which does not factor into the above equation, to be clear).

Code: Select all

14 [21 with module] - base
19 [26] - 1st
24 [31] - 2nd
29 [36] - 3rd
34 [41] - 4th
39 [46] - 5th
44 [51] - 6th
49 [56] - 7th
54 [61] - 8th
59 [66] - 9th
...
And, assuming a module is on the facility, this should be about how many seconds it should take to research the first kinetic alloy upgrade:

Code: Select all

1800 / 21 = 85 seconds
1800 / 26 = 69
1800 / 31 = 58
1800 / 36 = 50
1800 / 41 = 43
1800 / 46 = 39
1800 / 51 = 35
1800 / 56 = 32
1800 / 61 = 29
1800 / 66 = 27
:lecture:

MIH-XTC
Trained
Trained
Posts: 345
Joined: 31 Jan 2014, 07:06

Re: Tech Tree test script

Post by MIH-XTC » 27 Aug 2019, 17:27

lmao, dude... that's exactly how I thought it worked minus the ceil() part lol. I also didn't know this was in rules.js, I thought it was all in stats.cpp

I tried round() but it didn't make sense and I never thought to try ceil()

Alrighty, so I updated the script but I still have slightly different results than the betaguide. Betaguide says dragon takes 81 minutes but I came up with 79. I did verify though that dragon takes 834 seconds with max upgrades and that is the same results I got.

Crab took into consideration things like the amount of time to actually build the research center so it might be a little different.Anyways, I'm not too concerned with it. I needed a way to check if everything is researchable and the results.txt accomplishes that.

This is a print() statement output from what I came up with

Code: Select all

R-Struc-Research-Module  {'points': 4200, 'upgrade': 21, 'seconds': 300.0}
R-Struc-Research-Upgrade01  {'points': 5400, 'upgrade': 26, 'seconds': 357.14285714285717}
R-Struc-Research-Upgrade02  {'points': 7800, 'upgrade': 31, 'seconds': 449.4505494505495}
R-Struc-Research-Upgrade03  {'points': 11400, 'upgrade': 36, 'seconds': 565.579581708614}
R-Struc-Research-Upgrade04  {'points': 16200, 'upgrade': 41, 'seconds': 698.9129150419474}
R-Struc-Research-Upgrade05  {'points': 22200, 'upgrade': 46, 'seconds': 845.2543784565815}
R-Struc-Research-Upgrade06  {'points': 30200, 'upgrade': 51, 'seconds': 1019.1674219348424}
R-Struc-Research-Upgrade07  {'points': 40200, 'upgrade': 56, 'seconds': 1215.2458533073914}
R-Struc-Research-Upgrade08  {'points': 52200, 'upgrade': 61, 'seconds': 1429.5315675931056}
R-Struc-Research-Upgrade09  {'points': 66200, 'upgrade': 66, 'seconds': 1659.039764314417}

User avatar
Terminator
Regular
Regular
Posts: 1066
Joined: 05 Aug 2006, 13:46
Location: Ukraine
Contact:

Re: Tech Tree test script

Post by Terminator » 27 Aug 2019, 20:28

script is good, but there is something similar at http://betaguide.wz2100.net/Research.php?timeline=1

try to add your calculator to official guide, if its better.
Death is the only way out... sh*t Happens !

Russian-speaking Social network Group http://vk.com/warzone2100

MIH-XTC
Trained
Trained
Posts: 345
Joined: 31 Jan 2014, 07:06

Re: Tech Tree test script

Post by MIH-XTC » 27 Aug 2019, 23:03

Terminator wrote:
27 Aug 2019, 20:28
script is good, but there is something similar at http://betaguide.wz2100.net/Research.php?timeline=1

try to add your calculator to official guide, if its better.
Yea I'm familiar with the betaguide. I think Crab_ wrote the tech tree aspects of the betaguide if not the entire betaguide itself.

This script is for developers that are trying to modify the tech tree so they understand the implications. For example, I modded the tech tree by adding new items and I need a way to verify that each item is researchable and what the arrival time is. Also, if I change the research upgrade values I can verify by how much it impacts everything. The betaguide is geared more towards players and visitors whereas this script is aimed at developers that want to mod the tech tree. It's not intended to replace betaguide.

Post Reply