1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Calling all economists: How to create a fun/simple/realistic world market economy?

Discussion in 'Civ4 - Creation & Customization' started by Padmewan, May 24, 2006.

  1. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    For our Planet Roanoke mod, I would like to incorporate a dynamic and functioning economic model that should be (a) fun, (b) realistic, (c) so simple even the AI could figure it out.

    The Civ4 trading model and the cottage/town mechanisms are a big leap forward from Civ3. However, the model abstracts away at least one critical aspect of economies, the concept of competitive advantage (in play since at least since the industrial era). This concept is instead captured by bonuses -- fairly well, I might add.

    However, what I would like to ask is if there is a way to merge the economy model with the bonus model. Just to be up-front about this, I am exploring this because we would like to model a frontier/colonial economy as part of our mod, and the existing system is too simple to represent the relative development between a developed and a developing nation/civ. (Outside of our scifi app, I think it would also open up Civ4 for more serious modeling, e.g. "How would you govern post-1947 India?").

    ========================================

    Here are some concrete ideas I first posted here. I would like to open them up to criticism and debate with anyone who is interested in making the economic model more sophisticated.

    1. Bonuses are no longer binary, but function more like gold. See, e.g., this discussion about an "Oil Treasury." Thus having 10 oil is different than having 1 oil (for purposes other than trading 9 away).

    2. Therefore, bonuses behave more like yields: a bonus tile could potentially produce 5 corn rather than 1.

    3. Each raw bonus is linked to a refined bonus. E.g., Dye and Cloth; Gems and Jewelry.

    4. Now, here's the tricky part: generating the "refined" bonus depends on adequate supply of the raw good. I'm not sure how this should work, except that whatever the method is, it should involve significant investement of time/capital with an attached opportunity cost.

    4a. One possible implementation of 4 -- A "cotton" tile can be improved in two ways: (1) Plantation that generates 2 cotton bonuses; (2) Textile factory that produces nothing at first, but eventually upgrades to generate 2 cloth bonuses. Disadvantage: Only cities that could have grown cotton can spin cloth. Though this coincidence is common in the real world, it's not necessary.

    4b. A second possible implementation -- Some kind of building or process converts cotton into textiles, but the efficiency of that building or process varies depending on your infrastructure investment.

    5. There is a viable marketplace, driven purely by supply-and-demand, for raw and refined goods. Fundamentally, I guess demand for the refined goods can be generated by whatever their benefit is (e.g. how much would each player pay for +1 happy, or whatever). Demand for the raw good will vary depending on the need to manufacture the refined good. Probably Dutch auction rules apply -- If X resources are available, top X bidders win and pay the same price, the lowest of the winning bids.

    6. Assuming all of this can be done, the really hard part will be getting the AI to calculate what to do in steps 4-5. Its behavior should be based on rational calculus, not "faked," or else the market won't work. The result should (I think?) be that the value of cloth on the open market is higher than the value of cotton by exactly the opportunity-cost difference of investing in the cloth-manufacturing infrastructure, such that some players (AI or not) would conclude that the best option is to stick with raw production rather than refinement.

    ========================================

    In terms of implementation, it might be simplest to strip all of the fancy labels and have only two resources: (1) Raw, and (2) Refined. If it works for one pairing, then it should work for 5 pairings, or 20.

    ========================================

    Perhaps an easier UI and maybe AI, implementation would be to add option 4c to the above ideas. Your output of "Raw" could have a slider to determine how much is changed into "Refined." (Just like you eventually get the option to turn "Commerce" into "Culture"). The slider, however, has diminishing returns that can be improved with some kind of investment (?). It would then be a matter of math for everyone to calculate their optimal setting on that slider based on prevailing market prices (which, of course, are affected by the sum total of everyone's sliders).

    ========================================

    I think Item 5 (marketplace for bonuses) seems easiest to create and doesn't rely on the other items. Each AI already calculates how much it values a bonus, so the demand side is easy. The supply side is trickier, but I think it's safe to presume that the AI will always put every excess bonus on the market. (More advanced behavior, though, may include cornering and then gouging the market).

    ========================================

    An additional market mechanism: cap the number of a refined bonus available to 80% of the number of civs in the game, rounded down. So if you have 10 civs in the game, at any moment there can only be 8 of a refined good on the market, and 2 civs have to go without. Then, the raw:finished productivity ratio would be set by calculating backwards from the desired final number of refined bonuses.

    ========================================

    Wow, all of this came out a lot more complicated than I had wanted to, esp. if we consider what it would take to program AI behavior. I welcome any thoughts on how to simplify this model to be something a reasonable human being can actually program using the Civ4 SDK!

    Remember, my primary goal here is to model the concept of competitive advantage between nations, as well provide some kind of lever for the player to make strategic choices within that model.

    Finally, I could be wrong that this can't be "faked." I would welcome any shortcuts that let us fake the core mechanic I've described.
     
  2. Impaler[WrG]

    Impaler[WrG] Civ4:Col UI programmer

    Joined:
    Dec 5, 2005
    Messages:
    1,750
    Location:
    Vallejo, California
    Have you ever played Imperialism, I recomend it as one of the best games of all time, if not you would realy study its implementation of Resorce collection and processing. Its Market for bidding ans selling comodities has never been matched though the price setting mechanism was never made clear and it could definatly use a Supply and Demand based system of price setting.

    You can find a free playable version on http://www.the-underdogs.info/index.php
     
  3. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    Thanks, I've d/led it. Now, when to play it...? (Whatever happened to SSI?)

    I think the key to making the economics more sophisticated is also to figure out how to make it simple but important. Playing Civ3 was a great exercise in figuring out why a nation might fight a war over oil. At the same time, it was frustrating in not presenting a peaceful way to answer that question (since diplomacy / economics was so limited).

    btw, I will note that one of the more brilliant models in Civ3 and esp. Civ4 is the transition from an industrial to a post-industrial economy as represented by the increasing power of commerce over production. By the modern era, gold-rushing begins to outweigh hammers. The +1 food for workshops via Communism is pretty much the last hurrah for the "Old Economy." (Which is why The Kremlin is such a ridiculously-matched Wonder).
     
  4. MrThing

    MrThing Warlord

    Joined:
    Nov 8, 2003
    Messages:
    130
    I have been hoping that someone would consider doing something like this.

    The EU engine game Victoria attempted to do something like this as well but was not well balanced (it could have been great though).

    I cannot really code anything but will come back to you latter with some suggestions (it is late now and my mind is melting).
     
  5. DSChapin

    DSChapin Warlord

    Joined:
    Nov 28, 2005
    Messages:
    116
    What about a straight "1 building converts 1 raw into 1 refined" system? That meshes well with the basic Civ structure, and also represents the fact that infrastructure is a long-term investment. I'm wary of any "conversion slider" because that would make it possible for someone to switch refining on and off swiftly in a fashion that doesn't happen in the real world.

    Of course, if you had extra buildings (say, "textile mills"), they would essentially go to waste until you got access to more raw goods, but that again is true to life.

    So, for example, if you had 5 cotton income (from plantations or from trade), and...
    ... 0 textile mills, you would earn 5 cotton per turn
    ... 2 textile mills, you would earn 3 cotton and 2 cloth per turn
    ... 7 textile mills, you would earn 5 cloth per turn
     
  6. Chengora

    Chengora Chieftain

    Joined:
    May 22, 2006
    Messages:
    36
    Really interesting idea! I like the idea of using improvements to convert raw into refined. Two questions:

    1. Would the benefits of raw goods and refined goods be different? And how?

    2. Is there a way to implement the effect of technology on productivity?

    One way to address the latter is to allow improvements to be either upgraded through a worker or automatically through the tech tree. Then, one cotton could produce two cloth (provided there was a textile mill), for example, and would better allow for the player to take a direct hand in planning economic strategy and advantage. This could be refined further by using the "resource pool" idea mentioned in the first post, as you could get away from 1:1, 1:2, etc. ratios.

    Alternatively, if you follow the resource pool line, you could have cities build buildings which confer the same effects, and then create an (ideally separate) build queue to produce the refined materials.
     
  7. Impaler[WrG]

    Impaler[WrG] Civ4:Col UI programmer

    Joined:
    Dec 5, 2005
    Messages:
    1,750
    Location:
    Vallejo, California
    I like both of thouse Ideas and think they could be combined. Buildings can convert a quantity of raw material to refined each turn without the players input. In Imperialism you can expand your capacity to an almost unlimited amount, we could represent the same thing with a series of Building improvments each with process more material. In addition the player could set the Cities build option to a refined materail or finished good to accelerate it. City based building would be very inefficient but would bypass raw material requirements to create the goods out of "thin air" so to speak, this is mearly an abstraction of inefficinet obsolete methods of production and other corner cuttings. So for example if I am producing Clothing with out Cloth that just represents us recycling old cloths, or using old burlap sacks as clothing ect ect.
     
  8. MrThing

    MrThing Warlord

    Joined:
    Nov 8, 2003
    Messages:
    130
    1) I think it would be good to be able to turn production on and off. First of all, to control the amount produced as well as the market value of prodcts and, secondly, because of the fact that one will often have more production power than certain raw goods. This may, however, be difficult to implement both for interface reasons and AI reasons.

    2) Remember that some refined goods will be made out of one or more refined good, especially industrial goods. Again, both Impericalism and Victoria provide "sample" models.

    3) There will be need for a free market. The excess goods of a Civ with free market will be automatially be avaiable to all other Civs on the free market except perhaps weapions, which should always be done by way of specific deals. State Property civic will dissallow even deals to sell goods by deals except to other State Property Civs. There are other matters around this topic to be considered.
     
  9. Pbhead

    Pbhead Hail the Byzantines

    Joined:
    Apr 7, 2004
    Messages:
    213
    Location:
    BelowTinBetween BismuthAnd Thallium
    my 2 cents. "any socity that would sacrifice a bit of freedom to gain a bit of security will deserve neither and lose both." -ben franklen (you got to love that tech. :p

    that goes for economics as well as laws and anything i can think of.
     
  10. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    Having now wasted many hours on Imperialism, I have to say I'm impressed. The gameplay reminds me of Settlers of Catan, another addictive game, though addictive mostly because of the inter-player negotiations. I will have to mull whether and how these mechanisms can be translated into Civ4 terms.

    One of the core mechanisms of Imperialism is balancing your available resources with capacity. At every turn, the basic game is: are you getting the most bang for your buck with the resources you have, both now and looking into the future? If you expand your ore-smelting capacity but lack coal and iron, the capacity, and the lumber/ore invested, is not so much wasted as misspent when you could have expanded your fabric factory that's now unable to cope with tons of cotton.

    Civ4 is built around resources being scarce and scattered, because they are useful in singles, not multiples. Having options to turn base resources into refined resources will need an entirely new interface, or else it will take the strategy right out of trading.

    The Civ4 equivalent of capacity/labor is the city's citizens. It seems to me that the only way to make a game with any modicum of strategy around resource development and refinement work is to base that creation around tile improvements. It never made sense to me that you would get gems whether you worked that tile or not (though understandable since otherwise you'd have to city-spam to get every resource).

    But then if the tile laborers produce the manufactured goods, where are the raw goods produced? Can specialists be used for the former?

    Oy, all of this would require MASSIVE amounts of AI retooling.

    Is Catan a better direction to look -- there are only 5 basic resources that each expand capacity in their own way?
     
  11. matteo773

    matteo773 Deity

    Joined:
    Jul 10, 2005
    Messages:
    102
    Location:
    England
    Should independant merchants be used somehow?

    They could be used to set a minimum price. For example anything below a certain price the merchants will buy instantly. However, the only bonuses for this would be that another civilization doesn't get your goods' bonuses and that it will definately be sold. This could be set up to control the economy.

    Or should these merchants have nationalities? Say you build a merchant's villa in one of your cities. This will mean that a merchant has a chance to buy random goods from any other civilaztion; at a lower cost to you and you only get a fraction of it's bonuses.

    And if merchants were used, should it be possible to buy from them?

    :crazyeye:

    Also, if you bought 2 cotton of the persians for example, would it be a constant supply until the deal ends (like it is now), or have you just bought 2 tons of cotton? This may have been mentioned before and I misunderstood, forgive me:(.

    Anyway, this certainly does look like a good idea and good luck with it.
     
  12. Chengora

    Chengora Chieftain

    Joined:
    May 22, 2006
    Messages:
    36
    Alternatively, we could make a single unit which did that. I was kicking around this idea when I first posted, but thought the tile improvement was a better way to go. Now that these other problems have come up, though, it may be easier simply to have a "producer" unit. You could set it to work on a tile (like a work boat), and it would produce the refined goods. As a prerequisite, the base tile improvement would still need to be there.

    I think this may be able to address some of the issues presented. A single producer unit could refine all the different types of raw resources, or you could split it out into special producers for specific resources. You can adjust base cost and upkeep (they still do that in Civ 4 right?) to simulate opportunity cost. And you can adjust how long it takes a producer to refine a product, as well as using technology to speed up the timeframe. This would avoid the need to retool the city interface. However, you could make a producer work like a settler or worker, in that it costs food to create one, or perhaps depletes population. This may be an effective check on producer spamming, and it simulates the fact that you need an actual population to work the tiles.

    Of course, this still leaves the problem of storing up refined resources somehow. But I imagine that is just an addition to the trade interface, right?

    What do you all think?
     
  13. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    Well, no, not really, because as Mateo brings up, the core problem is how to account for bonuses. Right now, the way Civ works is:

    1. Do I have 1+ iron?
    a. Yes: can build swordsman
    b. No: can't build swordsman

    The way Imperialism and other trade-oriented games work:

    1. How much iron and coal do I have?
    a. How many of each resource do I want to devote to producing steel?
    b. How many do I want to sell?
    c. How many do I have left over?
    2. What do I want to do with this steel...?

    The second is a very different mechanism than the first, and three major difference is that (1) quantity counts for (a) production, and (b) market sales; (2) resources can be stored as inventory; and (3) transactions happen every turn and is a core game mechanic. As a result, Civ4 diplomacy and trading is relegated to a pretty background activity -- once you have 1 coal, you don't need more. You rarely get into a situation in which you'll buy coal from Civ A to sell to Civ B -- and certainly not convert to something else and sell that to Civ C. All commerce is abstracted up to a unitary system -- gold -- which eliminates most of the trading mechanic.

    I think what would be required to mod a richer economic experience into Civ would be something like this:


    1. Resource inventories. You accumulate and expend coal, gems, etc. rather than simply "have it" or "don't have it."

    2. Tile improvements produce raw resources commensurate to how much you've improved them. A basic mine produces 1 coal, an advanced one produces 3 coal.

    3. Tile improvement produce raw resources only when actively "worked."

    4. City specialists draw from the resource pool to create new resources. E.g. a steelworker converts 2 coal and 2 iron into 1 steel (or whatever formula applies).

    5. Likewise, certain buildings and units also draw from the pool. For example, a coal plant might use 1 coal/turn or else it shuts down. Building a swordsman takes 2 iron out of the inventory. Etc.

    6. There is a market in which you can buy and sell excess resources (whether raw or refined).

    7. Food, pop, etc. remain the same, so if you are working a food tile, you aren't working a bonus tile.


    Even if you simplified this down to 2 levels of resources rather than 3 (e.g. iron+coal = steel, rather than iron+coal=steel, steel+steel = guns) and then had only a handful of options, it would be a huge programming undertaking. The basic mechanics seem relatively easy -- working a gem mine produces 2 gems, that's not too hard in the SDK or even Python.

    The hard part would be getting the AI to leverage its population intelligently. And mod the way the AI settles cities (now each resource counts!). And figure out how much to bid for iron.

    Am I missing a shortcut in how to make this easier to implement?
     
  14. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    Here's a rethink:

    What would happen if you enabled all civs to trade food and hammers?
     
  15. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    Here are the changes that I think can be made, but after writing it up I'm seeting that implementing it would be akin to creating a new game. I'm going to post it anyway as a potential roadmap for anyone with the ambition to take it on. Maybe I will work on it in an ad hoc, very slow and cumulative basis...



    1. Change how bonuses are collected

    Comment out existing code that determines if a resource is gathered by seeing if it's got the right improvement, within borders, and connected by a route.

    Each turn, when the system sweeps through and calculates yields per city, as part of the bonus tile calculation, you get +1 bonus for each bonus tile BEING WORKED.


    3. Change bonuses into a pool

    Store data about how many bonuses each civ has.

    Have bonuses accumulate. (E.g. you start the turn with 2 iron, you gather 2 more iron, next turn you have 4 iron).


    4. Have units built use up bonuses

    Building a swordsman might remove 2 iron from the pool. (Removed when starting the unit).

    Put this in the XML


    5. Have buildings use up bonuses?

    This is tricky, as what happens when the bonus is no longer available? The easiest thing is that a building uses up, say, 10 bonuses, no different than a unit.

    How to handle buildings that give bonus-bonuses (e.g. cathedrals and incense, power plants and coal) is another question.


    6. Mod AI for how workers choose tiles to work

    Without this, AI civs would be slaughtered and human players overwhelmed with micromanagement. This is the first item on this list that I think is beyond my current capabilities.

    Creating this AI would require that the AI have goals, e.g. "I need 10 iron because I plan to build 5 swordsmen." This would probably mean that cities need to have an ideal build queue lined up and signal that queue to some kind of master planning AI.

    In addition, the AI would also have to balance competing needs, e.g. "If we gather 10 iron, we forgo growth for several turns..." Seems like each city would have to transmit all of its goals and opportunity costs to the "master planner" which would then respond to each city with some weights that balance between each city's internal needs and the entire civ's needs. (If this is AI that doesn't already exist, it should regardless of this mod).


    7. Create a UI for the player to set the number of a bonus that must be gathered that turn. This is probably best represented as a slider that ranges between 0 and total available. The results of this setting would then feed into #6, and probably have the same effect per-city as setting a city's AI to "Emphasize production" -- it won't override the city's basic need to feed itself, unless you go in there and do it by hand. A very intelligent UI would allow this overriding but also show a warning on the slider (e.g. the slider turns red) when you go too high.


    8. Make specialists able to convert, e.g., 2 bonuses of one type ("raw") into 1 bonus of another type ("refined"). E.g. 1 coal + 1 iron = 1 steel.


    9. Create the AI for #8. Assuming that #6 is done, this wouldn't be as hard.


    10. Create a market where bonuses can be traded and sold.


    11. Create the AI for #10. Assuming that #6 is done, again this wouldn't be as hard.



    All of this would be a major undertaking and would likely create an entire slew of undesired side-effects. So I'm hesitant to take this on except as a sub-hobby of a hobby. If anyone out there with serious C++ skills wants to help out, please contact me, as that would make this a much more viable project...
     
  16. Olleus

    Olleus Deity

    Joined:
    Oct 30, 2005
    Messages:
    6,478
    Location:
    England
    far too complicated.

    I recomend a system where you need 1 resource to 'fuel' 5 cities. So, if you have 10 cities but only 1 source of iron, then only your 5 biggest cities will have iron, the others will just have nothing.
     
  17. MrThing

    MrThing Warlord

    Joined:
    Nov 8, 2003
    Messages:
    130
    I think that this would all be very good, but it is a lot of work.

    Perhaps one of the "hired" mod-makers will get air of this and decide to implement something like it.

    One suggestion too. Certain improvements/techs/civics should increase the resources collected.
    Having only "one" collected by each resource may not even be enough as a base unless you have resources all over the place. Maybe a base of 2 and modifiers allowing additions.
     
  18. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    Points all well taken. I'm just fishing for ideas and brainstorming. I welcome any and all ideas, whether huge, small, crazy, whatever...


    I realized in deconstructing economy-based games and comparing them to the Civ engine that they are quite radically different. The mechanisms that are closest between them are basically that you have to allocate limited capacity (in Civ4, civilians) across different resource-gathering activities.

    If a new system kept the basic mechanisms of Civ, I would stick to the 3 base yields (food, hammers, commerce) and build off of them, and dump the bonuses/resources for now as too complicated, as Olleus says, at least for now. Here's another attempt...


    Yields would accumulate across the entire civ, rather than be city-specific. (Localized yields stopped making sense once modern logistics arose). Each would go into its own pool, like gold -- but not like commerce!

    Specialists would combine yields to produce refined yields, e.g. (all names are made up!)

    2 foods = 1 granary
    2 hammers = 1 industry
    2 commerce = 1 money
    1 hammer + 1 commerce = 1 beaker
    1 food + 1 commerce = 1 culture
    1 hammer + 1 food = ???

    ... each of these could even be combined again.

    What, then, does the city produce? I imagine the answer would be, either anything a specialist could do (turn a raw yield into a refined yield), or turn refined yields into a final product, which could include
    * research (2 beakers = 1 research)
    * gold (2 money = 1 gold)
    * population (2 granaries = 1 food bar)
    * control (2 culture = 1 control pt)
    * buildings (allow more specialists, any combination of resources)
    * units (any combination of resources)

    Wow. Just from 3 basic yields I think the possibilities are pretty staggering... programming this would be insane.

    Well, just brainstorming. I'm still trying to come up with a simple but effective economy game that would make diplomacy/trading more interesting in Civ4...
     
  19. Skippa

    Skippa Noble

    Joined:
    Nov 8, 2005
    Messages:
    65
    Location:
    PA
    This is a great idea. It sorta reminds me of Colonization, if you remember that from manay years ago.
    So the main idea that I see everyone concentrating on is that we want to have supplies of resources and use them to manufacture other goods.
    Another idea is that the vaue of a good or resource should be linked to its supply.
    ie If Khan is the only one with cocoa he has the monopoly on on all the beans and the only supplier for all of the chocolate producers in the world. If everyone has access to cocoa then the beans aren't worth as much.
    In the first case the trade for cocoa should be a lot more than in the second case.
    Don't know how that could be implemented in the code but it wuld make for a better economic model.
     
  20. Tholish

    Tholish Emperor

    Joined:
    Jul 5, 2002
    Messages:
    1,344
    Location:
    Japan
    Can you set it up to where a build changes the resource? Ie, simply building a refinery on Oil turns it into Refined Oil, which is a different resource.
    Also, are we stuck with just the 3 yields? Food, hammers and money could be expanded, perhaps, though it would be a nightmare for someone to make an interface for it.

    Better, resources disappear not randomly but based on demands made on them. So, you have to say which oil field is supporting your own oil demanding activities (and the engine adds up how much drain they make on it each turn and see if it disappears) and which oil field you traded away (and similarly the demands of your trading partner determine disappearance probability).

    Also, I liked the way in civ 3 that you could have it be necessary for a resource to be available to do a certain worker job. I did a Mars mod where you had to have Nitrogen and Water to build a greenhouse, so you had to build a "pipeline" ie road to any square before you could do any worker activity. That could be put back in civ4 and expanded, so military unit actions also require certain resources, ie fighting requires Ammunition and moving requires Fuel and healing requires Medicine and mere existence requires Packaged Food. Starving cities would also expend Packaged Food, increasing the chance of its disappearing (ie, the Packing Plant improvement goes away, representing depleted warehouses, and you are left with the Cow resource, and have to rebuild the Packing Plant)

    Also, the fat X is simplistic. The range of a cities exploitation should pertain to its transportation network. To work non adjacent squares you should need to have a road to them, and you should be able to work any square in the cultural borders that has railroad. In fact, hammers from improvements should represent raw material collection but a mound of wood doesn't turn into houses unless there are carpenters, so productivity should be capped by processing capacity in the city, which comes from staffed buildings.

    Also, improvements should require maintenance or they degrade.

    Also, under some civics you could have reduced production but a random chance of a possible building being built each turn (representing private enterprise), and there could be worker units that only automate, representing private enterprise again. Also reduced central beakers but an increased change of getting techs randomly by a breakthrough in the private sector.
     

Share This Page