Mucking about with prosperity & production

Users who are viewing this thread

I've been thinking lately of what could be done to make prosperity more relevant, as well as solve the now infamous village-town prosperity drain problem. I'm not much of a M&B modder (and I've already undertaken a major modding effort for another game), but I thought I could see if the issue could be solved with a few quick & dirty tweaks (which could then be ported into other mods, if successful). I have, however, zero experience of Python coding, my native languages are C and Matlab. If anyone wants to jump in, feel free to, and we'll brainstorm and experiment together!

I went digging in the code, and found the following snippets that might be relevant:

From module_scripts.py:
#script_game_get_item_buy_price_factor:
#script_game_get_item_buy_price_factor:
  # This script is called from the game engine for calculating the buying price of any item.
  # INPUT:
  # param1: item_kind_id
  # OUTPUT:
  # trigger_result and reg0 = price_factor
  ("game_get_item_buy_price_factor",
    [
      (store_script_param_1, ":item_kind_id"),
      (assign, ":price_factor", 100),

      (call_script, "script_get_trade_penalty", ":item_kind_id"),
      (assign, ":trade_penalty", reg0),

      (try_begin),
        (is_between, "$g_encountered_party", centers_begin, centers_end),
        (is_between, ":item_kind_id", trade_goods_begin, trade_goods_end),
        (store_sub, ":item_slot_no", ":item_kind_id", trade_goods_begin),
        (val_add, ":item_slot_no", slot_town_trade_good_prices_begin),
        (party_get_slot, ":price_factor", "$g_encountered_party", ":item_slot_no"),

(try_begin),
(is_between, "$g_encountered_party", villages_begin, villages_end),
(party_get_slot, ":market_town", "$g_encountered_party", slot_village_market_town),
(party_get_slot, ":price_in_market_town", ":market_town", ":item_slot_no"),
(val_max, ":price_factor", ":price_in_market_town"),
(try_end),

#For villages, the good will be sold no cheaper than in the market town
#This represents the absence of a permanent market -- ie, the peasants retain goods to sell on their journeys to town, and are not about to do giveaway deals with passing adventurers


        (val_mul, ":price_factor", 100), #normalize price factor to range 0..100
        (val_div, ":price_factor", average_price_factor),
      (try_end),
     
      (store_add, ":penalty_factor", 100, ":trade_penalty"),
     
      (val_mul, ":price_factor", ":penalty_factor"),
      (val_div, ":price_factor", 100),

      (assign, reg0, ":price_factor"),
      (set_trigger_result, reg0),
  ]),[/quote]

Selling and buying items (relevant for prosperity overall, might come in handy if wanting to make player trading make more of a difference on prosperity)
  #script_game_event_buy_item:
  # This script is called from the game engine when player buys an item.
  # INPUT:
  # param1: item_kind_id
  ("game_event_buy_item",
    [
      (store_script_param_1, ":item_kind_id"),
      (store_script_param_2, ":reclaim_mode"),
      (try_begin),
        (is_between, ":item_kind_id", trade_goods_begin, trade_goods_end),
        (store_sub, ":item_slot_no", ":item_kind_id", trade_goods_begin),
        (val_add, ":item_slot_no", slot_town_trade_good_prices_begin),
        (party_get_slot, ":multiplier", "$g_encountered_party", ":item_slot_no"),
        (try_begin),
          (eq, ":reclaim_mode", 0),
          (val_add, ":multiplier", 10),
        (else_try),
          (val_add, ":multiplier", 15),
        (try_end),
        (val_min, ":multiplier", maximum_price_factor),
        (party_set_slot, "$g_encountered_party", ":item_slot_no", ":multiplier"),
      (try_end),
  ]),
 
  #script_game_event_sell_item:
  # This script is called from the game engine when player sells an item.
  # INPUT:
  # param1: item_kind_id
  ("game_event_sell_item",
    [
      (store_script_param_1, ":item_kind_id"),
      (store_script_param_2, ":return_mode"),
      (try_begin),
        (is_between, ":item_kind_id", trade_goods_begin, trade_goods_end),
        (store_sub, ":item_slot_no", ":item_kind_id", trade_goods_begin),
        (val_add, ":item_slot_no", slot_town_trade_good_prices_begin),
        (party_get_slot, ":multiplier", "$g_encountered_party", ":item_slot_no"),
        (try_begin),
          (eq, ":return_mode", 0),
          (val_sub, ":multiplier", 15),
        (else_try),
          (val_sub, ":multiplier", 10),
        (try_end),
        (val_max, ":multiplier", minimum_price_factor),
        (party_set_slot, "$g_encountered_party", ":item_slot_no", ":multiplier"),
      (try_end),
  ]),

Economical properties of different goods. There are the variables slot_item_urban_demand, slot_item_rural_demand, and slot_item_desert_demand. I wonder, could village prosperity be increased by decreasing food demand in them (assuming that they're self-sufficient in food and only the surplus is shown produced)? Currently my hypothesis on what causes the village town prosperity drain is that towns are inherently more productive than villages, causing each trade between the two the prices of the town to increase. If villages consumed less, it would lead to more goods being left over, and as such lower prices in the village, and less economic drain on the town. Also, a less radical thing to do might simply be to boost the
    ("initialize_item_info",
    [
  # Setting food bonuses - these have been changed to incentivize using historical rations. Bread is the most cost-efficient
  #Staples
      (item_set_slot, "itm_bread", slot_item_food_bonus, :cool:, #brought up from 4
      (item_set_slot, "itm_grain", slot_item_food_bonus, 2), #new - can be boiled as porridge
 
  #Fat sources - preserved
      (item_set_slot, "itm_smoked_fish", slot_item_food_bonus, 4),
      (item_set_slot, "itm_dried_meat", slot_item_food_bonus, 5),
      (item_set_slot, "itm_cheese", slot_item_food_bonus, 5),
      (item_set_slot, "itm_sausages", slot_item_food_bonus, 5),
      (item_set_slot, "itm_butter", slot_item_food_bonus, 4), #brought down from 8

  #Fat sources - perishable
      (item_set_slot, "itm_chicken", slot_item_food_bonus, :cool:, #brought up from 7
      (item_set_slot, "itm_cattle_meat", slot_item_food_bonus, 7), #brought down from 7
      (item_set_slot, "itm_pork", slot_item_food_bonus, 6), #brought down from 6
 
  #Produce
      (item_set_slot, "itm_raw_olives", slot_item_food_bonus, 1),
      (item_set_slot, "itm_cabbages", slot_item_food_bonus, 2),
      (item_set_slot, "itm_raw_grapes", slot_item_food_bonus, 3),
      (item_set_slot, "itm_apples", slot_item_food_bonus, 4), #brought down from 5

  #Sweet items
      (item_set_slot, "itm_raw_date_fruit", slot_item_food_bonus, 4), #brought down from 8
      (item_set_slot, "itm_honey", slot_item_food_bonus, 6), #brought down from 12
     
      (item_set_slot, "itm_wine", slot_item_food_bonus, 5),
      (item_set_slot, "itm_ale", slot_item_food_bonus, 4),

  #Item economic settings  
  (item_set_slot, "itm_grain", slot_item_urban_demand, 20),
      (item_set_slot, "itm_grain", slot_item_rural_demand, 20),
      (item_set_slot, "itm_grain", slot_item_desert_demand, 20),
      (item_set_slot, "itm_grain", slot_item_production_slot, slot_center_acres_grain),
      (item_set_slot, "itm_grain", slot_item_production_string, "str_acres_grain"),
      (item_set_slot, "itm_grain", slot_item_base_price, 30),
 
      (item_set_slot, "itm_bread", slot_item_urban_demand, 30),
      (item_set_slot, "itm_bread", slot_item_rural_demand, 30),
      (item_set_slot, "itm_bread", slot_item_desert_demand, 30),
      (item_set_slot, "itm_bread", slot_item_production_slot, slot_center_mills),
      (item_set_slot, "itm_bread", slot_item_production_string, "str_mills"),
      (item_set_slot, "itm_bread", slot_item_primary_raw_material, "itm_grain"),
      (item_set_slot, "itm_bread", slot_item_input_number, 6),
      (item_set_slot, "itm_bread", slot_item_output_per_run, 6),
      (item_set_slot, "itm_bread", slot_item_overhead_per_run, 30),
      (item_set_slot, "itm_bread", slot_item_base_price, 50),
      (item_set_slot, "itm_bread", slot_item_enterprise_building_cost, 1500),
   
  (item_set_slot, "itm_ale", slot_item_urban_demand, 10),
  (item_set_slot, "itm_ale", slot_item_rural_demand, 15),
      (item_set_slot, "itm_ale", slot_item_desert_demand, 0),
      (item_set_slot, "itm_ale", slot_item_production_slot, slot_center_breweries),
      (item_set_slot, "itm_ale", slot_item_production_string, "str_breweries"),
      (item_set_slot, "itm_ale", slot_item_base_price, 120),
      (item_set_slot, "itm_ale", slot_item_primary_raw_material, "itm_grain"),
  (item_set_slot, "itm_ale", slot_item_input_number, 1),
      (item_set_slot, "itm_ale", slot_item_output_per_run, 2),
      (item_set_slot, "itm_ale", slot_item_overhead_per_run, 50),
      (item_set_slot, "itm_ale", slot_item_base_price, 120),
      (item_set_slot, "itm_ale", slot_item_enterprise_building_cost, 2500),
   
  (item_set_slot, "itm_wine", slot_item_urban_demand, 15),
  (item_set_slot, "itm_wine", slot_item_rural_demand, 10),
      (item_set_slot, "itm_wine", slot_item_desert_demand, 25),
      (item_set_slot, "itm_wine", slot_item_production_slot, slot_center_wine_presses),
      (item_set_slot, "itm_wine", slot_item_production_string, "str_presses"),
      (item_set_slot, "itm_wine", slot_item_primary_raw_material, "itm_raw_grapes"),
      (item_set_slot, "itm_wine", slot_item_input_number, 4),
      (item_set_slot, "itm_wine", slot_item_output_per_run, 2),
  (item_set_slot, "itm_wine", slot_item_overhead_per_run, 60),
      (item_set_slot, "itm_wine", slot_item_base_price, 220),
      (item_set_slot, "itm_wine", slot_item_enterprise_building_cost, 5000),

  (item_set_slot, "itm_raw_grapes", slot_item_urban_demand, 0),
  (item_set_slot, "itm_raw_grapes", slot_item_rural_demand, 0),
      (item_set_slot, "itm_raw_grapes", slot_item_desert_demand, 0),
      (item_set_slot, "itm_raw_grapes", slot_item_production_slot, slot_center_acres_vineyard),
      (item_set_slot, "itm_raw_grapes", slot_item_production_string, "str_acres_orchard"),
      (item_set_slot, "itm_raw_grapes", slot_item_is_raw_material_only_for, "itm_wine"),
      (item_set_slot, "itm_raw_grapes", slot_item_base_price, 75),

  (item_set_slot, "itm_apples", slot_item_urban_demand, 4),
  (item_set_slot, "itm_apples", slot_item_rural_demand, 4),
  (item_set_slot, "itm_apples", slot_item_desert_demand, 0),
      (item_set_slot, "itm_apples", slot_item_production_slot, slot_center_acres_vineyard),
      (item_set_slot, "itm_apples", slot_item_production_string, "str_acres_orchard"),
      (item_set_slot, "itm_apples", slot_item_base_price, 44),
 
      (item_set_slot, "itm_smoked_fish", slot_item_urban_demand, 16),
      (item_set_slot, "itm_smoked_fish", slot_item_rural_demand, 16),
      (item_set_slot, "itm_smoked_fish", slot_item_desert_demand, 16),
      (item_set_slot, "itm_smoked_fish", slot_item_production_slot, slot_center_fishing_fleet),
      (item_set_slot, "itm_smoked_fish", slot_item_production_string, "str_boats"),

      (item_set_slot, "itm_salt", slot_item_urban_demand, 5),
      (item_set_slot, "itm_salt", slot_item_rural_demand, 3),
      (item_set_slot, "itm_salt", slot_item_desert_demand, -1),
      (item_set_slot, "itm_salt", slot_item_production_slot, slot_center_salt_pans),
      (item_set_slot, "itm_salt", slot_item_production_string, "str_pans"),
 
      (item_set_slot, "itm_dried_meat", slot_item_urban_demand, 15),
      (item_set_slot, "itm_dried_meat", slot_item_rural_demand, 15),
      (item_set_slot, "itm_dried_meat", slot_item_desert_demand, 15),
      (item_set_slot, "itm_dried_meat", slot_item_production_slot, slot_center_head_cattle),
      (item_set_slot, "itm_dried_meat", slot_item_production_string, "str_head_cattle"),

      (item_set_slot, "itm_cheese", slot_item_urban_demand, 10),
      (item_set_slot, "itm_cheese", slot_item_rural_demand, 10),
      (item_set_slot, "itm_cheese", slot_item_desert_demand, 10),
      (item_set_slot, "itm_cheese", slot_item_production_slot, slot_center_head_cattle),
      (item_set_slot, "itm_cheese", slot_item_production_string, "str_head_cattle"),

      (item_set_slot, "itm_butter", slot_item_urban_demand, 2),
      (item_set_slot, "itm_butter", slot_item_rural_demand, 2),
      (item_set_slot, "itm_butter", slot_item_desert_demand, 2),
      (item_set_slot, "itm_butter", slot_item_production_slot, slot_center_head_cattle),
      (item_set_slot, "itm_butter", slot_item_production_string, "str_head_cattle"),

      (item_set_slot, "itm_leatherwork", slot_item_urban_demand, 10),
      (item_set_slot, "itm_leatherwork", slot_item_rural_demand, 10),
      (item_set_slot, "itm_leatherwork", slot_item_desert_demand, 10),
      (item_set_slot, "itm_leatherwork", slot_item_production_slot, slot_center_tanneries),
      (item_set_slot, "itm_leatherwork", slot_item_production_string, "str_tanneries"),
      (item_set_slot, "itm_leatherwork", slot_item_primary_raw_material, "itm_raw_leather"),
      (item_set_slot, "itm_leatherwork", slot_item_input_number, 3),
      (item_set_slot, "itm_leatherwork", slot_item_output_per_run, 3),
      (item_set_slot, "itm_leatherwork", slot_item_overhead_per_run, 50),
  (item_set_slot, "itm_leatherwork", slot_item_base_price, 220),
  (item_set_slot, "itm_leatherwork", slot_item_enterprise_building_cost, 8000),

      (item_set_slot, "itm_raw_leather", slot_item_urban_demand, 0),
      (item_set_slot, "itm_raw_leather", slot_item_rural_demand, 0),
      (item_set_slot, "itm_raw_leather", slot_item_desert_demand, 0),
      (item_set_slot, "itm_raw_leather", slot_item_production_slot, slot_center_head_cattle),
      (item_set_slot, "itm_raw_leather", slot_item_production_string, "str_head_cattle"),
      (item_set_slot, "itm_raw_leather", slot_item_is_raw_material_only_for, "itm_leatherwork"),
  (item_set_slot, "itm_raw_leather", slot_item_base_price, 120),
   
    (item_set_slot, "itm_sausages", slot_item_urban_demand, 5),
  (item_set_slot, "itm_sausages", slot_item_rural_demand, 5),
  (item_set_slot, "itm_sausages", slot_item_desert_demand, 5),
      (item_set_slot, "itm_sausages", slot_item_production_slot, slot_center_head_sheep),
      (item_set_slot, "itm_sausages", slot_item_production_string, "str_head_sheep"),
 
  (item_set_slot, "itm_wool", slot_item_urban_demand, 0),
  (item_set_slot, "itm_wool", slot_item_rural_demand, 0),
  (item_set_slot, "itm_wool", slot_item_desert_demand, 0),
      (item_set_slot, "itm_wool", slot_item_production_slot, slot_center_head_sheep),
      (item_set_slot, "itm_wool", slot_item_production_string, "str_head_sheep"),
  (item_set_slot, "itm_wool", slot_item_is_raw_material_only_for, "itm_wool_cloth"),
  (item_set_slot, "itm_wool", slot_item_base_price,130),

  (item_set_slot, "itm_wool_cloth", slot_item_urban_demand, 15),
  (item_set_slot, "itm_wool_cloth", slot_item_rural_demand, 20),
  (item_set_slot, "itm_wool_cloth", slot_item_desert_demand, 5),
      (item_set_slot, "itm_wool_cloth", slot_item_production_slot, slot_center_wool_looms),
      (item_set_slot, "itm_wool_cloth", slot_item_production_string, "str_looms"),
  (item_set_slot, "itm_wool_cloth", slot_item_primary_raw_material, "itm_wool"),
      (item_set_slot, "itm_wool_cloth", slot_item_input_number, 2),
      (item_set_slot, "itm_wool_cloth", slot_item_output_per_run, 2),
      (item_set_slot, "itm_wool_cloth", slot_item_overhead_per_run, 120),
  (item_set_slot, "itm_wool_cloth", slot_item_base_price, 250),
  (item_set_slot, "itm_wool_cloth", slot_item_enterprise_building_cost, 6000),
 
  (item_set_slot, "itm_raw_flax", slot_item_urban_demand, 0),
  (item_set_slot, "itm_raw_flax", slot_item_rural_demand, 0),
  (item_set_slot, "itm_raw_flax", slot_item_desert_demand, 0),
      (item_set_slot, "itm_raw_flax", slot_item_production_slot, slot_center_acres_flax),
      (item_set_slot, "itm_raw_flax", slot_item_production_string, "str_acres_flax"),
      (item_set_slot, "itm_raw_flax", slot_item_is_raw_material_only_for, "itm_linen"),
  (item_set_slot, "itm_raw_flax", slot_item_base_price, 150),

  (item_set_slot, "itm_linen", slot_item_urban_demand, 7),
  (item_set_slot, "itm_linen", slot_item_rural_demand, 3),
  (item_set_slot, "itm_linen", slot_item_desert_demand, 15),
      (item_set_slot, "itm_linen", slot_item_production_slot, slot_center_linen_looms),
      (item_set_slot, "itm_linen", slot_item_production_string, "str_looms"),
      (item_set_slot, "itm_linen", slot_item_primary_raw_material, "itm_raw_flax"),
      (item_set_slot, "itm_linen", slot_item_input_number, 2),
      (item_set_slot, "itm_linen", slot_item_output_per_run, 2),
      (item_set_slot, "itm_linen", slot_item_overhead_per_run, 120),
  (item_set_slot, "itm_linen", slot_item_base_price, 250),
  (item_set_slot, "itm_linen", slot_item_enterprise_building_cost, 6000),
 
  (item_set_slot, "itm_iron", slot_item_urban_demand, 0),
  (item_set_slot, "itm_iron", slot_item_rural_demand, 0),
  (item_set_slot, "itm_iron", slot_item_desert_demand, 0),
      (item_set_slot, "itm_iron", slot_item_production_slot, slot_center_iron_deposits),
      (item_set_slot, "itm_iron", slot_item_production_string, "str_deposits"),
      (item_set_slot, "itm_iron", slot_item_is_raw_material_only_for, "itm_tools"),
  (item_set_slot, "itm_iron", slot_item_base_price, 264),
 
  (item_set_slot, "itm_tools", slot_item_urban_demand, 7),
  (item_set_slot, "itm_tools", slot_item_rural_demand, 7),
  (item_set_slot, "itm_tools", slot_item_desert_demand, 7),
      (item_set_slot, "itm_tools", slot_item_production_slot, slot_center_smithies),
      (item_set_slot, "itm_tools", slot_item_production_string, "str_smithies"),
      (item_set_slot, "itm_tools", slot_item_primary_raw_material, "itm_iron"),
      (item_set_slot, "itm_tools", slot_item_input_number, 2),
      (item_set_slot, "itm_tools", slot_item_output_per_run, 2),
      (item_set_slot, "itm_tools", slot_item_overhead_per_run, 60),
  (item_set_slot, "itm_tools", slot_item_base_price, 410),
  (item_set_slot, "itm_tools", slot_item_enterprise_building_cost, 3500),
   
  (item_set_slot, "itm_pottery", slot_item_urban_demand, 5),
  (item_set_slot, "itm_pottery", slot_item_rural_demand, 5),
  (item_set_slot, "itm_pottery", slot_item_desert_demand, 5),
      (item_set_slot, "itm_pottery", slot_item_production_slot, slot_center_pottery_kilns),
      (item_set_slot, "itm_pottery", slot_item_production_string, "str_kilns"),
   
  (item_set_slot, "itm_oil", slot_item_urban_demand, 10),
  (item_set_slot, "itm_oil", slot_item_rural_demand, 5),
  (item_set_slot, "itm_oil", slot_item_desert_demand, -1),
      (item_set_slot, "itm_oil", slot_item_production_slot, slot_center_olive_presses),
      (item_set_slot, "itm_oil", slot_item_production_string, "str_presses"),
      (item_set_slot, "itm_oil", slot_item_primary_raw_material, "itm_raw_olives"),
      (item_set_slot, "itm_oil", slot_item_input_number, 6),
      (item_set_slot, "itm_oil", slot_item_output_per_run, 2),
      (item_set_slot, "itm_oil", slot_item_overhead_per_run, 80),
  (item_set_slot, "itm_oil", slot_item_base_price, 450),
  (item_set_slot, "itm_oil", slot_item_enterprise_building_cost, 4500),

  (item_set_slot, "itm_raw_olives", slot_item_urban_demand, 0),
  (item_set_slot, "itm_raw_olives", slot_item_rural_demand, 0),
  (item_set_slot, "itm_raw_olives", slot_item_desert_demand, 0),
      (item_set_slot, "itm_raw_olives", slot_item_production_slot, slot_center_acres_olives),
      (item_set_slot, "itm_raw_olives", slot_item_production_string, "str_olive_groves"),
      (item_set_slot, "itm_raw_olives", slot_item_is_raw_material_only_for, "itm_oil"),
  (item_set_slot, "itm_raw_olives", slot_item_base_price, 100),

  (item_set_slot, "itm_velvet", slot_item_urban_demand, 5),
  (item_set_slot, "itm_velvet", slot_item_rural_demand, 0),
  (item_set_slot, "itm_velvet", slot_item_desert_demand, -1),
      (item_set_slot, "itm_velvet", slot_item_production_slot, slot_center_silk_looms),
      (item_set_slot, "itm_velvet", slot_item_production_string, "str_looms"),
  (item_set_slot, "itm_velvet", slot_item_primary_raw_material, "itm_raw_silk"),
      (item_set_slot, "itm_velvet", slot_item_input_number, 2),
      (item_set_slot, "itm_velvet", slot_item_output_per_run, 2),
      (item_set_slot, "itm_velvet", slot_item_overhead_per_run, 160),
  (item_set_slot, "itm_velvet", slot_item_base_price, 1025),
  (item_set_slot, "itm_velvet", slot_item_secondary_raw_material, "itm_raw_dyes"),
  (item_set_slot, "itm_velvet", slot_item_enterprise_building_cost, 10000),

  (item_set_slot, "itm_raw_silk", slot_item_urban_demand, 0),
  (item_set_slot, "itm_raw_silk", slot_item_rural_demand, 0),
      (item_set_slot, "itm_raw_silk", slot_item_production_slot, slot_center_silk_farms),
      (item_set_slot, "itm_raw_silk", slot_item_production_string, "str_mulberry_groves"),
      (item_set_slot, "itm_raw_silk", slot_item_is_raw_material_only_for, "itm_velvet"),
      (item_set_slot, "itm_raw_silk", slot_item_base_price, 600),

  (item_set_slot, "itm_raw_dyes", slot_item_urban_demand, 3),
  (item_set_slot, "itm_raw_dyes", slot_item_rural_demand, 0),
  (item_set_slot, "itm_raw_dyes", slot_item_desert_demand, -1),
  (item_set_slot, "itm_raw_dyes", slot_item_production_string, "str_caravans"),
  (item_set_slot, "itm_raw_dyes", slot_item_base_price, 200),
 
  (item_set_slot, "itm_spice", slot_item_urban_demand, 5),
  (item_set_slot, "itm_spice", slot_item_rural_demand, 0),
  (item_set_slot, "itm_spice", slot_item_desert_demand, 5),
  (item_set_slot, "itm_spice", slot_item_production_string, "str_caravans"),
 
  (item_set_slot, "itm_furs", slot_item_urban_demand, 5),
  (item_set_slot, "itm_furs", slot_item_rural_demand, 0),
  (item_set_slot, "itm_furs", slot_item_desert_demand, -1),
  (item_set_slot, "itm_furs", slot_item_production_slot, slot_center_fur_traps),
  (item_set_slot, "itm_furs", slot_item_production_string, "str_traps"),

      (item_set_slot, "itm_honey", slot_item_urban_demand, 5),
      (item_set_slot, "itm_honey", slot_item_rural_demand, 5),
      (item_set_slot, "itm_honey", slot_item_desert_demand, 5),
      (item_set_slot, "itm_honey", slot_item_production_slot, slot_center_apiaries),
      (item_set_slot, "itm_honey", slot_item_production_string, "str_hives"),
 
      (item_set_slot, "itm_cabbages", slot_item_urban_demand, 7),
      (item_set_slot, "itm_cabbages", slot_item_rural_demand, 7),
      (item_set_slot, "itm_cabbages", slot_item_desert_demand, 7),
      (item_set_slot, "itm_cabbages", slot_item_production_slot, slot_center_household_gardens),
      (item_set_slot, "itm_cabbages", slot_item_production_string, "str_gardens"),

      (item_set_slot, "itm_raw_date_fruit", slot_item_urban_demand, 7),
      (item_set_slot, "itm_raw_date_fruit", slot_item_rural_demand, 7),
      (item_set_slot, "itm_raw_date_fruit", slot_item_desert_demand, 7),
      (item_set_slot, "itm_raw_date_fruit", slot_item_production_slot, slot_center_household_gardens),
      (item_set_slot, "itm_raw_date_fruit", slot_item_production_string, "str_acres_oasis"),
 
(continued due to post being split for being too big due to stuff under spoiler tags)

Initialize the economy. This seems to be where it's hardcoded what stuff is produced where. I was surprised to see that towns seem to produce a bit of grain too, representing surrounding fields "included" in the town according to the comments. It seems like this modest grain production is what makes towns keeping going even when the villages around have been burned. How do you think it would work to remove this grain entirely? It's not like any fields, no matter how close, would be immune to getting torched by raiders without capturing the town itself. If this grain was removed (and other production facilities increased to compensate), I suspect we might get a situation where a town being fed by the countryside would be an awesome centre of industry, but one whose villages would burn (and caravans raided) would turn destitute from food getting ludicrously expensive. That might reverse the absurd situation where looting of the villages actually benefits, rather than harms, the town.
    ("initialize_economic_information",
    [     
    #All towns produce tools, pottery, and wool cloth for sale in countryside
(try_for_range, ":town_no", towns_begin, towns_end),
(party_set_slot, ":town_no", slot_center_wool_looms, 20),
(party_set_slot, ":town_no", slot_center_breweries, 2),
(party_set_slot, ":town_no", slot_center_pottery_kilns, 10),
(party_set_slot, ":town_no", slot_center_smithies, 15),
(party_set_slot, ":town_no", slot_center_mills, 5),
(party_set_slot, ":town_no", slot_center_tanneries, 2),
(party_set_slot, ":town_no", slot_center_wine_presses, 1),
(party_set_slot, ":town_no", slot_center_olive_presses, 2),

(party_set_slot, ":town_no", slot_center_acres_grain, 1000), #Surrounding fields
(party_set_slot, ":town_no", slot_center_acres_vineyard, 1000), #Surrounding fields

    (try_end),
 
(party_set_slot, "p_town_1", slot_center_linen_looms, 15), #Sargoth

(party_set_slot, "p_town_2", slot_center_salt_pans, 5), #Tihr
(party_set_slot, "p_town_2", slot_center_fishing_fleet, 25), #Tihr

(party_set_slot, "p_town_3", slot_center_wine_presses, 10), #Veluca

(party_set_slot, "p_town_4", slot_center_olive_presses, 15), #Suno

(party_set_slot, "p_town_5", slot_center_silk_looms, 20), #Jelkaka
(party_set_slot, "p_town_5", slot_center_fishing_fleet, 30), #Jelkala

(party_set_slot, "p_town_6", slot_center_breweries, 10), #Praven
(party_set_slot, "p_town_6", slot_center_tanneries, 4),     #Praven
(party_set_slot, "p_town_6", slot_center_fishing_fleet, 10), #Praven

(party_set_slot, "p_town_7", slot_center_mills, 15), #Uxkhal
(party_set_slot, "p_town_7", slot_center_tanneries, 4),     #Uxkhal

(party_set_slot, "p_town_8", slot_center_smithies, 25),     #Reyvadin
(party_set_slot, "p_town_8", slot_center_wool_looms, 35),     #Reyvadin
(party_set_slot, "p_town_8", slot_center_tanneries, 4),     #Reyvadin

(party_set_slot, "p_town_9", slot_center_smithies, 1:cool:,     #Khudan
(party_set_slot, "p_town_9", slot_center_tanneries, 3),     #Khudan
(party_set_slot, "p_town_9", slot_center_fishing_fleet, 5), #Khudan

(party_set_slot, "p_town_10", slot_center_salt_pans, 2),     #Tulga

(party_set_slot, "p_town_11", slot_center_smithies, 19), #Curaw
(party_set_slot, "p_town_11", slot_center_fishing_fleet, 10), #Khudan

    (party_set_slot, "p_town_12", slot_center_salt_pans, 5), #Wercheg
(party_set_slot, "p_town_12", slot_center_fishing_fleet, 25), #Wercheg

(party_set_slot, "p_town_13", slot_center_wool_looms, 30),     #Rivacheg
(party_set_slot, "p_town_13", slot_center_tanneries, 5),     #Rivacheg
(party_set_slot, "p_town_13", slot_center_fishing_fleet, 20), #Rivacheg

    (party_set_slot, "p_town_14", slot_center_salt_pans, 2), #Halmar
(party_set_slot, "p_town_14", slot_center_tanneries, 3),     #Halmar

(party_set_slot, "p_town_15", slot_center_smithies, 20), #Yalen
(party_set_slot, "p_town_15", slot_center_wine_presses, 5), #Yalen
(party_set_slot, "p_town_15", slot_center_olive_presses, 5), #Yalen
(party_set_slot, "p_town_15", slot_center_fishing_fleet, 25), #Yalen

(party_set_slot, "p_town_16", slot_center_smithies, 30), #Dhirim
(party_set_slot, "p_town_16", slot_center_tanneries, 4),     #Dhirim

(party_set_slot, "p_town_17", slot_center_wool_looms, 40),     #Ichamur

(party_set_slot, "p_town_18", slot_center_wool_looms, 35),     #narra
(party_set_slot, "p_town_18", slot_center_wine_presses, 4), #narra
 
(party_set_slot, "p_town_19", slot_center_tanneries, 5),     #Shariz
(party_set_slot, "p_town_19", slot_center_breweries, 0),     #Shariz
(party_set_slot, "p_town_19", slot_center_wine_presses, 3), #Shariz
(party_set_slot, "p_town_19", slot_center_fishing_fleet, 5), #Shariz

(party_set_slot, "p_town_20", slot_center_tanneries, 5),     #Darquba
(party_set_slot, "p_town_20", slot_center_breweries, 0),     #Darquba
(party_set_slot, "p_town_20", slot_center_wine_presses, 2), #Darquba

(party_set_slot, "p_town_21", slot_center_tanneries, 5),     #Ahmerrad
(party_set_slot, "p_town_21", slot_center_breweries, 0),     #Ahmerrad
(party_set_slot, "p_town_21", slot_center_wine_presses, 2), #Ahmerrad
 
(party_set_slot, "p_town_22", slot_center_tanneries, 5),     #Bariyye
(party_set_slot, "p_town_22", slot_center_breweries, 0),     #Bariyye



    (try_for_range, ":village_no", villages_begin, villages_end),
        (store_random_in_range, ":random_cattle", 35, 65),
        (party_set_slot, ":village_no", slot_center_head_cattle, ":random_cattle"),

        (store_random_in_range, ":random_sheep", 90, 120),
        (party_set_slot, ":village_no", slot_center_head_sheep, ":random_sheep"),

(party_set_slot, ":village_no", slot_center_acres_grain, 10000), #10 acres for each of 1000 households
(party_set_slot, ":village_no", slot_center_acres_vineyard, 500), #10 acres for each of 1000 households
(party_set_slot, ":village_no", slot_center_acres_olives, 200), #10 acres for each of 1000 households

(party_set_slot, ":village_no", slot_center_apiaries, 1),
(party_set_slot, ":village_no", slot_center_mills, 1),
(party_set_slot, ":village_no", slot_center_pottery_kilns, 1),


(try_begin),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_1"), #Sargoth, flax
(party_set_slot, ":village_no", slot_center_acres_flax, 8000),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_2"), #Wercheg

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_3"), #veluca
(party_set_slot, ":village_no", slot_center_acres_vineyard, 2000),
(party_set_slot, ":village_no", slot_center_acres_olives, 4000),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_4"), #suno
(party_set_slot, ":village_no", slot_center_acres_grain, 12000),
(party_set_slot, ":village_no", slot_center_acres_olives, 5000),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_5"), #jelkala
(party_set_slot, ":village_no", slot_center_silk_farms, 500),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_6"), #praven
(party_set_slot, ":village_no", slot_center_acres_grain, 15000),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_7"), #uxkhal
(party_set_slot, ":village_no", slot_center_acres_grain, 15000),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_8"), #reyvadin
(party_set_slot, ":village_no", slot_center_head_cattle, 100),
(party_set_slot, ":village_no", slot_center_acres_grain, 12000),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_9"), #khudan
(party_set_slot, ":village_no", slot_center_fur_traps, 4),
(party_set_slot, ":village_no", slot_center_acres_vineyard, 0),
(party_set_slot, ":village_no", slot_center_acres_olives, 0),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_10"), #tulga
(party_set_slot, ":village_no", slot_center_head_sheep, 150),
(party_set_slot, ":village_no", slot_center_acres_grain, 8000),
(party_set_slot, ":village_no", slot_center_salt_pans, 1),
(party_set_slot, ":village_no", slot_center_fur_traps, 1),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_11"), #curaw
(party_set_slot, ":village_no", slot_center_iron_deposits, 10),
(party_set_slot, ":village_no", slot_center_fur_traps, 3),
(party_set_slot, ":village_no", slot_center_acres_vineyard, 0),
(party_set_slot, ":village_no", slot_center_acres_olives, 0),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_12"), #rivacheg
(party_set_slot, ":village_no", slot_center_head_cattle, 75),
(party_set_slot, ":village_no", slot_center_acres_grain, 12000),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_13"), #Wercheg

#14Halmar has a salt pan nearby
(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_14"), #Halmar
(party_set_slot, ":village_no", slot_center_salt_pans, 1),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_15"), #yalen
(party_set_slot, ":village_no", slot_center_acres_vineyard, 2000),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_16"), #dhirim
(party_set_slot, ":village_no", slot_center_iron_deposits, 7),

#17 Ichamur
(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_17"), #ichamur
(party_set_slot, ":village_no", slot_center_acres_grain, 12000),
(party_set_slot, ":village_no", slot_center_fur_traps, 1),

#18 Narra
(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_18"), #narra
(party_set_slot, ":village_no", slot_center_iron_deposits, 2),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_19"), #
(party_set_slot, ":village_no", slot_center_acres_grain, 7000),
(party_set_slot, ":village_no", slot_center_acres_vineyard, 2000),
(party_set_slot, ":village_no", slot_center_acres_flax, 2000),
(party_set_slot, ":village_no", slot_center_acres_olives, 3000),
(party_set_slot, ":village_no", slot_center_acres_dates, 8000),
(party_set_slot, ":village_no", slot_center_salt_pans, 1),
(party_set_slot, ":village_no", slot_center_head_sheep, 150),
(party_set_slot, ":village_no", slot_center_head_cattle, 30),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_20"), #
(party_set_slot, ":village_no", slot_center_acres_grain, 7000),
(party_set_slot, ":village_no", slot_center_acres_vineyard, 2000),
(party_set_slot, ":village_no", slot_center_acres_olives, 3000),
(party_set_slot, ":village_no", slot_center_acres_dates, 8000),
(party_set_slot, ":village_no", slot_center_salt_pans, 1),
(party_set_slot, ":village_no", slot_center_head_sheep, 150),
(party_set_slot, ":village_no", slot_center_head_cattle, 30),
(party_set_slot, ":village_no", slot_center_linen_looms, 30),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_21"), #Ahmerrad -- hillside
(party_set_slot, ":village_no", slot_center_acres_grain, 9000),
(party_set_slot, ":village_no", slot_center_acres_vineyard, 2000),
(party_set_slot, ":village_no", slot_center_acres_olives, 4000),
(party_set_slot, ":village_no", slot_center_acres_dates, 2000),
(party_set_slot, ":village_no", slot_center_iron_deposits, :cool:,
(party_set_slot, ":village_no", slot_center_head_sheep, 150),
(party_set_slot, ":village_no", slot_center_head_cattle, 30),

(else_try),
(party_slot_eq, ":village_no", slot_village_market_town, "p_town_22"), #Bariyye -- deep desert
(party_set_slot, ":village_no", slot_center_acres_grain, 5000),
(party_set_slot, ":village_no", slot_center_acres_vineyard, 2000),
(party_set_slot, ":village_no", slot_center_acres_flax, 2000),
(party_set_slot, ":village_no", slot_center_acres_olives, 3000),
(party_set_slot, ":village_no", slot_center_acres_dates, 8000),
(party_set_slot, ":village_no", slot_center_salt_pans, 3),
(party_set_slot, ":village_no", slot_center_iron_deposits, 5),
(party_set_slot, ":village_no", slot_center_head_sheep, 150),
(party_set_slot, ":village_no", slot_center_head_cattle, 30),

(try_end),
    (try_end),
 
#Ocean and river villages, new map 
 
#, , , , , , Vajayeg, ,  Tismir, , Shapeshte, , Kulum, Aldalen, Gisim, , Balanli, Elberl,Nemeija, , Iyindah, Veidar. , , ,., , ,

    (party_set_slot, "p_village_1", slot_center_fishing_fleet, 15), #Yaragar
    (party_set_slot, "p_village_3", slot_center_fishing_fleet, 15), #Azgad
    (party_set_slot, "p_village_5", slot_center_fishing_fleet, 15), #Kulum

    (party_set_slot, "p_village_8", slot_center_fishing_fleet, 15), #Haen
    (party_set_slot, "p_village_9", slot_center_fishing_fleet, 15), #Buvran

    (party_set_slot, "p_village_20", slot_center_fishing_fleet, 15), #Uslum
    (party_set_slot, "p_village_21", slot_center_fishing_fleet, 15), #Bazeck
    (party_set_slot, "p_village_23", slot_center_fishing_fleet, 15), #Ilvia
    (party_set_slot, "p_village_27", slot_center_fishing_fleet, 15), #Glunmar

    (party_set_slot, "p_village_30", slot_center_fishing_fleet, 20), #Ruvar
    (party_set_slot, "p_village_31", slot_center_fishing_fleet, 15), #Ambean
    (party_set_slot, "p_village_35", slot_center_fishing_fleet, 15), #Feacharin

    (party_set_slot, "p_village_47", slot_center_fishing_fleet, 15), #Epeshe
    (party_set_slot, "p_village_49", slot_center_fishing_fleet, 15), #Tismirr

    (party_set_slot, "p_village_51", slot_center_fishing_fleet, 15), #Jelbegi
    (party_set_slot, "p_village_56", slot_center_fishing_fleet, 15), #Fenada

    (party_set_slot, "p_village_66", slot_center_fishing_fleet, 15), #Fisdnar
#    (party_set_slot, "p_village_67", slot_center_fishing_fleet, 15), #Tebandra
    (party_set_slot, "p_village_68", slot_center_fishing_fleet, 15), #Ibdeles
    (party_set_slot, "p_village_69", slot_center_fishing_fleet, 15), #Kwynn

    (party_set_slot, "p_village_77", slot_center_fishing_fleet, 25), #Rizi - Estuary
    (party_set_slot, "p_village_79", slot_center_fishing_fleet, 15), #Istiniar

(party_set_slot, "p_village_81", slot_center_fishing_fleet, 15), #Odasan
    (party_set_slot, "p_village_85", slot_center_fishing_fleet, 15), #Ismirala
    (party_set_slot, "p_village_87", slot_center_fishing_fleet, 15), #Udiniad

    (party_set_slot, "p_village_90", slot_center_fishing_fleet, 15), #Jamiche

#  (party_set_slot, "p_village_18", slot_center_fishing_fleet, 20), #Ulburban
#    (party_set_slot, "p_village_26", slot_center_fishing_fleet, 20), #Pagundur
#    (party_set_slot, "p_village_36", slot_center_fishing_fleet, 25), #Jayek

#Initialize pastureland
(try_for_range, ":center", centers_begin, centers_end),
(party_get_slot, ":head_cattle", ":center", slot_center_head_cattle),
(party_get_slot, ":head_sheep", ":center", slot_center_head_sheep),
(store_mul, ":num_acres", ":head_cattle", 4),
(val_add, ":num_acres", ":head_sheep"),
(val_add, ":num_acres", ":head_sheep"),
(val_mul, ":num_acres", 6),
(val_div, ":num_acres", 5),
(party_set_slot, ":center", slot_center_acres_pasture, ":num_acres"),

(try_end),
 
#Initialize prices based on production, etc
    (try_for_range, ":unused", 0, 15), #15 cycles = 45 days. For a village with -20 production, this should lead to approximate +1000, modified
        (call_script, "script_update_trade_good_prices"), #changes prices based on production
        (call_script, "script_update_trade_good_prices"),
        (call_script, "script_update_trade_good_prices"),

(call_script, "script_average_trade_good_prices"), #Conduct virtual trade  twice   
(call_script, "script_average_trade_good_prices"),

    (try_end),
 
#Initialize prosperity based on final prices
    (try_for_range, ":center_no", centers_begin, centers_end),
      (neg|is_between, ":center_no", castles_begin, castles_end),
      (store_random_in_range, ":random_prosperity_adder", -10, 10),
      (call_script, "script_get_center_ideal_prosperity", ":center_no"),
      (assign, ":prosperity", reg0),
      (val_add, ":prosperity", ":random_prosperity_adder"),
      (val_clamp, ":prosperity", 0, 100),
      (party_set_slot, ":center_no", slot_town_prosperity, ":prosperity"),               
(try_end),

(call_script, "script_calculate_castle_prosperities_by_using_its_villages"),
    ]),
 
(continued)

Center production. I'm not understanding exactly what goes on here, but it seems like it's the ratios for how much stuff actually gets produced per "production building" in the above code. Convenient, I suppose, for changing general production volume of a specific good by a simple change of one variable.
  ("center_get_production",
    [
#Actually, this could be reset somewhat to yield supply and demand as raw numbers
#Demand could be set values for rural and urban
#Supply could be based on capital goods -- head of cattle, head of sheep, fish ponds, fishing fleets, acres of grain fields, olive orchards, olive presses, wine presses, mills, smithies, salt pans, potters' kilns, etc
#Prosperity would increase both demand and supply
(store_script_param_1, ":center_no"),
(store_script_param_2, ":cur_good"),
 
(assign, ":base_production", 0),

#Grain products
(try_begin),
(eq, ":cur_good", "itm_bread"), #Demand = 3000 across Calradia
(party_get_slot, ":base_production", ":center_no", slot_center_mills),
(val_mul, ":base_production", 20), #one mills per village, five mills per town = 160 mills
(else_try),
(eq, ":cur_good", "itm_grain"), #Demand =  3200+, 1600 to mills, 1500 on its own, extra to breweries
(party_get_slot, ":base_production", ":center_no", slot_center_acres_grain),
(val_div, ":base_production", 125), #10000 acres is the average across Calradia, extra in Swadia, less in snows and steppes, a bit from towns
(else_try),
(eq, ":cur_good", "itm_ale"), #
(party_get_slot, ":base_production", ":center_no", slot_center_breweries),
(val_mul, ":base_production", 35),

(else_try),
(eq, ":cur_good", "itm_smoked_fish"), #Demand = 20
(party_get_slot, ":base_production", ":center_no", slot_center_fishing_fleet),
(val_mul, ":base_production", 4), #was originally 5
(else_try),
(eq, ":cur_good", "itm_salt"),
(party_get_slot, ":base_production", ":center_no", slot_center_salt_pans),
(val_mul, ":base_production", 35),

#Cattle products
(else_try),
(eq, ":cur_good", "itm_cattle_meat"), #Demand = 5
(party_get_slot, ":base_production", ":center_no", slot_center_head_cattle),
(val_div, ":base_production", 9),
(else_try),
(eq, ":cur_good", "itm_dried_meat"), #Demand = 15
(party_get_slot, ":base_production", ":center_no", slot_center_head_cattle),
(val_div, ":base_production", 3),
(else_try),
(eq, ":cur_good", "itm_cheese"), #Demand = 10
(party_get_slot, ":base_production", ":center_no", slot_center_head_cattle),
(val_div, ":base_production", 4),
(else_try),
(eq, ":cur_good", "itm_butter"), #Demand = 2
(party_get_slot, ":base_production", ":center_no", slot_center_head_cattle),
(val_div, ":base_production", 20),

(else_try),
(eq, ":cur_good", "itm_raw_leather"), #Demand = ??
(party_get_slot, ":base_production", ":center_no", slot_center_head_cattle),
(val_div, ":base_production", 6),
(party_get_slot, ":sheep_addition", ":center_no", slot_center_head_sheep),
(val_div, ":sheep_addition", 12),
(val_add, ":base_production", ":sheep_addition"),

(else_try),
(eq, ":cur_good", "itm_leatherwork"), #Demand = ??
(party_get_slot, ":base_production", ":center_no", slot_center_tanneries),
(val_mul, ":base_production", 20),


(else_try),
(eq, ":cur_good", "itm_honey"), #Demand = 5
(party_get_slot, ":base_production", ":center_no", slot_center_apiaries),
(val_mul, ":base_production", 6),
(else_try),
(eq, ":cur_good", "itm_cabbages"), #Demand = 7
(is_between, ":center_no", villages_begin, villages_end),
(assign, ":base_production", :cool:,
(else_try),
(eq, ":cur_good", "itm_apples"), #Demand = 7
(is_between, ":center_no", villages_begin, villages_end),
(assign, ":base_production", 5),

#Sheep products
(else_try),
(eq, ":cur_good", "itm_sausages"), #Demand = 5
(party_get_slot, ":base_production", ":center_no", slot_center_head_sheep), #average of 90 sheep
(val_div, ":base_production", 15),
(else_try),
(eq, ":cur_good", "itm_wool"), #(Demand = 0, but 15 averaged out perhaps)
(party_get_slot, ":base_production", ":center_no", slot_center_head_sheep), #average of 90 sheep
(val_div, ":base_production", 5),
(else_try),
(eq, ":cur_good", "itm_wool_cloth"), #(Demand = 1500 across Calradia)
(party_get_slot, ":base_production", ":center_no", slot_center_wool_looms),
(val_mul, ":base_production", 5), #300 across Calradia

(else_try),
(eq, ":cur_good", "itm_iron"), #Demand = 5, one supplies three smithies
(party_get_slot, ":base_production", ":center_no", slot_center_iron_deposits),
(val_mul, ":base_production", 10),
(else_try),
(eq, ":cur_good", "itm_tools"), #Demand = 560 across Calradia
(party_get_slot, ":base_production", ":center_no", slot_center_smithies),
(val_mul, ":base_production", 3),

#Other artisanal goods
(else_try),
(eq, ":cur_good", "itm_pottery"), #560 is total demand
(party_get_slot, ":base_production", ":center_no", slot_center_pottery_kilns),
(val_mul, ":base_production", 2),

(else_try),
(eq, ":cur_good", "itm_raw_grapes"),
(party_get_slot, ":base_production", ":center_no", slot_center_acres_vineyard),
(val_div, ":base_production", 100),
(else_try),
(eq, ":cur_good", "itm_wine"),
(party_get_slot, ":base_production", ":center_no", slot_center_wine_presses),
(val_mul, ":base_production", 30),


(else_try),
(eq, ":cur_good", "itm_raw_olives"),
(party_get_slot, ":base_production", ":center_no", slot_center_acres_olives),
(val_div, ":base_production", 150),
(else_try),
(eq, ":cur_good", "itm_oil"),
(party_get_slot, ":base_production", ":center_no", slot_center_olive_presses),
(val_mul, ":base_production", 12),

#Flax and linen
(else_try),
(eq, ":cur_good", "itm_linen"),
(party_get_slot, ":base_production", ":center_no", slot_center_linen_looms),
(val_mul, ":base_production", 5),
(else_try),
(eq, ":cur_good", "itm_raw_flax"),
(party_get_slot, ":base_production", ":center_no", slot_center_acres_flax),
(val_div, ":base_production", 65),


(else_try),
(eq, ":cur_good", "itm_velvet"),
(party_get_slot, ":base_production", ":center_no", slot_center_silk_looms),
(val_mul, ":base_production", 5),
(else_try),
(eq, ":cur_good", "itm_raw_silk"),
(party_get_slot, ":base_production", ":center_no", slot_center_silk_farms),
(val_div, ":base_production", 20),
(else_try),
(eq, ":cur_good", "itm_raw_dyes"),
(this_or_next|eq, ":center_no", "p_town_5"),
(eq, ":center_no", "p_town_22"),
(assign, ":base_production", 50),


(else_try),
(eq, ":cur_good", "itm_raw_date_fruit"),
(party_get_slot, ":base_production", ":center_no", slot_center_acres_dates),
(val_div, ":base_production", 120),
(else_try),
(eq, ":cur_good", "itm_furs"), #Demand = 90 across Calradia
(party_get_slot, ":base_production", ":center_no", slot_center_fur_traps),
(val_mul, ":base_production", 3),
(else_try),
(eq, ":cur_good", "itm_spice"),
(try_begin),
(eq, ":center_no", "p_town_10"), #Tulga
(assign, ":base_production", 100),
(else_try),
(eq, ":center_no", "p_town_17"), #Ichamur
(assign, ":base_production", 40),
(else_try),
(eq, ":center_no", "p_town_19"), #Shariz
(assign, ":base_production", 30),
(else_try),
(eq, ":center_no", "p_town_22"), #Bariyye
(assign, ":base_production", 30),
(try_end),
(try_end),





#Modify production by other goods
(assign, ":modified_production", ":base_production"),
(try_begin),
(eq, ":cur_good", "itm_bread"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_grain", ":base_production", 1),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_ale"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_grain", ":base_production", 2),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_dried_meat"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_salt", ":base_production", 2),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_smoked_fish"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_salt", ":base_production", 2),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_tools"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_iron", ":base_production", 1),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_wool_cloth"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_wool", ":base_production", 1),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_wine"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_raw_grapes", ":base_production", 1),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_oil"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_raw_olives", ":base_production", 1),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_velvet"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_raw_silk", ":base_production", 1),
(assign, ":initially_modified_production", reg0),

(call_script, "script_good_price_affects_good_production", ":center_no", "itm_raw_dyes", ":initially_modified_production", 2),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_leatherwork"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_raw_leather", ":base_production", 1),
(assign, ":modified_production", reg0),
(else_try),
(eq, ":cur_good", "itm_linen"),
(call_script, "script_good_price_affects_good_production", ":center_no", "itm_raw_flax", ":base_production", 1),
(assign, ":modified_production", reg0),
(try_end),


(assign, ":base_production_modded_by_raw_materials", ":modified_production"), #this is just logged for the report screen

    #Increase both positive and negative production by the center's prosperity
#Richer towns have more people and consume more, but also produce more
(try_begin),
(party_get_slot, ":prosperity_plus_75", ":center_no", slot_town_prosperity),
(val_add, ":prosperity_plus_75", 75),
(val_mul, ":modified_production", ":prosperity_plus_75"),
(val_div, ":modified_production", 125),
(try_end),
 
(try_begin),
    (this_or_next|party_slot_eq, ":center_no", slot_village_state, svs_being_raided),
        (party_slot_eq, ":center_no", slot_village_state, svs_looted),
    (assign, ":modified_production", 0),
(try_end),

    (assign, reg0, ":modified_production"), #modded by prosperity
    (assign, reg1, ":base_production_modded_by_raw_materials"),
    (assign, reg2, ":base_production"),
 
]),

And the consumption side of it. Can't think right now of what help it might be, just putting it here in case it'd turn out to be relevant.
  ("center_get_consumption",
    [
(store_script_param_1, ":center_no"),
(store_script_param_2, ":cur_good"),

(assign, ":consumer_consumption", 0),
(try_begin),
(this_or_next|is_between, ":center_no", "p_town_19", "p_castle_1"),
(ge, ":center_no", "p_village_91"),
(item_slot_ge, ":cur_good", slot_item_desert_demand, 0), #Otherwise use rural or urban
(item_get_slot, ":consumer_consumption", ":cur_good", slot_item_desert_demand),
(else_try),
(is_between, ":center_no", villages_begin, villages_end),
(item_get_slot, ":consumer_consumption", ":cur_good", slot_item_rural_demand),
(else_try),
(is_between, ":center_no", towns_begin, towns_end),
(item_get_slot, ":consumer_consumption", ":cur_good", slot_item_urban_demand),
(try_end),


(assign, ":raw_material_consumption", 0),
(try_begin),
(eq, ":cur_good", "itm_grain"),
(party_get_slot, ":grain_for_bread", ":center_no", slot_center_mills),
(val_mul, ":grain_for_bread", 20),

(party_get_slot, ":grain_for_ale", ":center_no", slot_center_breweries),
(val_mul, ":grain_for_ale", 5),

(store_add, ":raw_material_consumption", ":grain_for_bread", ":grain_for_ale"),

(else_try),
(eq, ":cur_good", "itm_iron"),
(party_get_slot, ":raw_material_consumption", ":center_no", slot_center_smithies),
(val_mul, ":raw_material_consumption", 3),

(else_try),
(eq, ":cur_good", "itm_wool"),
(party_get_slot, ":raw_material_consumption", ":center_no", slot_center_wool_looms),
(val_mul, ":raw_material_consumption", 5),

(else_try),
(eq, ":cur_good", "itm_raw_flax"),
(party_get_slot, ":raw_material_consumption", ":center_no", slot_center_linen_looms),
(val_mul, ":raw_material_consumption", 5),

(else_try),
(eq, ":cur_good", "itm_raw_leather"),
(party_get_slot, ":raw_material_consumption", ":center_no", slot_center_tanneries),
(val_mul, ":raw_material_consumption", 20),

(else_try),
(eq, ":cur_good", "itm_raw_grapes"),
(party_get_slot, ":raw_material_consumption", ":center_no", slot_center_wine_presses),
(val_mul, ":raw_material_consumption", 30),

(else_try),
(eq, ":cur_good", "itm_raw_olives"),
(party_get_slot, ":raw_material_consumption", ":center_no", slot_center_olive_presses),
(val_mul, ":raw_material_consumption", 12),


(else_try),
(eq, ":cur_good", "itm_raw_dyes"),
(party_get_slot, ":raw_material_consumption", ":center_no", slot_center_silk_looms),
(val_mul, ":raw_material_consumption", 1),
(else_try),
(eq, ":cur_good", "itm_raw_silk"),
(party_get_slot, ":raw_material_consumption", ":center_no", slot_center_silk_looms),
(val_mul, ":raw_material_consumption", 5),


(else_try),
(eq, ":cur_good", "itm_salt"),
(party_get_slot, ":salt_for_beef", ":center_no", slot_center_head_cattle),
(val_div, ":salt_for_beef", 10),

(party_get_slot, ":salt_for_fish", ":center_no", slot_center_fishing_fleet),
(val_div, ":salt_for_fish", 5),

(store_add, ":raw_material_consumption", ":salt_for_beef", ":salt_for_fish"),
(try_end),

(try_begin), #Reduce consumption of raw materials if their cost is high
(gt, ":raw_material_consumption", 0),
(store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin),
        (store_add, ":cur_good_price_slot", ":cur_good", ":item_to_price_slot"),
        (party_get_slot, ":cur_center_price", ":center_no", ":cur_good_price_slot"),
(gt, ":cur_center_price", 1000),
(val_mul, ":raw_material_consumption", 1000),
(val_div, ":raw_material_consumption", ":cur_center_price"),
(try_end),



(store_add, ":modified_consumption", ":consumer_consumption", ":raw_material_consumption"),
(try_begin),
(party_get_slot, ":prosperity_plus_75", ":center_no", slot_town_prosperity),
(val_add, ":prosperity_plus_75", 75),
(val_mul, ":modified_consumption", ":prosperity_plus_75"),
(val_div, ":modified_consumption", 125),
(try_end),


    (assign, reg0, ":modified_consumption"), #modded by prosperity
    (assign, reg1, ":raw_material_consumption"),
    (assign, reg2, ":consumer_consumption"),
]),

The script for what happens when a caravan or peasant arrives at destination. I interpret the code as meaning "when caravan goes from point A to point B, the prices in point B drift towards those in point A by a proportion equal to the variable percentage_change (set to 30% always in this case). This would determine the "strength" with which caravans equalize prices around the world, am I right?
  #script_do_party_center_trade
  # INPUT: arg1 = party_no, arg2 = center_no, arg3 = percentage_change_in_center
  # OUTPUT: reg0 = total_change
  ("do_party_center_trade",
    [
      (store_script_param, ":party_no", 1),
      (store_script_param, ":center_no", 2),
      (store_script_param, ":percentage_change", 3), #this should probably always be a constant. Currently it is 25
  (assign, ":percentage_change", 30),

  (party_get_slot, ":eek:rigin", ":party_no", slot_party_last_traded_center),
  (party_set_slot, ":party_no", slot_party_last_traded_center, ":center_no"),
 
      (assign, ":total_change", 0),
      (store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin),
      (try_for_range, ":cur_good", trade_goods_begin, trade_goods_end),
        (store_add, ":cur_good_price_slot", ":cur_good", ":item_to_price_slot"),
        (party_get_slot, ":cur_merchant_price", ":party_no", ":cur_good_price_slot"),
        (party_get_slot, ":cur_center_price", ":center_no", ":cur_good_price_slot"),
        (store_sub, ":price_dif", ":cur_merchant_price", ":cur_center_price"),
        (assign, ":cur_change", ":price_dif"),
        (val_abs, ":cur_change"),
        (val_add, ":total_change", ":cur_change"),
        (val_mul, ":cur_change", ":percentage_change"),
        (val_div, ":cur_change", 100),

#This is to reconvert from absolute value
        (try_begin),
          (lt, ":price_dif", 0),
          (val_mul, ":cur_change", -1),
        (try_end),

#The new price for the caravan or peasant is set before the change, so the prices in the trading town have full effect on the next center
        (party_set_slot, ":party_no", ":cur_good_price_slot", ":cur_center_price"),

        (val_add, ":cur_center_price", ":cur_change"),
        (party_set_slot, ":center_no", ":cur_good_price_slot", ":cur_center_price"),

(try_begin),
(eq, "$cheat_mode", 3),
(str_store_party_name, s3, ":eek:rigin"),
(str_store_party_name, s4, ":center_no"),
(str_store_item_name, s5, ":cur_good"),
(assign, reg4, ":cur_change"),
(assign, reg5, ":cur_center_price"),
(display_message, "@{!}DEBUG -- Trade of {s5} from {s3} to {s4} brings price from {reg4} to  {reg5}"),
(try_end),

      (try_end),
      (assign, reg0, ":total_change"),
  ]),

From module_triggers.py:

First I noticed were the following constant definitions:
merchant_inventory_space = 30
num_merchandise_goods = 36
As far as I've understood the "supply" of a good isn't directly dependent on what the merchant has in stock, it's rather defined by the relative prices (the values that indicate shortages when over 1000 as listed by the guildmaster). Thus, the size of the merchant's stock would only determine how much the player can affect things by buying and selling stuff. Would (say) doubling these values have any detrimental effect? I can't think of any right now. The merchant would though have to be given more money on hand to be able to buy the masses of goods you haul in.

From module_simple_triggers.py:

Here's a script which apparently also triggers when a caravan or a peasant party arrives at a town. There's apparently a 35% chance that a village's prosperity increases by one point when the peasants arrive. Could a simple addition of code make there be a (separate) 35% roll for the town? That'd at least make the trade give a fairly constant prosperity increase regardless of the price equalization.

  #Troop AI: Merchants thinking
  (8,
  [
      (try_for_parties, ":party_no"),
        (party_slot_eq, ":party_no", slot_party_type, spt_kingdom_caravan),
        (party_is_in_any_town, ":party_no"),

        (store_faction_of_party, ":merchant_faction", ":party_no"),
        (faction_get_slot, ":num_towns", ":merchant_faction", slot_faction_num_towns),
        (try_begin),
          (le, ":num_towns", 0),
          (remove_party, ":party_no"),
        (else_try),
          (party_get_cur_town, ":cur_center", ":party_no"),
         
          (store_random_in_range, ":random_no", 0, 100),                             
         
          (try_begin),
            (party_slot_eq, ":cur_center", slot_town_lord, "trp_player"),
           
            (game_get_reduce_campaign_ai, ":reduce_campaign_ai"),
            (try_begin),
              (eq, ":reduce_campaign_ai", 0), #hard (less money from tariffs)
              (assign, ":tariff_succeed_limit", 35),
            (else_try),
              (eq, ":reduce_campaign_ai", 1), #medium (normal money from tariffs)
              (assign, ":tariff_succeed_limit", 45),
            (else_try),
              (eq, ":reduce_campaign_ai", 2), #easy (more money from tariffs)
              (assign, ":tariff_succeed_limit", 60),
            (try_end),               
          (else_try), 
            (assign, ":tariff_succeed_limit", 45),
          (try_end),
                     
          (lt, ":random_no", ":tariff_succeed_limit"),                 

          (assign, ":can_leave", 1),
          (try_begin),
            (is_between, ":cur_center", walled_centers_begin, walled_centers_end),
            (neg|party_slot_eq, ":cur_center", slot_center_is_besieged_by, -1),
            (assign, ":can_leave", 0),
          (try_end),
          (eq, ":can_leave", 1),

          (assign, ":do_trade", 0),
          (try_begin),
            (party_get_slot, ":cur_ai_state", ":party_no", slot_party_ai_state),
            (eq, ":cur_ai_state", spai_trading_with_town),
            (party_get_slot, ":cur_ai_object", ":party_no", slot_party_ai_object),
            (eq, ":cur_center", ":cur_ai_object"),
            (assign, ":do_trade", 1),
          (try_end),

          (assign, ":target_center", -1),
         
          (try_begin), #Make sure escorted caravan continues to its original destination.
            (eq, "$caravan_escort_party_id", ":party_no"),
            (neg|party_is_in_town, ":party_no", "$caravan_escort_destination_town"),
            (assign, ":target_center", "$caravan_escort_destination_town"),
          (else_try),       
            (call_script, "script_cf_select_most_profitable_town_at_peace_with_faction_in_trade_route", ":cur_center", ":merchant_faction"),
            (assign, ":target_center", reg0),
          (try_end),
          (is_between, ":target_center", towns_begin, towns_end),
          (neg|party_is_in_town, ":party_no", ":target_center"),
     
          (try_begin),
            (eq, ":do_trade", 1),
            (str_store_party_name, s7, ":cur_center"),           
            (call_script, "script_do_merchant_town_trade", ":party_no", ":cur_center"),
          (try_end),
          (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
          (party_set_ai_object, ":party_no", ":target_center"),
          (party_set_flags, ":party_no", pf_default_behavior, 0),
          (party_set_slot, ":party_no", slot_party_ai_state, spai_trading_with_town),
          (party_set_slot, ":party_no", slot_party_ai_object, ":target_center"),
        (try_end),
      (try_end),
    ]),

  #Troop AI: Village farmers thinking
  (8,
  [
      (try_for_parties, ":party_no"),
        (party_slot_eq, ":party_no", slot_party_type, spt_village_farmer),
        (party_is_in_any_town, ":party_no"),
        (party_get_slot, ":home_center", ":party_no", slot_party_home_center),
        (party_get_cur_town, ":cur_center", ":party_no"),

        (assign, ":can_leave", 1),
        (try_begin),
          (is_between, ":cur_center", walled_centers_begin, walled_centers_end),
          (neg|party_slot_eq, ":cur_center", slot_center_is_besieged_by, -1),
          (assign, ":can_leave", 0),
        (try_end),
        (eq, ":can_leave", 1),

        (try_begin),
          (eq, ":cur_center", ":home_center"),
 
  #Peasants trade in their home center
  (call_script, "script_do_party_center_trade", ":party_no", ":home_center", price_adjustment), #this needs to be the same as the center  
  (store_faction_of_party, ":center_faction", ":cur_center"),
          (party_set_faction, ":party_no", ":center_faction"),           
          (party_get_slot, ":market_town", ":home_center", slot_village_market_town),
          (party_set_slot, ":party_no", slot_party_ai_object, ":market_town"),
          (party_set_slot, ":party_no", slot_party_ai_state, spai_trading_with_town),
          (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
          (party_set_ai_object, ":party_no", ":market_town"),
        (else_try),
          (try_begin),
            (party_get_slot, ":cur_ai_object", ":party_no", slot_party_ai_object),
            (eq, ":cur_center", ":cur_ai_object"),

            (call_script, "script_do_party_center_trade", ":party_no", ":cur_ai_object", price_adjustment), #raised from 10
            (assign, ":total_change", reg0),
    #This is roughly 50% of what a caravan would pay

            #Adding tariffs to the town
            (party_get_slot, ":accumulated_tariffs", ":cur_ai_object", slot_center_accumulated_tariffs),
            (party_get_slot, ":prosperity", ":cur_ai_object", slot_town_prosperity),

(assign, ":tariffs_generated", ":total_change"),
(val_mul, ":tariffs_generated", ":prosperity"),
(val_div, ":tariffs_generated", 100),
(val_div, ":tariffs_generated", 20), #10 for caravans, 20 for villages
(val_add, ":accumulated_tariffs", ":tariffs_generated"),
 
(try_begin),
(ge, "$cheat_mode", 3),
(assign, reg4, ":tariffs_generated"),
(str_store_party_name, s4, ":cur_ai_object"),
(assign, reg5, ":accumulated_tariffs"),
(display_message, "@{!}New tariffs at {s4} = {reg4}, total = {reg5}"),
(try_end),

            (party_set_slot, ":cur_ai_object", slot_center_accumulated_tariffs, ":accumulated_tariffs"),

            #Increasing food stocks of the town
            (party_get_slot, ":town_food_store", ":cur_ai_object", slot_party_food_store),
            (call_script, "script_center_get_food_store_limit", ":cur_ai_object"),
            (assign, ":food_store_limit", reg0),
            (val_add, ":town_food_store", 1000),
            (val_min, ":town_food_store", ":food_store_limit"),
            (party_set_slot, ":cur_ai_object", slot_party_food_store, ":town_food_store"),

            #Adding 1 to village prosperity
            (try_begin),
              (store_random_in_range, ":rand", 0, 100),
              (lt, ":rand", 35),
              (call_script, "script_change_center_prosperity", ":home_center", 1),
  (val_add, "$newglob_total_prosperity_from_village_trade", 1),
            (try_end),
          (try_end),

          #Moving farmers to their home village
          (party_set_slot, ":party_no", slot_party_ai_object, ":home_center"),
          (party_set_slot, ":party_no", slot_party_ai_state, spai_trading_with_town),
          (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
          (party_set_ai_object, ":party_no", ":home_center"),
        (try_end),
      (try_end),
    ]),

That's all I've found by sifting through scripts, triggers and simple_triggers. Is there more elsewhere which concerns prosperity?

Anyways, assuming the above is what we have to work with, my plan is currently as follows: I'll try a simple increase in village productivity / decrease in village food consumption, while taking away food production from towns (and compensating with other stuff). See if that solves the village town prosperity drain problem; even if a peasant visit ought to increase manufactured good prices, it should arguably still be made worth it as food prices would get ludicrously high in the town without. If that doesn't work, I might have to look for "arbitrary" coded increases in prosperity for the town per peasant visit (if possible), even though I'd prefer to make the prosperity follow naturally from base game mechanics rather than appear out of nowhere simply because the peasants came on a visit.

What do you think?
 
I was doing some changes to Calradia economy, but I have not had the time to finish it. With some of my new stuff, Calradia economy will be broken within a game year. A few thing I came across:
- Raw material demand and supply: increase the finished goods production volume without increasing the raw material production will actually make the town/village poorer. For example: grain, bread and ale. Increasing the bread production without increasing grain production would make the town/village eventually run out of grain to make bread -> no more bread -> no extra grain to make ale -> lack of goods -> price too high -> town/village get poorer. However, if you increase the village production of grain to supply the town mills, sometime you can't buy anything but grain due to the limited inventory spaces of village elders.
- I'm not sure if interprise will effect demand/supply of finished goods and raw material. With 5 to 10 towns making velvet, the high demand of raw dyes and raw silk would up the price so high that it would make the business unprofitable without increasing the price of velvet. Moreover, with that much velvet flooding the market, velvet should be dirt cheap. However, it does not seem to be so.
- I don't know how much (if any at all) caravan would effect the amount of goods available (not just the price).

A few things that I added to my mod:
- Towns/villages get the same basic production based on the terrain they are in.
- Items produced are set for each type of terrain. For example: more date in desert, more grain in plain land...
- Many new improvement for both town and village. The improvement will increase either raw materials production or finished goods production. For raw materials production such as farm, it works like increasing the radius of town/village and calculate new production level based on that. Most of the raw materials (grain, raw silk, iron, ...) are produced by villages. Most of the finished goods (tools, velvet, linen,...) are produced by towns, except food items.

Since, I'm not sure how interprise effect RM/FG demand/supply, I add a fixed number of production to the town when the interprise is up and running. Have not test the effect of that yet.

Hopefully, I would have some extra tine to go back to this when the new version of MS is out.
 
Blood and Steel's source has a totally new economy in it.  You might find reading it worthwhile. 

Instead of "prosperity" and a screwy system of supply and demand, I built an entirely abstract economy whose results are governed by population count (i.e., real population changes result in better income from fiefs, etc.).  Simply parse through the source looking for "population" to find the relevant changes.

Basically, I don't think that the Warband economy is truly fixable.  Because it uses an actual system of supply and demand, things will inevitably go sideways at some point, because of player actions, especially the Enterprises (you can create artificial depressions via scarcity, but, ironically, Enterprises in Native won't actually improve local economics, unlike the real world). 

About the only real fix I can think of is to introduce some artificial demand and supply at given locations, but getting it to work and be reasonably stable for a long game would be an enormous pain in the neck.  Hence why I built a system that doesn't actually worry about supply and demand at all, but simply handles the macroeconomic effects of player actions (for example, if not put under siege, populations in cities grow fairly rapidly, if under siege, they fall, if sacked, they fall again, if you build a Mill, it contributes to population growth, etc., etc., etc.).  I don't have the time to walk people through all of that code, but it's there for the reading.
 
Back
Top Bottom