Cost of research and Samson's formula revisited

Ali Ardavan

Mathematician
Retired Moderator
Joined
May 29, 2002
Messages
2,951
Location
Michigan, USA
I was playing an OCC game and carefully micromanaged my beakers to get an advance the next turn. When I did not, I looked to see if anything unexpected has happened and I was surprised to see everything went as predicted. I dug up the Samson's formula for cost of research and checked everything again. The conclusion was clear: the formula was not right in this case.

Knowing the formula has been around for years, I started digging deeper and found several more inconsistencies. I am going to present my data and seek other player's opinion on this matter here. But before I proceed, I should review what I believe to be the formula first.

Search on CFC reveals many mentions of the Samson's formula. Most of these do not contain the details and provide a link to the original article by Samson at Apolyton site. Unfortunately these links do not work any more. However, on two occasions the details are provided and since the two are identical it makes me believe that this is all the detail that is available:
http://forums.civfanatics.com/showpost.php?p=379489&postcount=21
http://forums.civfanatics.com/showpost.php?p=9430649&postcount=15

If someone here believes there is more to Samson's formula than is copied in the above links, please provide the details.

The cause of the discrepancy in my game, was that despite what the formula says the tech multiplier does not always go up by one with every 3 techs you are ahead of your key civ. The penalty is +1 for 3 techs, +2 for 6 techs, but not +3 for 9 techs. It jumps to +4. I have verified that this happens with consistency. Similar jumps happen with consistency at other differences as well.

As I was collecting data points for this purpose, by opening old saves, I noticed data that was inconsistent in other ways. I kept looking and collecting data till I happened to open a very old save from the days I was learning how to play Civ2. The tech multiple was inconsistent and lower than expected. Then I had a eureka moment. I noticed that the year was 1500 but I was researching techs that I typically do in early AD years. I went into the cheat mode and changed the year by lowering the turn number by about 100. The tech multiple changed to the expected value! Thus, the tech multiple is based on game turn among other things.

Looking at the table of Base and Bonus values vs. Tech number that is in the original article by Samson I cannot help thinking that this cannot be the case. No designer will make a design by assigning numbers like this. If I want to design a tech multiplier based on tech number I am going to come up with a formula and not a table.

I have not looked at enough data points to come up with a formula on how number of turns affects tech multiple. Nor do I have an explanation for all the anomalies I have observed. I have started this thread because I want your input and want to make sure that there is not more research into this that I am already aware of.
 
If you are playing on a large map, you multiply the technology costs (as determined in the formula) by 5/4. This may give you jumps of two due to rounding, as shown:

26*5/4 = 32.5 = 32
27*5/4 = 33.75 = 33
28*5/4 = 35 = 35

You have to take into account starting technologies as well, since they don't count for your "tech number." If you played the game on a large map and had 3 starting technologies, you might end up with your observation. Other than that, I don't think you have missed any information.

Assuming that you haven't overlooked rounding, could you make a spreadsheet with the relevant information (game year, # starting techs, # current techs, # key civ techs, map size, difficulty, anything else you think might be relevant)? This will make everything easier to analyse without everyone having to make their own sample (or, we can add samples together).

It wouldn't surprise me if something was missed (particularly game year, since they seem to have been interested in early landings), because as long as they were close, the discrepancy might not have been noticed if it were small enough (people would likely set their science to 0 to determine tech costs after gifting, rather than use a formula).

Looking at the table of Base and Bonus values vs. Tech number that is in the original article by Samson I cannot help thinking that this cannot be the case. No designer will make a design by assigning numbers like this. If I want to design a tech multiplier based on tech number I am going to come up with a formula and not a table.

If there were a list of 93 or 100 values, I might agree with you. But there are only 20 values in that list, so I don't think it is unreasonable to assume it was programmed in. This would make it easy to change the tech costs if they found during game testing that a cost was too high or too low. These also increment by 1 every few techs, so it would have to be a pretty convoluted formula. (And looking up something is usually quicker than calculating it, although it wouldn't matter in this particular case.)
 
