Resource icon

Utility: TechCalc 2.01

Grey Fox

Master of Points
Joined
Dec 19, 2001
Messages
8,726
Location
Sweden
This program is based on mydisease's Tech Research Formula he posted in the Civ3 General Discussion forum. Here!

TechCalc 2.01
For all versions of Civilization III. (Patched versions).

Here's a preview
1709019742856.png


***********************************
TechCalc Readme VERSION 2.0
Programmer: Grey Fox, AKA Fredrik Henriksson
Formula: mydisease
This is a free program and I hope you enjoy it!

***********************************
This is a program that calculates your tech cost
based on various factors:
- Which tech you are researching.
- Map Size.
- Difficulty.
- Number of Civs that you have contact with that has the tech.
(Including you if you have the tech. Can be checked in the Diplomacy Screen)
- Number of Civs left (including YOU!)
- Gold already invested.

Turns left on the technology is based on:
- The Tech cost
- Beakers per turn. (Gold into Science, check in F1 screen in Civ3)
- and Gold already invested.
------------------------------------------------------------
Thanks to:
- mydisease for figuring out the Tech Cost formula!
- anarres for helping me with some problems and suggesting features!
- kring, for noticing that v.1.01 didn't have an icon.
- vbraun for suggesting the Gold Lost feature!
- and everyone that has downloaded the program so far (Although I don't know how many) and to those that will download it in the future. That is my reward, that people uses my program and appreciate it.

------------------------------------------------------------
Revisions
------------------------------------------------------------
Additions v.2.01
- Added a button for adding the Beakers Per Turn to the Gold Invested edit box.

Fixes v.2.01
- Fixed the rounding problems with the Turns Left.
- Fixed some rounding problems with the Combat Calculator and some other issues.
----------------------------------------------------------
Additions v.2.0
- Program reprogrammed from the foundation up.
- Ability to load textfiles with the Tech Names and costs (which makes it possible to change the use of the program, to use it with a mod, Scenario, Conquest, or another version of the game).
- A Combat Calculator, with everything needed to be useful. :)
- A simple *regular* calculator, that can add, subtract, multiply and divide.
- An area where you can keep short notes.
- You can now see how much gold that will be lost.
- You can now enter how many turns you've researched.
------------------------------------------------------------
Additions v1.5
- Added Function to calculate Turns left.
- Added a "Gold Invested" edit box.
- Added a new icon.

Changes v1.5
- Changed the integer limit on "Nr. of Civs left" and "Nr. of Civs with tech" to 31, from 32.
- Changed the interface to fit with the new features.
- Removed the Static Dll file from the .exe-file. (The file only takes about 35 kb now)

Fixes v1.5
- Fixed the TechCost calculation formula. It should work almost perfect now.
- Fixed the Invisible-Icon bug.
------------------------------------------------------------
Additions v1.01
- Added human error check on number insertions.

Changes v1.01
- Changed the interface just a little.

Fixes v1.01
- Fixed the Tech List.
- Fixed the Formula Rounding errors.
------------------------------------------------------------

Please report bugs etc in this thread.
Suggestions on improvements are always welcome.

UPDATED: December 16th - 2003
This file is 19.5 kb

TechCalc v2.01

This file is 453 kb
mfc42.dll - needed for those who can't run the program
 
Last edited by a moderator:
Excellent :goodjob:

@Toasty, I think it tells you the total cost of a tech. If you want to know number of turns left (as I think you do), then it would need also the exact number of beakers collected so far. The only way to do this is from the savefile, but this is not the intended useage methinks.
 
GreyFox, this is excellent. I appreciate the work you have done - I was considering something similar myself as I could never be bothered to work out the numbers by hand and was using a spreadsheet.
 
Thank you Grey Fox.
 
Grey Fox, have you been taking programming lessons from the Firaxian "Play The World" School of Programming? I am no programmer but I can infer the following errors from the results your program gives:

1. There is a hole in the first half of the tech tree in the middle ages. The missing techs being (after Construction) Monotheism, Feudalism, Engineering, Theology, Chivalry, Invention, Printing Press, Music Theory, Education, Gunpowder, Banking (then Astronomy). However, the techs named after Construction refer to the tech costs of all the techs in the correct order so all the actual costs are offset by 11 backwards (after Construction, before then they are fine).

2. All costs for Monarch are noticeably too low and costs for Deity sligthly too low. The inverse of both of these cost factors (ie. 1/9 and 1/6) gives recurring roots so I suspect that the error will be due to rounding done by the computer at too early a stage. I know little about programming but can you not do it so the program works outwards from the most internal bracket and this way avoid rounding at this point.

