Resource icon

Utility: TechCalc 2.01

Originally posted by mydisease


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;).


Also, I don't know what computer language you used Grey Fox, but many languages have something like the following...

ceiling(1.45121 , .1) = 1.5
floor(1.45121 , .1) = 1.4

and if you replaced the .1 with .01, you would get 1.46 and 1.45 respectivly. The complier normally assumes a 1 value for the second value thus rounding to the nearest integer.

It would be more effiecient (not that that would be worth a hill of beans as a user sees it) but would make for easier debugging.

Well, now I feel like the king of the geeks :king: .. I mean Greeks... yeah, thats it... hoplites rule.
 
Just d/led the second one; for some reason, it doesn't have an icon. It is in my folder, just showing as a blank spot that has Tech Calc underneath where the icon should be. I can hover over it and it shows the Tech Calc info, as does right clicking it. If I explore the zipped file, it shows a blue border square application (typical app icon). The earlier version had a red icon. It works if I click on where it is supposed to be, just no icon above the Tech Calc space. Looks kind of like this:




Tech Calc

with the empty space above it where the icon would be.
 
Originally posted by Grey Fox
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.

Yes, the formula I worked out uses total number of civs. But what I mean is that you could use no. of rivals left in the program, but the program would then have to add 1 to it before it worked in the formula.

EDIT : This now works fine as it is, so ignore the entire contents of this post. They are the delusional ravings of a madman.
 
Originally posted by LaRo
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

In this case, the cost of researching the tech for him would be determined by the number of civs he knows that have the tech. So yes, you do include your own civ.
 
Couple of things which don't seem right:

Rounding is still wrong on Monarch and Deity. The results given are lower than would be expected from the formula. Eg.

Integrated Defense, Huge, Monarch, 0 civs know the tech, 10 civs left. The formula gives:

N = 0 so UP.1(COST * N/DOWN(CL * 1.75)) = 0
COST * MM = 360 * 400 = 144000
144000 / CF = 144000 / 9 = 16000
Research cost from the formula is 16000. Research cost from TechCalc is 15840.

Integrated Defense, Huge, Deity, 0 civs know the tech, 10 civs left. The formula gives:
N = 0 so UP.1(COST * N/DOWN(CL * 1.75)) = 0
COST * MM = 360 * 400 = 144000
144000 / CF = 144000 / 6 = 24000
Research cost from the formula is 24000. Research cost from TechCalc is 23760.

From this it is possible to infer that TechCalc is working out MM / CF separately and then rounding the result of this down. So for the Monarch example, it is doing:

MM / CF = 400 / 9 = 44.44444444 = 44
44 * 360 = 15840

And for Deity:

MM / CF = 400 / 6 = 66.66666666 = 66
66 * 360 = 23760

This can be avoided by working out [COST - UP.1(COST * N / DOWN(CL * 1.75))] first. Then multiply the result of this by MM. Then divide by CF and the result should be correct.

Occasionally costs are 1 gold too low. Eg.

Bronze Working, Standard, Regent, 8 civs know the tech, 10 civs left. The formula gives:

COST * N = 3 * 8 = 24
DOWN(CL * 1.75) = DOWN(17.5) = 17
COST * N / DOWN(CL * 1.75) = 24/17 = 1.41
UP.1(1.41) = 1.5
COST - 1.5 = 3 - 1.5 = 1.5
1.5 * MM = 1.5 * 240 = 360
360 / CF = 360 / 10 = 36
So Research Cost from the formula is 36. TechCalc gives it as 35. I have no idea why this could be, but I could only find a few instances of it.

Other than these minor problems, its looking good.:goodjob:
 
Now I read the Caution part that it contains math.

So the tech costs 16000. How could I tell how many turns it'll take for it to compute?
 
Originally posted by hbdragon88
Now I read the Caution part that it contains math.

So the tech costs 16000. How could I tell how many turns it'll take for it to compute?
Divide 16000 by the number of beaker per turn you are getting (F1 - 'Science' number)
 
An important side note:

If you are getting 1 science per turn, after 10 turns it says you have 30 turns left. This does not mean you have 1/4 of the science researched - it means you have 10 beakers, and a maximum 30 turns left.

In this case, you would need 16000 - 10 = 15990 more beakers, not 16000 - (1/4 * 16000) = 12000, so if you put your science rate up at this stage it will still cost almost the full amount.

The same goes for buying these techs from the AI - they only offer you a discount worth 10 beakers, not 1/4.

I mention this as I believe in an early version of civ3 it was the opposite - you could get 1/4 discount from the AI after 10 1-beaker turns.
 
Next version of the program will most probably fix the minor calculation fault that gives you somewhat wrong numbers.

Any new features you would like added to the program?

I might add the possiblity to load a techlist from a textfile.

Might also add the possibility to calcuate how fast you can research the tech with a given Science per turn.
And also display how much science you would have to spend to get the tech in [any] amount of turns (maybe ranging between 4-40, although the 4 limit would only be on not started techs...)

I might also remove the static library. This will make the file about 150Kb or something in that range.

What features would you like?


Come with input, the earlier I get it. The more likely it is I will implement it.
 
