Skip to content
sobisonator edited this page Jan 6, 2024 · 12 revisions

Setting up the trade system

At the beginning of the game, the following scripted effects run in to set up the systems on which trade depends.

  1. TRADE_setup_tradezones
  2. TRADE_update_governorship_TZs

Routes

TRADE_setup_routes is called by oa_economy_setup to set up the ProvObjs containing the routes between TZs, which store the connection times. This creates a global list, and a list in every tradezone, of the connection times between every tradezone.

The time to travel between tradezones is derived from svalues by TRADE_save_connection_time_values, and then those values are used by TRADE_update_all_route_connection_times to store the values in the trade route ProvObjs

Order of the trade system

The trade system runs a number of scripted effects (detailed below) in a particular order.

Trade capacity

Every governorship has a trade capacity which determines how much it can import and export. In order to boost trade capacity, the governorship must build the following buildings in order of effectiveness:

  1. Ports
  2. Railway upgrades
  3. Canals
  4. Depots
  5. Commerce districts

Without these, a governorship cannot export any of its goods, or import any goods from elsewhere.

Tradegood groups

Tradegoods are split into 5 broad groups:

Essentials

Paid for by all pops in equal measure

  • Grain
  • Fish
  • Livestock
  • Tropical fruit
  • Mediterranean fruit
  • Temperate fruit
  • Processed foods
  • Clothing
  • Furniture
  • Pharmaceuticals
  • Coal
  • Whale byproducts

Luxuries

Paid for mostly by upper and middle strata

  • Alcohol
  • Gems
  • Opium
  • Tobacco
  • Chocolate
  • Coffee
  • Tea
  • Spices
  • Sugar
  • Luxury clothing
  • Luxury furniture
  • Glass
  • Motors

Business goods

Paid for by business owners

  • Fur
  • Industrial fibres
  • Textile fibres
  • Wool
  • Silk
  • Wood
  • Stone
  • Sulphur
  • Peat
  • Tin
  • Inorganic compounds
  • Copper
  • Iron
  • Gold
  • Silver
  • Dye
  • Lead
  • Oil
  • Hardwood
  • Rubber
  • Salt
  • Electronics
  • Rare alloys
  • Construction materials
  • Steel
  • Bronze
  • Machine parts
  • Chemicals
  • Naval supplies
  • Steel ships
  • Wooden ships
  • Petrochemicals

Military

Paid for by military owners

  • Early munitions
  • Late munitions
  • Early artillery
  • Late artillery

Purchase Orders

At the top of se_PURCHASE you can find the iterators for different goods categories

  • As a general note we want to have as few things called quarterly as possible. Purchase orders will occur quarterly but most things that support it should happen yearly or bi-yearly for performance
  1. Wealth from pops in the governorship should all be pooled up to determine the "Purchasing Power" of the governorship for that quarter.
  • This would be "WEALTH_governorship_total"
  • This would work as a "last resort" sorting method for prioritising which governorships get goods when the tradezone's supply is insufficient.
  1. Then sort demand by how important the trade good is.

    • This would be done by creating a seperate "weighted" demand svalue for each svalue. Here a "weight" can be applied to make some goods more important Check DEMAND_svalues
  2. All governorships generate their POs

  3. Every country in a tradezone declares to its tradezone its available for-sale stock (might depend on export laws, amount consumed locally before being sent out for trade)

  4. Every tradezone declares its grand total of available tradegoods to a global "stock list"

  5. One by one in order of some kind of prestige/commerce value, every tradezone collects all the POs from its constituent governorships and looks up the cost of buying the tradegoods for each PO based on the price on the "stock list". Price = current trade value of the good + distance modifier

  6. The buying tradezone submits the PO on behalf of its constituent governorship to the cheapest available selling tradezone, and charges the governorship the relevant £££ amount.

  7. The PO will then be made to nearby trade zones that have an available stockpile for the goods that are in demand.

    • How to do this...we suggested having a list of countries that is built whenever territory changes in each trade zone
  8. Within the governorship, the cost is distributed between pop types and the state depending on local rules.

  9. After the order is made the goods will be "moved" into the stockpile of the governorship that ordered them.

  • So...to do this the stockpile value that actually has an effect MUST be a variable not an svalue. This is because svalues are can't be added in the same way as variables. There is no svalue = svalue + 10 but that does exist for vars.
Clone this wiki locally