Since the posting of the thread I have found the original discussion in Apolyton thanks to Magic pointing out a link to NetHog's website which has a link to Great Library:
http://apolyton.net/showthread.php/2672-The-Cost-of-Research-Explained

I have read that discussion and now it is clear that Samson's formula was work-in-progress which never got finished. In fact, he himself encountered an anomaly he could not explain:

http://apolyton.net/showthread.php/...ch-Explained?p=1803438&viewfull=1#post1803438
In my test game, I had 72 techs and currently had a 3 tech lead over my key civ, which gave me a +1 penalty (3/3=1), which when added to the base of 26 resulted in a beaker cost of 1944 (72 x 27).

Then I destroyed my key civ. After this my tech "lead" was 72, so the game assigned me a penalty of 24 (72/3=24), which when added to the base of 26 (26+24=50) resulted in a beaker increase to 3600 (72 x 50).

In this test my tech costs increased even more, because
Next he gives a reason he later admits is erroneous:
http://apolyton.net/showthread.php/...ch-Explained?p=1803753&viewfull=1#post1803753
After a few more tests, it's not clear to me where the additional +6 penalty came from that resulted in the 4032 cost instead of the expected 3600.

I have gathered enough data to unravel this anomaly. As I said before the increase in penalty is not always +1 for every 3 additional techs. From my data points:
Additional-techs-over-key-civ Penalty
3 1
6 2
9 4
12 5
15 6
18 7
21 9
24 10
27 11
30 13
33 14
36 16
39 16
42 18
45 19
48 21
51 22
54 23
57 25
60 26
63 27
66 28
69 30
72 31
75 32
78 34
81 35
84 37
87 37
90 39

Samson's tech number was 72 meaning that he had 71 techs. When his key civ went away, the difference between him and his key civ was 71 techs which gives you a penalty of 30 according to my data. This is exactly what he observed.
 
If you are playing on a large map, you multiply the technology costs (as determined in the formula) by 5/4.
I do recall seeing tech multiples above 26 in late game in some games, however I have not had a chance to dig them up and see what causes that. I can assure you it is not simply a matter of map size. I looked at more than one game of mine on large maps (9K tiles and above) and the multiples were not different than those on the normal map. I also looked at 3 games on small maps (1-2K) and did not see a difference either.

This may give you jumps of two due to rounding, as shown: ...
In the reported case that started me down this route, I was ahead of my key civ by 6 techs an my multiplier was 28 as expected. I made a large delivery and expected my power to go up by one notch the next turn which is exactly what happened. My new key civ was behind me by 9 techs. I expected my multiple to go to 29 but it went to 30 instead.
You have to take into account starting technologies as well, since they don't count for your "tech number."
I did. I went back to -4000, and used cheat mode to look at all my rivals. Both my key civs started with the same number of starting techs.
Assuming that you haven't overlooked rounding, could you make a spreadsheet with the relevant information (game year, # starting techs, # current techs, # key civ techs, map size, difficulty, anything else you think might be relevant)?
The killer here is what else may be relevant. So far I know number of turns is a factor, but I have no idea what else could be.
If there were a list of 93 or 100 values, I might agree with you. But there are only 20 values in that list, so I don't think it is unreasonable to assume it was programmed in. This would make it easy to change the tech costs if they found during game testing that a cost was too high or too low.
I disagree. Keep in mind that this was designed from scratch. Why would anyone design a table (even a small table) instead of a formula? He had no benchmark he was trying to fit. I am sure there is a formula for the table I have provided in the previous response as well. I just have not figured it out yet.
 
The killer here is what else may be relevant. So far I know number of turns is a factor, but I have no idea what else could be.

What is relevant in other aspects of the game? Tech numbers are already accounted for, and map location can't be relevant. I find it unlikely that there are "trigger techs" like there are for trade. Government seems unlikely. I can't think of anything else that the game uses in other areas (like trade, riot factor, pollution) that might be used for science costs, nor can I think of anything else I would put into science costs were I designing the program.

I disagree. Keep in mind that this was designed from scratch. Why would anyone design a table (even a small table) instead of a formula? He had no benchmark he was trying to fit. I am sure there is a formula for the table I have provided in the previous response as well. I just have not figured it out yet.