Could you give us a menu option 'automatically calculate' that would update the numbers automatically if checked? I can't imagine the time to calculate each time would slow it down much.

As well as a 'beakers per turn' field, we should have a 'beakers already researched' as well, so we can work it out. Maybe even a load function to load the savefile and get that info as it is not obvious unless you are paying very close attention to the F1 screen. The savefile thing I imagine is a lot of work though, and might even get the app banned from GOTM and tournament. Personally, I am happy to count my beakers now I have an exact total to aim for :)

What is the dll compiled in? It would be best to offer a link to the dll as well if it is redistributable if you take it out the compile, so that if people don't have it they can download it.

I have thought about the possibilty of merging several apps together, such as mapstat, apollo, techcalc and combatcalc. This is much more long term, and would require woring with the other utils developers. I would be happy to lend a hand, but as with these things it depends on how protective of their code programmers are (as of course they have a right to be).
 
Originally posted by anarres
I have thought about the possibilty of merging several apps together, such as mapstat, apollo, techcalc and combatcalc. This is much more long term, and would require woring with the other utils developers. I would be happy to lend a hand, but as with these things it depends on how protective of their code programmers are (as of course they have a right to be).
Yep, I have thought about that too, and I have already asked the maker of the Civ Assistant Tool if he would like to include my utility into his program.

The Civ Assistant Tool is at the moment just a Combat Calculator, but he intends to include utility similar too notepad, and a ScreenShot program, probably a program that does a print screen and saves that immediatelly.

The Civ Assistant Tool is skinned and you can easily go to the program without going out to windows, by pressing alt-c or something, havn't tried yet.
 
Originally posted by anarres
Could you give us a menu option 'automatically calculate' that would update the numbers automatically if checked? I can't imagine the time to calculate each time would slow it down much.
Will try.

As well as a 'beakers per turn' field, we should have a 'beakers already researched' as well, so we can work it out.
Yeah, I know... didn't say that in my previous post though.
Maybe even a load function to load the savefile and get that info as it is not obvious unless you are paying very close attention to the F1 screen. The savefile thing I imagine is a lot of work though, and might even get the app banned from GOTM and tournament. Personally, I am happy to count my beakers now I have an exact total to aim for :)
Yeah, I have the code to DeCompress a save, but I have never worked with hex-codes... but there are some help here and on apolyton on how the saves work, so I could check those out some day.

I'm planning to do a 2nd utility that will help modding next, and that will need to look at a Bic/Bix file and get some values. I might do that before I include a get info from save option to this program. (Although in this program, wouldn't it be quite unnecessary to get the beakers from the tech your researching, you can always see how many turns you got left on it anyways...)

And why do you think it would be banned from the GOTM?
What is the dll compiled in? It would be best to offer a link to the dll as well if it is redistributable if you take it out the compile, so that if people don't have it they can download it.
I will have to do a new MFC project to remove the DLL from my program, and that means either rewrite the program, or copy paste the things I already written (duh! :p). But that shouldn't be too tricky...

And I would have to find out what .dll file it is, so I can offer it as a download aswell. Of course.

It will probably be downloadable from MicroSofts website though.
 
Originally posted by Grey Fox
And why do you think it would be banned from the GOTM?
I don't think it will get banned, just that it might, because it gives you info that you can not get from the save within the game itself. Some may agrue that being able to see you number of collected beakers is like being able to reload an old save to see that state on that turn (so 20 turns in to a tech, it would be like opening 20 previous save games and counting the beakers from each). I am not quite so puritanical, and this would not bother me, but I have seen the energy that some have about any utility, that's all.

Originally posted by Grey Fox
I will have to do a new MFC project to remove the DLL from my program, and that means either rewrite the program, or copy paste the things I already written (duh! :p). But that shouldn't be too tricky...
Try Project (menu item)/Settings. General tab, Microsoft Foundation Classes combobox - select 'Use MFC in a Shared DLL'

This works on most small projects - only compiling it will tell you if yours is ok. There can be issues in some complex programs (I think the 'Pre-Processor Defines' are slightly different), but in most simple cases it is fine.
 
Grey Fox:

A feature to load games? Somewhat like Gramphos's C3MT program. Or would that defeat the purpose of the tool?
 
The next version of this program will come VERY soon.

Although, I'm getting a Debug Assertion Failed error. If anyone can help me on that one, please do.

And anything you REALLY want in the next version that hasn't been mention in this thread yet, mention it now, and I might inckude it.
 
TechCalc v.1.5

Faulty version of 1.5 removed after 6 downloads.

The file is only 8.3 kb
 

Attachments

  • techcalc1.5.zip
    8.4 KB · Views: 831
GreyFox: did you sort out your error? I tried to PM, but your store is full.
 
Originally posted by LaRo
V1.05

I cannot open it because: Unable to find file MFC42D.DLL
MFC42D.DLL is the file grey fox removed from the program, to make it smaller. If you had the file on your system it would work. (This is normally found in c:\winnt\system32).

However, I think GreyFox has released the debug version by mistake, as the correct dll to use is MFC42.DLL.

If this is the case, GreyFox should be able to recompile the program as a release version. The correct dll it should be using is MFC42.DLL and it is very likely you have this already, so that version should work.
 
Top Bottom