3. Devaluation rate is not working properly, this being especially noticeable for very early techs. As no. of civs that know the tech increases, cost should decrease in a fairly linear manner, but in fact your program gives big drops. I think the most internal bracket(or is it the most infernal bracket;)) is rounding up to the nearest 1 rather than the nearest .1 and this is causing the problem. Mathematically this part of the formula is better expressed:

.1 * ROUNDUP[10 * COST * N/ROUNDDOWN(CL * 1.75)]

Where ROUNDUP and ROUNDDOWN is to the next integer.

I think the devaluation when other civs have the tech isn't working correctly even taking this into account.

4. No. of civs with tech cannot be bigger than no. of civs left. You might want to put an internal check to make sure this is the case before calculating.

5. By giving no. of civs left a range of 1 to 31 (rather than 1 to 16) you are hypothesising that the formula I found for 1.29f is also true for Play The World. It may well be the case, but bear in mind that nobody has tested this hypothesis and I don't have Play The World and so can't test it.

6. You write "Nr.", bravely defying the general consensus of "No.". Ah well, its a free country.

7. Its two megs! That's 2/3rds the size of the civ3 executable!

Sorry if all that was a bit critical.
 
Originally posted by mydisease
4. No. of civs with tech cannot be bigger than no. of civs left. You might want to put an internal check to make sure this is the case before calculating.

7. Its two megs! That's 2/3rds the size of the civ3 executable!
Not that GreyFox needs me, but I can answer these:

4. When I tried putting a greater number of civs with the tech than is in the game, it gave me '0' as an answer. This seems appropriate action in this case. A different logic on the form would make it harder to use.

7. It has a static DLL built in. This is to ensure that if you don't have the DLL used by GreyFox on your machine it will still work anyway as the necessary parts of the DLL are incorperated in to the file. A smaller version could be built, but then you may not be able to use it. Otherwise complain to micro$oft ;)

I'm looking forward to the technical issues being resolved as well, I hadn't reached that far in techs in my game yet :).

Edit: anarres learns to spell :rolleyes:
 
Originally posted by mydisease
Grey Fox, have you been taking programming lessons from the Firaxian "Play The World" School of Programming?
Hehe, :lol: I'm not perfect :p
1. There is a hole in the first half of the tech tree in the middle ages. The missing techs being (after Construction) Monotheism, Feudalism, Engineering, Theology, Chivalry, Invention, Printing Press, Music Theory, Education, Gunpowder, Banking (then Astronomy). However, the techs named after Construction refer to the tech costs of all the techs in the correct order so all the actual costs are offset by 11 backwards (after Construction, before then they are fine).
Oops, sorry... copy/paste error here...

2. All costs for Monarch are noticeably too low and costs for Deity sligthly too low. The inverse of both of these cost factors (ie. 1/9 and 1/6) gives recurring roots so I suspect that the error will be due to rounding done by the computer at too early a stage. I know little about programming but can you not do it so the program works outwards from the most internal bracket and this way avoid rounding at this point.
I am working outwards, from the most inner bracket. Check next qoute.

3. Devaluation rate is not working properly, this being especially noticeable for very early techs. As no. of civs that know the tech increases, cost should decrease in a fairly linear manner, but in fact your program gives big drops. I think the most internal bracket(or is it the most infernal bracket;)) is rounding up to the nearest 1 rather than the nearest .1 and this is causing the problem. Mathematically this part of the formula is better expressed:

.1 * ROUNDUP[10 * COST * N/ROUNDDOWN(CL * 1.75)]

Where ROUNDUP and ROUNDDOWN is to the next integer.

I think the devaluation when other civs have the tech isn't working correctly even taking this into account.
Yes, the devaluation error is because I totally left out the .1 in the 2nd rounding. The reason for that is because I had no Idea how to implement it.

4. No. of civs with tech cannot be bigger than no. of civs left. You might want to put an internal check to make sure this is the case before calculating.
Can't number of civs that have the tech be bigger then nr of rivals left, by 1? (because you could do the check you everyone have the tech, including you :) for whatever the reason :p)

and yes, I was too lazy to implement a check... :p

5. By giving no. of civs left a range of 1 to 31 (rather than 1 to 16) you are hypothesising that the formula I found for 1.29f is also true for Play The World. It may well be the case, but bear in mind that nobody has tested this hypothesis and I don't have Play The World and so can't test it.
Sorry, the range of civs left should be 32. This is because you can play with up to 31 Rivals in PTW (and 24 in Civ3), so if you play with that many you should be able to use the program. And yes I think it will work for PTW, and if it doesn't... well so be it.