There actually is a benchmark that the designers might have had: behaviour in the early game. That is, if you want (for example) the tech rate in the early game to be roughly constant, you will alter increases in tech costs so that they occur around the likely time that cities are founded.

The main reason I suspect that the points were programmed in, rather than the result of a formula, is that after 20 techs the multiplier doesn't change any more. If the designers had a formula for the tech costs for the first 19 techs, then why didn't they either keep it for 20 techs and beyond or (if they wanted a large jump) have a new formula for the techs after 19? For that matter, why not have a formula that consumes tech number directly (although this could have been done for the 1st 19 techs with a table as well)?

If you really think there is a formula behind all this, I suggest you find out how tech costs behave at lower levels. This might give you some extra insight into the fomula.
 
Thanks Prof. Garfield for your thoughtful remarks. Keep them coming.

I did some work on the effect of game turn last night. It was all done in one game at Deity level on a normal map. So far the data show that the reduction to the tech multiplier is nonexistent for techs below tech number 20. After that every tech has a threshold turn below which its cost is predicted by what we know so far (there are still some anomalies I cannot explain). After that threshold for every 8 turns you get a reduction by 1 in the tech multiplier. Sometimes this value jumps by 2 instead of 1. The reduction is capped at 7 or 8.

This threshold is so high that you will only see it if you are a novice or have poor terrain to work with. For the tests I ran, tech number 20's threshold is turn 120. Here is the data:
turn-range effect-on-tech-multiplier
001-119 0
120-127 -1
128-135 -2
136-143 -4
144-151 -5
152-infinity -7

The threshold for tech number 20+n starts 8*n turns after that of tech number 20. The amount of reduction is sometimes capped at 8 instead of 7, and I have seen jumps from 3 to 5 instead of 2 to 4. I have a feeling these jumps are caused by yet other factors that affect the formula which are yet unknown to me.
 
I am surprised and disappointed by lack of interest on this topic.

I have been spending a lot more time on this. The formula is quite complex and I have come up with several anomalies.

One interesting anomaly is on a game-generated normal-sized map at Deity level with 7 civs. I am playing OCC and in +500 as my city is celebrating towards size 21 my power becomes Mighty. Accounting for starting techs, I am ahead of the Greeks by 9 techs but my tech multiplier acts as if I am ahead by merely 8 (penalty of 2 versus expected 4). I have run the following experiments:
1. Engage in tech exchange with Greeks who have 3 techs I do not. Whether I exchange 1, 2, or 3 the anomaly does not go away.
2. Gift techs to the Greeks. 1-2 gifts make no difference, at third you see a reduction in penalty. Next reduction in penalty comes at sixth tech gift.

It is as if they have 2 instead of 3 starting techs. I have verified that they indeed have 3 starting techs (cheat menu in -4000 before they have had their chance to start playing as I am playing white). Furthermore, there are other junctures in the game when I am mighty and I do not observer an anomaly.
 
It occurred to me that I should try something unusual for a possible insight into the formula. I decided to look at tech costs in the current GOTM 126. For those who may not know, this is a scenario where the human player starts as Mongols with no starting tech, Greeks have 1, Persians 2, ..., Romans 6. Furthermore, Greeks start with 2 cities, Persians 3, ..., Romans 7. This means that my power is pathetic and my key civ is Rome.

Here is my data

tech# tech cost
1 10
2 10
3 18
4 30
5 40
6 55
7 66
8 84
9 96
10 108
11 120
(built Marco and did massive tech exchange)
22 21x26

It is obvious that the game is treating me as if I have a starting tech even though I do not! This and the previous observation tell me that depending on the circumstances the formula treats you as if you have fewer (previous case) or more (this case) starting techs than you actually do!

I would appreciate other GOTM 126 players reporting their tech costs for comparison.
 
Ali: I think the same happened in GOTM 115 (the first 2 techs costing 10 beakers with no starting techs) In each situation, we started Pathetic: however in 115 we were our own key civ while in 126 we were not.
 
