Economy and Trade

This is an older proposal about improving economy and trade mechanics. It is an evolution of a proposal that can be found on the mailing list.

Goals
- Sanely manage imports and exports on a given planet

Supply and demand
Each planet has two attributes when it comes to commodities, supply and demand. If a commodity is supplied on the planet it may be bought, and if it is in demand it may be sold.

Supply and demand are configured for each commodity separately. Though a planet can both supply AND demand the same commodity, the availability of goods for space traders will come down to only one, whichever is highest. Supply and demand use "points", which dictate how much of each exists on that planet. Supply and demand cancel each other out, so demand could be considered "negative supply". However, as we will see later, it does not quite work like that.


 * Example 1: A planet supplies 15 points of food, and demands 10. Subtract the lowest from the highest, and you end up with a net result of 5 points of supply, which means the planet exports food.
 * Example 2: A planet demands 20 points of medicinal goods, and supplies 5. This means there is a net value of 15 demand for this planet, which means medicine may be sold here.

If supply and demand are equal, then the commodity in question can not be traded on this planet. Though supply and demand negate each other, the lowest possible effective supply or demand is 0. The values themselves may drop below 0, but in calculations they should be considered 0 in this case.


 * Example 3: A planet supplies -15 points of exotic animals, and demands 0. The negative supply should be treated as 0, so in effect there is neither supply nor demand. No exotic animals can be traded here.

Planet attributes
Each planet has a number of "attributes". These attributes determine the supply and demand for various commodities on the planet. A planet attribute is a piece of XML (or Lua) that affects one or more commodities. Each attribute has a name, a description and one or more effects. The name and description are used on the landing tab, where they complement the planet's unique description text with general information about the planet's economy. Attributes may also imply other attributes (similar to the tech system). If an attribute implying another attribute is assigned to a planet, all implied attributes are automatically also assigned to that planet. A planet can never have more than one copy of each attribute.

Attribute entries could look like this:

 This world suffers from a high amount of environmental pollution, which makes crop growing difficult and causes all kinds of medical problems for the population.    The industrial infrastructure of this planet is highly developed. Goods are produced here in great quantities, though the effects on the environment are disastrous.    Heavy pollution  An eccentric robotics engineer known as bobbens lives on this planet. He is known for consuming large quantities of a beverage called "mate".  

These attributes can be assigned to an asset like so:

Heavy Industry The home of bobbens

Since "Heavy industry" implies "Heavy pollution", this means the planet will have three attributes in total. The net supply or demand for a commodity is calculated by first summing all modifiers from all assigned attributes, then comparing the difference.

Note that these attributes take the place of the planetary parameters in the original proposal: industrialization, agricultural production, natural resources, political stability, living conditions and ecological condition. The planetary parameters will be reflected in a range of attributes, but there can be attributes that do not relate to such factors, and unlike the scalar parameter model, there can be variations in the attributes that need not necessarily be arrangeable on a good-bad scale.

Commodity properties
Each commodity should have a set of properties that define their relationships and other constants. For example industrial goods would require raw materials, to simulate a production chain.

Commodity tiers and trade ranges
Commodities come in three tiers. The tiers are named tier-0, tier-1 and tier-2. The difference between the tiers is firstly that the higher the tier, the more valuable the commodities, and the greater the profit margin for trading runs. Secondly, the tiers enforce a minimum distance a trader needs to travel to make a profit.

When a commodity is supplied in a system, all other planets closer than n jumps will have their demand for that commodity lowered, where n is the level of the tier. The demand is lowered by the amount of supply generated by the supplying planet.

For tier-0, this means than demand will not be lowered on other planets, even if those planets are in the same system. Tier-0 commodities are typically common goods such as food and ore that are constantly being produced and consumed.

For tier-1, all planets in the current system will have their demands lowered. As such, a trader needs to travel to a neighboring system to make a profit. Tier-1 commodities are specialized goods like machinery or electronics.

For tier-2, all planets in the current system AND in the neighboring ones will have their demands lowered. Traders will have to travel a considerable distance to find a place to sell these commodities, but will be able to turn quite a profit. Typically, commodities in tier-2 will be produced in only a few places in the galaxy, and consumed by a select number of others.

Note that this demand adjustment applies ONLY to the net demand a planet generates. The net demand must never fall below 0 (i.e. demand correction can not result in a planet becoming a supplier of commodities).

Commodity availability and pricing
Each planet can only trade a limited number of commodities. The commodities that are traded on the planet depend on the supply and demand that exists there. Per commodity tier, select the X commodities with the highest net supply/demand value, after range correction, and make them available for trade on the planet. X could be 3 for tier-0 commodities, 2 for tier-1 commodities and 1 for tier-2 commodities. There should probably also be a certain threshold for availability, like 5 points. If not enough commodities are available that meet the conditions, then the planet trades fewer commodities.

The price of a traded commodity depends on the amount of net points the commodity has in supply or demand. The more points of supply, the lower the commodity will be priced, and the more points of demand, the higher. The points modify the base price of the commodity, according to a pricing function.

Events
The original proposal mentioned the possibility of events changing the economic situation on a planet. With the attribute system in place, these events can be made explicit, and easily applied in a unidiff-like fashion. For example:

 This planet has recently been struck by a series of serious earthquakes in a large area. A lot of the infrastructure has been damaged or destroyed, and many people are in need of medical aid.    

This is an event that could be placed on a planet for a limited time, thereby modifying the supply and demand on that planet. In this example, the planet has been struck by a natural disaster, which decreases industrial output (if any) and increases the need for medicinal goods. Unless the planet was a big supplier of medicinal goods before, this could mean that medicinal goods will be at a premium on this planet for some time. While this situation lasts, the planet landing tab will inform the player about the current situation. The planet will eventually recover, and the attribute will be removed again.

Price modulation
We need to make sure trade routes are not always equally profitable, forcing the player to constantly investigate other trade opportunities. How to handle this? One way could be to periodically modulate prices over time. But which prices to modulate, and how? Simple solution: Fluctuate prices according to a sine wave over STU, with amplitude depending on supply/demand points, and period depending on PRNG. But is this good enough?

One approach that is certainly out of the question is to fluctuate prices by goods shifted - we do not and will not simulate trader traffic in detail across the galaxy, and the player alone can never shift enough goods to affect a whole planetary economy. A system where trader traffic is simulated on a very abstract level might work, though.

Contraband
(Attributes could maybe outlaw commodities on a planet, perhaps in the context of an event. But how to handle contraband on a per-planet basis?)