6. You write "Nr.", bravely defying the general consensus of "No.". Ah well, its a free country.
Yes I'm brave! :)
No, sorry I forgot. It's "Nr." in swedish, and I'm swede... Will change that immediatelly.

7. Its two megs! That's 2/3rds the size of the civ3 executable!
Yep I know... that's because a static library is included which might not be needed in some windows versions, but most probably in the 9x versions... but I will make the next version without it, and we'll see. (I really included it by mistake, but if Mac users can use the file because of it, it's nice having it included...)

Sorry if all that was a bit critical.
No, don't be sorry.

The reason to why I released the program was to get feedback from mainly you. Especially about if the formula worked as I did it.

Well Thank you! :D

I will get right on the bugfixing!
 
Originally posted by mydisease
Mathematically this part of the formula is better expressed:

.1 * ROUNDUP[10 * COST * N/ROUNDDOWN(CL * 1.75)]

Where ROUNDUP and ROUNDDOWN is to the next integer.
So, should I use that instead of:

ResearchCost = Down((MM/CF)*(Cost-Up.1(Cost*N/Down(CL*1.75))))

??
 
Ok, I think I fixed all bugs and errors now (exept the static dll).

I got one question to you mydisease.

This part of the formula = Up.1, does that mean that 1.45121 should be rounded to 1.5?
 
Originally posted by Grey Fox
Can't number of civs that have the tech be bigger then nr of rivals left, by 1? (because you could do the check you everyone have the tech, including you :) for whatever the reason :p)

and yes, I was too lazy to implement a check... :p

I think you misunderstand the civs left(CL) bit of the formula. This means the number of civs left INCLUDING your civ, NOT the number of rivals. And hence number of civs that have the tech can only equal number of civs left if every civ including you has the tech.

Originally posted by Grey Fox
This part of the formula = Up.1, does that mean that 1.45121 should be rounded to 1.5?

Yes, that's exactly it. So try:

ResearchCost = ROUNDDOWN((MM/CF) * (Cost - (.1 * ROUNDUP(10 * COST * N/ROUNDDOWN(CL * 1.75)))))

In fact, I might change the formula to this. It works out the same and its less ambiguous. Though my maths teacher would kill me if he saw all those round brackets;).

And I was only joking about "no.", actually I kind of like "nr." better.
 
Originally posted by mydisease
I think you misunderstand the civs left(CL) bit of the formula. This means the number of civs left INCLUDING your civ, NOT the number of rivals. And hence number of civs that have the tech can only equal number of civs left if every civ including you has the tech.

Though, in fact, I'm being an idiot on this one and you are right no. of civs with the tech can be bigger than no. of rivals by 1.

And quoting myself:eek: .uuurgh
 
Originally posted by mydisease


Though, in fact, I'm being an idiot on this one and you are right no. of civs with the tech can be bigger than no. of rivals by 1.
You'r sure?

I'm done with the formula now. All roundings are in, and it's based on your first formula, not the new one you posted here.

I justed checked it in game. It seems to work quite nice when I included my own civ in the Nr. of rivals left edit box.
 
I'm sorry, CivFanatics.net doesn't work at the moment.

So I can't upload the newest version.

I will upload it to my own server, temporarily.


EDIT: Updated the first post with a new url to the newest version. Beta 1.01.
 
It works well for me, but I should try the latest version,
it only allows 2 civs with the tech already I think.

Would be nice if users could change the techtables used, maybe from reading a text file.. for different mods.
In my mod I have increased mostof the tech costs as my tiles produce more money as all my laborers make -1 in taxes so cost a lot.
 
Originally posted by Admiral PJ
Would be nice if users could change the techtables used, maybe from reading a text file.. for different mods.
I will add this in a future version. (I'm still learning windows programming, so don't expect it tomorrow :p)
 
Hey, i haven't looked at the program yet, although i'm sure it will be a great help for the lazy (myself included).

Just FYI grey, your link for the tourney doesn't work... i'm interested, so pls post other info or PM me!
 
Originally posted by Quillan
Just FYI grey, your link for the tourney doesn't work... i'm interested, so pls post other info or PM me!
It's because Civfanatics.net is down. Go to the Tournament forum here at Civfanatics if you want to learn more about the competition.
 
Number of civs you know have the tech...

Do you include your own civ?

E.G. I am alone with my brother and I want to sell him astronomy.
X civs you know have the tech
 
Top Bottom