It's not lack of interest on my part, but lack of anything useful to add.
This is probably one of the little ways that holds back my game. In the early years I forget to check tech cost, and once I get scientists it's such a pain to figure out that I don't bother.
 
Thank you Jokemaster for mentioning GOTM 115. I looked at my saves and my data is below. In that game, another scenario, we played white and the rivals each started with 6 techs. This meant that like GOTM 126 we started as pathetic and will remain so for quite some time. In GOTM 115 we were our own key civ, in GOTM 126 our key civ is Rome who is most powerful.

tech tech cost
# GOTM115 GOTM126
1 10 10
2 10 10
3 2x11 2x9
4 3x11 3x10
5 4x12 4x10
6 5x12 5x11
7 6x12 6x11
8 7x12 7x12
9 8x12 8x12
10 9x12 9x12
11 10x12 10x12

20 19x15p4 <-- p4 means I was ahead of my key civ by 4 acquired techs
21 20x24p5
22 21x26p6 21x26
23 22x26p7
24 23x26p8
25 24x27p9
26 25x27p10

29 28x28p13

31 30x27p9

34 33x26p6
35 34x26p7

37 36x26p7

42 41x28p12,x27p11

48 47x28p13

53 52x28p13

56 55x28p13

58 57x30p15

76 75x36p31

101 100x45p52,x44p50,x42p45,x42p42,x40p39,x39p36,x37p33,x36p30,x35p27,x33p24,x32p21

135 134x58p134 (key civ destroyed)

Once again the data clearly shows that in this game just like GOTM126 the formula assumes you have a starting tech when you actually do not. I now believe that the number of techs that do not count towards the tech cost is a separate variable which is often, but not always, set to the number of starting techs. In this game this variable never changed even after I became Supreme.

Next I am going to dig up an old game of mine which was a normal game (not a scenario) but I started at a huge disadvantage: I started on the north pole and took quite some time for me to settle.
 
Thank you responders. It is good to know that others are reading if not responding.

This is probably one of the little ways that holds back my game. In the early years I forget to check tech cost, and once I get scientists it's such a pain to figure out that I don't bother.
Not as much as you think. Once you know how to lower your tech cost (gifting your key civ) the tech cost only matters if you are playing OCC. In OCC missing the next advance often means a wasted turn.

I hope I have the tech costs of GOTM 126....Might have a look at them this evening...
Thanks. I would appreciate those numbers.
 
Thanks Magic. Your numbers match mine exactly.

I went to a very old game of mine to look at the research cost. Here are the parameters: 40x50 game-generated map, King level, 6 civs. I was playing purple and orange was the missing civ.

I started with 2 settlers and Bronze Working on the North Pole! I sent them in opposite directions. There was only one island off the north pole which was found and settled by -3600. I encountered 3 huts on route, 2 of which gave me techs. Despite these disadvantages and unlike GOTMs 115 and 126 (reported above) the game did not treat me as if I have any more extra starting techs. My techs costs from the available saves are below. Due to the fact that the earliest save is from -3250 it is not possible to accurately find out what the other rivals had for starting techs. The ? seen below indicates that fact. Eventually I became supreme and thus my own key civ. Tech costs after that point have a postfix of e (for even as in no tech diff )

tech # Research cost multiple
3 x8? <- This means that tech cost is 3x8=24

7 x7?

13 x9?

15 x9?

19 x10?

25 x14e

33 x18e

41 x18e

54 x18e

61 x18e

66 x18e

85 x18e

88 x18e

90 x18e

Given a late start and very slow initial progress due to the home island being size 8 with 4 plains and 4 forests, I checked to make sure that none of the tech costs are affected by the turn factor (see responses 1 and 6 above) and they are not. At one point I got within a couple of turns of the threshold though.

Observations based on this data:

1. The final tech multiple is not fixed (here it is 18 vs. 26 in typical deity and emperor games). This is not new and is already known. What is not known is what factors play a role. Level and map size are the obvious ones, but who knows what else.

2. The onset of the final tech multiple (18 here, 26 typically) is not always at tech 20. Here at tech 25 we are seeing a multiple (14) lower than the final (18).

