No announcement yet.

A pattern governing supply and demand changes

  • Filter
  • Time
  • Show
Clear All
new posts

  • A pattern governing supply and demand changes

    After Trade is discovered and before any trading takes place, the timing of the seemingly spontaneous changes to the supply and demand lists of cities conforms to a pattern I have discovered while playing all the civs in a hot seat test game of MGE.

    In this game, Trade was discovered by the Babylonians in 2250 BC, and was immediately shared all around, in order to reveal all supply and demand lists. In the 20 turns that followed, the way in which cities became eligible for a change to their supply and/or demand commodity lists adhered to a consistent pattern.

    The pattern is best observed by making a table or graph, and putting all the cities on one axis and putting game turns along the other. The cities must be listed in the order in which they were created as the game was played. The city list should include every city from every civ in the game. Game turns just proceed in their natural sequence, and if “O’s” and “X’s” are used to represent each turn, a graph or table will result that looks like the following:

    Game turns in order of occurrence

    The “X’s” represent the turns when a city had some kind of change to its supply and/or demand list. Notice that cities do not always undergo a change when they are eligible to do so, BUT also notice that a city must always wait until a turn where their row intersects a diagonal where the other X’s always line up on. Another consistency I noticed was that an X appearing on one diagonal is always 16 turns and 16 cities away from its buddies on the next diagonal when you follow sideways along the turns and downwards through the cities, respectively. Notice that cities created 16 spaces apart may both undergo supply and/or demand changes on the same turn. Also note that once a change takes place, another will not occur for that city until at least 16 turns later. This actually happened in my test game many times, since I started observations with 30 cities when Trade was discovered, and 20 turns later had added 11 more. During this time there were 34 occurrences of changing supply or demand, spread out over four separate diagonal lines, all lines adhering to the 16 spaces of separation.

    This is kind of like oedo’s OOOX thing with revolutions, but you can see that it has been disguised a little bit better, since there are gaps left along the diagonals where the X’s line up, but they sure DO line up like little ducks!

    I am trying to figure out if there is a system to the gaps now, as they may be part of a larger pattern that may emerge as the game progresses. At this point, I have just delivered my first caravan, with five more deliveries coming pretty soon, and I’m anxious to see how active trading will interact with the consistent underlying pattern I have seen so far governing supply and demand changes.

    I will try to repeat the pattern below with the "X's" in boldface. This may not work.

    Game turns in order of occurrence

    (edited to fix typo noticed by samson in his post. In the origianl city list, city12 was accidentally omitted)
    Last edited by solo; November 3, 2002, 13:44.

  • #2
    Bloody hell..........looks like 'solo' trading can begin.


    • #3
      once you think Civ2 has been figured out someone has to come along and prove otherwise.


      • #4

        Mathematically, the relationship you describe is:

        RemainderOf( (TurnNumber + CityNumber) / 16) = N

        The value of N could be determined by knowing what year the first 'X' in your chart occurred.

        It is possible this is merely part of a more complex algorithm for determining when supply and demand changes occur, with other factors masked by constant conditions in your test game. In any event, this is an important discovery.

        One explanation for the missing X's is that the actual commodities for new supply/demand are chosen randomly from the 16 available types. For instance, if one new commodity is randomly selected from 16, there is a 3-in-16 chance that it will be the same as one of the current supplied commodities. Thus, we would expect to see no change in 3 out of 16 cases. This is roughly the incidence of missing X's your data shows. I count 10 missing X's out of 49 expected changes. That's quite close to 3-in-16. A larger data sample might be even closer.

        Note: when I use the term "random" above, I do not mean that a restart will produce different results. That only happens when a random function uses a seed which is not restored by the restart. If the seed in the commodity re-supply algorithm is some factor which is saved, the algorithm can result in a consistent but still 'random' selection.

        By the way, your charts are missing 'City12'. Typo or did something happen to that city? Which brings up the question of destroyed cities. When a city is destroyed, are all cities assigned a new number by shuffling them up the list? If so, then cities could shift places in the ordering of supply changes.

        Good work. A piece of a puzzle has been found.


        • #5

          The missing city12 is indeed, a typo, which I fixed.

          The list presented above was just a hypothetical example, used to illustrate the pattern. I'm sorry if this misled you a bit. So far, there have been 11 missing "X's" in my actual test, which is about 1/3 of the 34 "X's" actually appearing, so far. If you would like, I can post the actual list, which continues downwards now for 40 cities.

          I have also wondered what would happen if a city is destroyed, and may do this in the game soon to see if the list is re-shuffled.

          Since I am keeping an entire record of the game details, this also includes the state of all of the commodity supply and demand lists shown by the trade advisor. It was from the demand lists, especially the one for dye, (at this state in the game, almost every city demands dye), that I noticed that cities were listed in the order of founding. When cities are added to or dropped from these demand lists, the ordering of cities on these lists always reflect their order of appearance into the game. I had to ask myself why does the game bother to do this, and the answer led to my discovery.

          Anyways, while maintaining these lists, I have noticed that certain trends exist for certain commodities, i.e. some are gaining cities that host them while others are losing particpating cities. It may be that if all of a city's particular commodities are currently on the upswing, then no changes are made to the city's supply or demand lists. However, your random theory is another highly plausible explanation. I'm afraid more data is needed before attempts can be made to explain the gaps. I will post a summary of these lists, so far, if you are interested.

          The gaps must surely be intentional, though, because if cities DID change supply every 16 turns, this would have become obvious to all of us long ago. I also expect that other factors come into play, once trading has commenced, instaed of always having just the 16 turn waiting periods currently enforced in my test game.

          However, it was kind of exciting to discover this underlying relationship, and to see that none of the X's observed so far have tresspassed into the wasteland of all those surrounding "O's".
          Last edited by solo; November 3, 2002, 13:50.


          • #6

            Yes, post the full list of X's and O's.

            Another question. What happens when not all civs have Trade? Does the 16-turn pattern still include all cities or only the cities of Trade-capable civs?

            I assume in your game you haven't made terrain changes. One thing I have observed several times in real game situations is that mining a grassland square into forest can produce a supply change on the turn after the transformation is complete. Usually, the new supplied commodity is Hides. I have tried changing the rate of transformation by adding and subtracting settler/engineers and find that the supply change always occurs when the transform is complete, not on a particular date. So terrain may be another factor.


            • #7
              This is no longer a research lab.
              This is plain surgery.
              Sid Meier torn into small pieces.
              But it doesn't hurt: your hospital has been granted much finer narcotics than the Russian Special Forces.
              ...just one more turn...just one more change in commodity supply... long live civ .
              Aux bords mystérieux du monde occidental


              • #8
                Thanks mon ami, La Fayette.

                Okay, Samson, here is the real list. The first year was 2250, when Trade was discovered and shared all around. About 3/4 of the way through, is 1500, a unique year where all trade took a rest, without any X’s. This was the same year all civs were asked to check with their advisors. The last year is 1200. Cities will be listed on the right so as not to spoil the alignment of the X’s on the list. One note is that Hamburg had two commodities exchange positions on its demand list in 1650, so maybe that spot deserves an X. For now I mark it with a ?

                (Read dates vertically. All years are BC)


                OOOOOOOOOOXOOOOOOOOOOO Leipzig
                OOOOOOOOXOOOOOOOOOOOOO Washington
                OOOOOOOOOOOOOOOOOOOOOX Memphis
                OOOXOOOOOOOOOOOOOOOXOO Babylon
                OOOOOOOOOOOOOOXOOOOOOO Nineveh
                OOOOOOOOOOOO?OOOOOOOOO Hamburg
                OOOOOOOOOOOOOOOOOOOOOO Heliopolis
                OOOOOOOOOOOOOOOOOOOOOO Thermopylae
                OOOOOXOOOOOOOOOOOOOOOO Konigsburg
                OOOOXOOOOOOOOOOOOOOOOO Elephantine
                OOOXOOOOOOOOOOOOOOOXOO Bangalore
                OOXOOOOOOOOOOOOOOOOOOO Corinth
                OXOOOOOOOOOOOOOOOOOOOO Frankfurt
                XOOOOOOOOOOOOOOOXOOOOO Alexandria
                OOOOOOOOOOOOOXOOOOOOOO Pi-Rameses
                OOOOOOOOOOOOXOOOOOOOOO Calcutta
                OOOOOOOOOOXOOOOOOOOOOO Pharsalos
                OOOOOOOOOOOOOOOOOOOOOO Philadelphia
                OOOOOOOOOOOOOOOOOOOOOO Knossus

                Some interesting notes on cities where I happened to finish a build on the turn they might have earned an X, or actually did (In each case I exercised the zoom to city option):

                1900 Athens’ temple showed a false change on the demand list
                1850 Ellipi settler showed a false supply list before the one with the real changes
                1750 Leipzig temple showed the same changes before and after the zoom
                1650 Hamburg temple showed false demand list followed by the exchange of position of 2 items

                NO changes were observed at all in these lists during ALL other zooms made for builds in the O years. So maybe completing a build on a zoom year can affect these lists. It is worth making a few tests for this by going back to saved games and delaying builds.

                Some other notes:

                1) 12 cities still have not shown any changes, but some of these cities are fairly new.
                2) So far, 6 cities have changed their lists twice, but the second change for each was only among the turns from 1450 until 1250. During these turns, none of the other cities had any changes. Remember that 1450 followed 1500, where no changes happened at all, so I believe that date is significant.
                3) The last 3 cities on the list were founded after 1500, and this event is probably the cause of the resumption of the first-time changes in 1200 for Argos and Memphis. 1200 was the last date played to so far. To complicate things just a little more, the first caravan delivery of the game was made in 1200, too.
                4) The first two caravans built in the game arrived in the year 1600.

                As for terrain changes, I have only made a few roads so far to connect my cities. No mining or irrigation yet. I believe that terrain changes DO have an immediate effect, since I also believe that the choices for commodity distribution among cities are at least partly due to surrounding terrain. I also believe that specials play an important role in these assignments, too, as I have often noticed that clusters of silk producing cities have a silk special in the neighborhood, and have noticed this kind of behavior with other commodities, too. I’m also pretty sure that commodity selection is tied very closely to one’s level of technology, which is already especially noticeable when dealing with coal, oil or uranium. To test the effect of terrain, it might be time to bring out the map editor, and see what can be surmised from cities founded on specially crafted city locales, but this is another big project.

                Finally, as for the effect of the knowledge of Trade, my personal hunch is that all these changes are occurring before anyone knows about Trade, and that knowledge of the tech just reveals what has been going on. However, my hunches are often totally wrong, and this is easy enough to check since I have made a save of the game on every turn. All I have to do is go back to the save made previous to sharing Trade, and hog it instead, and continue making turns as before. The reason for my hunch is that when I have learned Trade, the demands of all cities I know about are instantly revealed. Also I have also seen an AI’s city change its demand just before delivering a demanded cargo too many times not to forget about it! If my recollection is correct, these deliveries were often attempted before the AI in question had the knowledge of Trade. In any event, I will go back and test this out.

                I think I will also go back and rush a settler to cause a city to disband, just to see how the vacancy on the city list is dealt with.

                That’s it for now. The more I get into this test, the more interesting things get.
                Last edited by solo; November 3, 2002, 20:13.


                • #9
                  Good finding! When the commodities in a city don't change on a designed turn, it may just be that they changed to themselves.


                  • #10
                    Thanks for the additional info, Solo.

                    I guess a question I have now, is whether the 16-turn phenomenon is a 'cause' or 'trigger' event. Does the game attempt to change a city's supply/demand every 16 turns or is it merely checking every 16 turns to see if other factors have changed and then making the changes visible? How can we test this?

                    As for terrain and resource specials. I did some testing in Cheat Mode with edited maps a while back and saw definite and immediate effects on suppy/demand from terrain changes. I agree that specials are important in determing the what commodities are suppied. Although I saw many examples of change, and could even predict changes after time, I have yet to discern a governing principle. This is tough problem.


                    • #11
                      Xin Yu,

                      I hadn't thought of your idea, but I like it! It may explain some of the gaps!

                      Observe Hamburg, where two commodities on the demand list apparently "swapped" positions:


                      demands: dye,wine,beads


                      demands: dye,beads,wine

                      Although there were not any commodity changes, a change certainly has occurred. Instead of a direct swap, I suspect that list was processed as follows:

                      item 1 - Dyes is processed first and the decision is made to leave it.

                      item 2 - Process wine next and decide to replace it with beads.

                      item 3 - Now process wine. It is already on the list, so it must be replaced, too. Just by coincidence, wine is replaced with beads.

                      Now if your theory is correct, dyes actually replaces itself, and the other two items are replaced by each other, i.e. a replacement of some kind always takes place.

                      Many times I have also noticed "shifts" in position for commodities when changes are made. For example,

                      Antium before:

                      demands: hides,spice,wine

                      Antium after:

                      demands: dye,hides,spice

                      What this suggests to me, is that processing may actually go like this:

                      item 1 - At this time Antium "wants" dye the most, so hides is replaced by dye.

                      item 2 - Hides are now the second favorite choice, so they replace spice.

                      itme 3 - Spice is now ranked #3 in preference, so it replaces wine in the third position.

                      Every 16 turns the relative desirability of commodities changes, perhaps due to the passage of time or due to intervening events. Then replacements are made to the supply and demand lists based on revised desirabilities. If not enough change in desirability has occurred, all three items on the list simply replace themselves.

                      Other examples from my test game, where a zoom to the city was made on turns where an improvement build coincided with a commodity changing turn, may provide clues about this process, too. I suspect the zoom reveals an intermediate step in the processing of the lists, before the completion of city processing at the beginning of each turn.


                      Just noticed your post. I had the same experience, when using cheat mode to change terrain. Terrain changes may be an independent way of changing supply and demand, resulting in immediate differences.

                      Intervening events over 16 turns?

                      That does not explain what happened to Argos, founded in 1300, with:

                      supplies: dye,coal,copper
                      demands: beads,hides,wool

                      Just two turns later:

                      supplies: coal, copper,salt
                      demands: dye,beads,hides

                      I can provide several other examples.

                      However, I have also discovered that dyes are used for some special purpose, since I have observed a very systematic accumulation of the demand for dyes in position #1 of the demand column.

                      More later, after a few tests.
                      Last edited by solo; November 4, 2002, 11:55.


                      • #12
                        Civ2 Strat Forum's latest WoW = solo.

                        I watch and read in awe...
                        Apolyton's Grim Reaper 2008, 2010 & 2011
                        RIP lest we forget... SG (2) and LaFayette -- Civ2 Succession Games Brothers-in-Arms


                        • #13
                          Replay Test #1 - What happens if Babylonians do not share Trade after discovering it in 2250 BC

                          Only demand lists for foreign cities could be monitored, by clicking on their cities or by checking with the trade advisor. Lists marked as duplicate are those that changed to the same commodities as were observed in the original game where Trade was shared with all. Otherwise it will just be noted if a change occurred or not in a city where a change might be expected. Due to the turn order, changes for all civs except for Rome, are only noticeable by the Babs the turn AFTER they actually happened.

                          2250 Maps shared with all, in order to locate all existing cities. All original demand lists are checked and they duplicate the lists shown after trade had been shared in the earlier game.

                          2200 Alexandria – demand list changes, Veii – duplicate changes

                          2150 Frankfurt – no changes

                          2100 Babylon – duplicate, Corinth – duplicate, Bombay – changes

                          2050 Bangalore – changes

                          2000 New York – changes, Elephantine – no changes

                          At this time Trade was given to just the Germans, after which Konigsberg came in as a duplicate.

                          Finally, all cities were given a final check. None of the ineligible cities had any demand list changes.

                          From this test, it can probably be concluded that the pattern is in effect even for cities of civs that do not know Trade yet, since most cities eligible for changes did change their lists. However, the knowledge of Trade has an effect on the specific changes (or lack of changes) for eligible cities.


                          • #14

                            2250BC is turn number 35. On this turn, city29 (Alexandra) changed and city13 (Sparta) should have changed in the pattern, but didn't. Plugging these numbers into my formula gives a value of 0 for 'N'. Thus:

                            RemainderOf( (TurnNumber + CityNumber) / 16) = 0.

                            The fact that the changes occur when the remainder is 0 suggests that this portion of the algorithm is distinct from other factors. And may well be a 'cause' of supply/demand changes.

                            I agree with you that it seems likely the 16-turn cycle is independent of how many civs have Trade, and possibly independent of the discovery of Trade at all.

                            Re: shifting of commodities. I've seen this both in test and real game cases. It's an important clue, I think.


                            • #15
                              Replay test #2 - What happens to the city list when a city is destroyed

                              Below is the relevant part of the chart plotting city changes vs. time. The replay begins in the year 2150, which is the first year displayed in this mini-chart. At this time a settler was rushed in Konigsberg, a size 1, German city. Just for future reference, Konigsberg had the following commodity lists:

                              Supplies: hides,coal,beads
                              Demands: wool,silver,wine

                              On the next turn, 2100, the settler was built and Konigsberg was disbanded. At this point a save of the game was made, because I wanted to test several things.

                              OOXOOOOOOOOOOOOOOOXO New York
                              OXOOOOOOOOOOOOOOOXOO Babylon
                              XOOOOOOOOOOOOOOOXOOO Bombay
                              OOOOOOOOOOOOOOOXOOOO Veii
                              OOOOOOOOOOOOOOOOOOOO Sparta
                              OOOOOOOOOOOOOOOOOOOO Ur
                              OOOOOOOOOOOOXOOOOOOO Nineveh
                              OOOOOOOOOOOXOOOOOOOO Ashur
                              OOOOOOOOOO?OOOOOOOOO Hamburg
                              OOOOOOOOOOOOOOOOOOOO Heliopolis
                              OOOOOOOOOOOOOOOOOOOO Thermopylae
                              OOOOOOOXOOOOOOOOOOOO Madras
                              OOOOOOXOOOOOOOOOOOOO Ellipi
                              OOOOOXOOOOOOOOOOOOOO Boston
                              OOOOXOOOOOOOOOOOOOOO Antium
                              OOOXOOOOOOOOOOOOOOOO Konigsburg
                              OOXOOOOOOOOOOOOOOOOO Elephantine
                              OXOOOOOOOOOOOOOOOXOO Bangalore
                              XOOOOOOOOOOOOOOOOOOO Corinth
                              OOOOOOOOOOOOOOOOOOOO Frankfurt

                              Pass #1 – See if gap in city list left by Konigsberg is filled in by an existing city

                              2100 On the Indian turn, Bangalore duplicated the change that originally occurred for that city during this year, so it appears it remained in the same position.

                              2050 Babylon is checked, a duplicate change occurred on the previous turn which can be noticed now, and since it was founded earlier than Konigsberg, this is not a surprise. Elephantine also displays a duplicate change. If it had filled the gap left by Konigsberg, this change would have been postponed until expected during the next turn, but this did not happen. Finally, New York displays a duplicate change.

                              2000 No changes, because Konigsberg is gone. It’s former slot appears to be empty.

                              1950 Antium displays a duplicate change.

                              From this pass, we can probably conclude that when a city is destroyed, it leaves behind an empty slot in the chronological city list.

                              At this time, I decided to use the settler from disbanded Konigsberg to build a new German city, Munich. (not to be confused with the Munich appearing later in the original game). This city was built one hex away from where Konigsberg had been and displayed the following trade lists:

                              Supplies: hides,beads,coal
                              Demands: wool,cloth,wine

                              Notice how similar the commodities are to those in the Konigsberg list. The only difference is the cloth in place of silver on the demands list! This is good evidence that that surrounding terrain affects the selection of commodities for any given city. The other thing to note is that when I checked the trade advisor wine demand list, this new city, Munich was listed right in between Antium and Elephantine, which is where Konigsberg had been before.

                              So we might also conclude that when a gap in the chronological city list occurs due to the loss of a city, the next city that is founded is inserted into that gap. The remaining cities always stay in their original positions on this list.

                              Pass #2 – What happens if the settler produced by Konigsberg rebuilds a city right away on the same spot

                              2100 Munich is built right where Konigsberg used to be. Commodities displayed were identical to those that Konigsberg had before it was disbanded. More good evidence that terrain dictates original commodity selections. The trade advisor wine demand list is checked, and Munich is in between Antium and Elephantine, just where Konigsberg had been before. Again, we might conclude the gap has been filled.

                              During the next few turns, Bangalore, Elephantine, and New York showed duplicate changes, which was expected. In addition, during Germany’s 2000 turn, Munich’s commodity lists underwent a duplicate change, too, mirroring what had happened to Konigsberg in the original game.

                              Pass #3 - What happens if another civ builds a city after Konigsberg is disbanded

                              2100 An Egyptian settler builds Pi-Rameses, which has the following commodity lists:

                              Supplies: hides,dye,copper
                              Demands: beads,salt,wool

                              Not much similarity to the Konigsberg list. More evidence in favor of terrain dictated lists. However, when the trade advisor lists were checked, it appeared that Pi-Rameses had filled the slot left behind on the chronological city list left by Konigsberg.

                              2050 The German settler coming from Konigsberg builds Munich right where Konigsberg had been before. The commodity lists were identical to those of the original Konigsberg. Here again, terrain must be dictating these. When the trade advisor demand lists are checked, Munich is listed dead last, the expected position of a new city, when there are not any gaps to be filled.

                              2000 Pi-Rameses has a change in its commodities, which is expected, because now it holds the position in the chronological list originally held by Konigsberg, and 2000 would have been Konigsberg’s year for change, had it remained in the game. Commodities for Pi-Rameses changed:

                              Supplies: hides,copper,salt
                              Demands: dye,beads,wine

                              On the trade advisor wine demand list, Pi-Rameses was listed right in between Antium and Elephantine.

                              I guess the original question has been answered! In a nutshell: The gap left by a destroyed city in the chronological list is filled by the next new city that is built. Other cities maintain their original positions on the list.


                              yes, it looks like whenever N = 0 for any city, a change is likely. Thanks for the formula, which makes it easy to check for when any city is "due" for a change.