3. This is the first time I have observed tech multiples below 9.
 
A technique I used when investigating the Riot Factor was to save games as scenarios so that I could load them at any difficulty level and compare differences without completely setting up a new save for each level.

I also changed the Riot Factor entry in the rules.txt file to come up with my formula. In your case, you might want to alter the Tech Paradigm to see what the changes are.
 
Thanks Prof. Garfield for your suggestion about saving as scenario. I was not thinking about that.

I know difficulty level is a factor but right now I am more concerned about resolving the anomaly I explained in response 7 above. It is very puzzling as I am getting different results at various points in the same game. Obviously factors like difficulty level and map size are fixed here. Furthermore, I have observed this anomaly only when I am Mighty. Sometimes the Greeks act as if they have 3 starting techs, some times 2. In reality they started with 3 (verified via cheat mode in -4000).

I have a save at +500 and another at +360 where the Greeks behave as if they have 2 starting techs. Furthermore, if I play from the +1 save (where I am not Mighty) to +40 when I become Mighty I observe the same phenomenon. But If I play from my -1000 save or -500 save, the Greeks behave as expected (3 starting techs). I have played the -500 save all the way to +160 and 5 times during this period (-450, -200, +20, +140, +160) I am Mighty and the Greeks act as expected.

This is really puzzling. This phenomenon is not affected by how many techs I have (I have experimented by tech exchanging with them or other rivals) or what the tech difference between us is (I have tried reducing it by gifting them and the behavior is consistent). It is not affected by whether we are allies or not or whether or not they have techs I do not have. I am all out of ideas as to what else could be causing this anomaly.

Any ideas anyone?
 
You mention starting Tech anomalies for GOTMS played as scenarios. This could be a result of cheating used to remove techs (or add them) to achieve the desired starting circumstances of the game.

The anomaly from your OCC game is strange, however. Is it repeatable? That is, if you play a few turns over and make the calculations again, will you have the same result?
 
You mention starting Tech anomalies for GOTMS played as scenarios. This could be a result of cheating used to remove techs (or add them) to achieve the desired starting circumstances of the game
Brilliant! That is probably it. To create the scenario I start a normal game, then use the cheat menu to set it up as I want and then save as scenario. It probably gave me a starting tech in both cases and remembered that fact even after I wiped my slate clean.

Just to test this, I started several normal games with the GOTM 115 map (7 walls). In 5 of 5 Deity level starts it gave me 6 starting techs. In 3 of 3 Emperor level games it gave me 2 settlers and 4 starting techs. It is safe to assume this map always gives you more than one starting tech. Why removing these via the cheat menu cause the game to treat you as if you still have one (and not more) starting techs I do not know. Despite this issue your guess is so far the best theory we have for this behavior.

I also started a game based on the GOTM 126 map, and I was surprised to get no starting techs! So I have no argument there.

The anomaly from your OCC game is strange, however. Is it repeatable? That is, if you play a few turns over and make the calculations again, will you have the same result?
Yes. It is very persistent. I have played from the anomalous +500 save all the way to +940 (22 turns). My power moved off of Mighty and back to it several times in this period and consistently Greeks were treated as if having 2 (instead of 3) starting techs.

Meanwhile I have discovered yet another strange anomaly. I have a normal game (not scenario) played on the 7 walls map (used in GOTM 115). I started with 6 starting techs. Up to my -1000 save, my tech number is #of techs - #of starting techs +1 as expected. In my +1 save, however, my tech number is one more than expected! I started playing from my -1000 save (normall) to +1 and the anomaly did not occur . So, right now I have two saves at +1, based on the same -4000 start, in both of which I have 26 techs and researching 27th. My tech cost in one case is 567 = 21x27 (normal) and in the other case is 594 = 22x27 (anomalous).
 
Upon further thought, there may be a common reason behind both the OCC anomaly (responses 7, 17, and 19) and the 7Walls anomaly (response 19): the effect of a starting tech not counting towards your tech number expires. This expiration is not turn-based as I have saves in both cases at the same turn with different tech costs. Some game event must be the causing this expiration.
 
Top Bottom