Difference between revisions of "Commodities.plist"
m (information about primary role and scripting category added) |
(Updating BB links) |
||
(16 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
− | Commodities.plist is a dictionary with an entry for each type of market. Three are defined initially, 'default' containing the default (natch) information for each of the [[commodities]] in the universe, 'rockhermit' which has the prices and quantities available at a [[rock hermit]] and 'none' which has prices and price variation set to zero. | + | '''Note: The commodities.plist file is no longer used since Oolite 1.81.''' And the old simple formula for replicating the main orbital station prices fails, too. |
+ | :You now need either to define the market inside the station's [[Shipdata.plist]] (under ''Station keys'') or you need a [[Oolite JavaScript Reference: Market Scripts|Market Script]]. | ||
+ | |||
+ | == Overview == | ||
+ | Commodities.[[plist]] is a dictionary with an entry for each type of market. Three are defined initially, 'default' containing the default (natch) information for each of the [[commodities]] in the universe, 'rockhermit' which has the prices and quantities available at a [[rock hermit]] and 'none' which has prices and price variation set to zero. To create a commodities.plist for your own station, define an entry with the same name as the 'market' property of the station in [[shipdata.plist]] (or alternatively with the same name as its primary role). | ||
Each market is an array of 17 commodities, each in itself an array of 10 items: | Each market is an array of 17 commodities, each in itself an array of 10 items: | ||
Line 34: | Line 38: | ||
Thus if you wish the price of a commodity to be higher in good economies you set MARKET_ECO_ADJUST_PRICE to a high positive value. If you require the price to vary less randomly you set MARKET_MASK_PRICE to a low value (1 or 0). You can work out the rest I'm sure! | Thus if you wish the price of a commodity to be higher in good economies you set MARKET_ECO_ADJUST_PRICE to a high positive value. If you require the price to vary less randomly you set MARKET_MASK_PRICE to a low value (1 or 0). You can work out the rest I'm sure! | ||
− | == | + | The economy*MARKET_ECO_ADJUST_PRICE effectively gives the gradient of the commodity prices as you go up through the economy types. Thus, computers have an adjust price of 13 which means they're cheap at Rich Industrials and expensive and Poor Agriculturals, with a wide price deviation between the two. Platinum, on the other hand, has an adjust price of -2, which means it's slightly more expensive in Industrial systems than in agricultural ones, but overall the price differential is quite small. ([https://bb.oolite.space/viewtopic.php?p=103024#p103024 Ramirez (2010)]) |
+ | |||
+ | ==Example== | ||
* '''[[Commodities#Radioactives|Radioactives]]''' | * '''[[Commodities#Radioactives|Radioactives]]''' | ||
Line 44: | Line 50: | ||
* MARKET_MASK_QUANTITY = 7 | * MARKET_MASK_QUANTITY = 7 | ||
− | If MARKET_RND is 133 and the economy is 3 ([[Planetinfo.plist#Economy|Mainly | + | If MARKET_RND is 133 and the economy is 3 ([[Planetinfo.plist#Economy|Mainly Industrial]]) then: |
* price = (65 + (133 & 7) + (3 * -3)) & 255 = (65 + 5 - 9) & 255 = '''61''' | * price = (65 + (133 & 7) + (3 * -3)) & 255 = (65 + 5 - 9) & 255 = '''61''' | ||
Line 53: | Line 59: | ||
Since (MARKET_RND & MARKET_MASK_PRICE) will always be a value between 0 and 7, this sets the minimum price per ton of [[Commodities#Radioactives|Radioactives]] at a [[Planetinfo.plist#Economy|Poor Agricultural]] economy at 17.6 Cr. and the maximum price per ton at a [[Planetinfo.plist#Economy|Rich Industrial]] economy at 28.8 Cr. | Since (MARKET_RND & MARKET_MASK_PRICE) will always be a value between 0 and 7, this sets the minimum price per ton of [[Commodities#Radioactives|Radioactives]] at a [[Planetinfo.plist#Economy|Poor Agricultural]] economy at 17.6 Cr. and the maximum price per ton at a [[Planetinfo.plist#Economy|Rich Industrial]] economy at 28.8 Cr. | ||
+ | == Comments on this == | ||
+ | Oolite is set up for the simple linear increase or decrease between Poor Agr and Rich Ind which we find in-game. That doesn't mean it is impossible to use the formula for something else, but it means that (a) this is a very tricky business, (b) your possibilities are limited and (c) you may yourself find having to change the whole appearance of the Ooniverse in order to achieve what you want (for instance a solution will highly likely by incompatible with any station-OXPs; which may be a sacrifice that many players (me included) may not be willing to make). ([https://bb.oolite.space/viewtopic.php?p=102985#p102985 Commander McLane (2010)]) | ||
+ | |||
+ | Does this mean there's a single linear relationship that computes the prices for all commodities with the same coefficients? i.e. the commodity prices for a system are not computed independently? Or are you just saying that the relationship between a commodity price and an economy type has to be linear? ... The latter (same thread as above). | ||
+ | |||
+ | This was changed by cim for Oolite v.1.92 with the new Trade-goods.plist | ||
+ | |||
+ | ==Links== | ||
+ | *See also the [[Commodity Calculator]] to help you with the above calculations. | ||
+ | *[https://bb.oolite.space/viewtopic.php?t=3777 Understanding commodities.plist] by Commander McLane (2007) - long but good! | ||
+ | |||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=17621#p239979 How to convert markets] defined in commodities.plist to be usable from Oolite 1.82. | ||
+ | *To merely replicate the main orbital station market use [https://bb.oolite.space/viewtopic.php?p=246145#p246145 "market_definition" = ();] | ||
+ | |||
+ | === Oolite since v.1.81 === | ||
+ | *You now need either to define the market inside the station's [[Shipdata.plist]] (under ''Station keys'') or you need a [[Oolite JavaScript Reference: Market Scripts|Market Script]]. | ||
+ | *[[Trade-goods.plist]] introduced with Oolite v1.81 in 2014/5 allows definition of new/different commodities and also replaces the old [[Illegal_goods.plist]] | ||
[[Category:Oolite]] | [[Category:Oolite]] | ||
[[Category:Oolite_scripting]] | [[Category:Oolite_scripting]] | ||
+ | [[Category:Legacy scripting]] |
Latest revision as of 01:28, 29 February 2024
Note: The commodities.plist file is no longer used since Oolite 1.81. And the old simple formula for replicating the main orbital station prices fails, too.
- You now need either to define the market inside the station's Shipdata.plist (under Station keys) or you need a Market Script.
Overview
Commodities.plist is a dictionary with an entry for each type of market. Three are defined initially, 'default' containing the default (natch) information for each of the commodities in the universe, 'rockhermit' which has the prices and quantities available at a rock hermit and 'none' which has prices and price variation set to zero. To create a commodities.plist for your own station, define an entry with the same name as the 'market' property of the station in shipdata.plist (or alternatively with the same name as its primary role).
Each market is an array of 17 commodities, each in itself an array of 10 items:
- The name of the commodity
- Units available at a market (this is calculated at each marketplace)
- Price per unit at a market (this is calculated at each marketplace)
- The base price per unit MARKET_BASE_PRICE
- An adjustment to price based on the economy MARKET_ECO_ADJUST_PRICE
- An adjustment to units availble based on the economy MARKET_ECO_ADJUST_QUANTITY
- The base quantity available to a market MARKET_BASE_QUANTITY
- A 'mask' which defines how the price varies MARKET_MASK_PRICE
- A 'mask' which defines how the quantity varies MARKET_MASK_QUANTITY
- The unit of quantity (0 == tons, 1 == kilos, 2 == grams)
At each market prices and quantities are calculated from values 4..9 and a random value from 0-255 (MARKET_RND) according to a complex series of steps:
// calculate the local price
price = (MARKET_BASE_PRICE + (MARKET_RND & MARKET_MASK_PRICE) + (economy * MARKET_ECO_ADJUST_PRICE)) & 255
// calculate the local quantity available
quantity = (MARKET_BASE_QUANTITY + (MARKET_RND & MARKET_MASK_QUANTITY) - (economy * MARKET_ECO_ADJUST_QUANTITY)) & 255
// if the quantity gets too high it's zeroed
if (quantity > 127) quantity = 0
// limit the quantity to 0..63 units
quantity &= 63
// price in credits is the final price x 0.4
price *= 0.4
Thus if you wish the price of a commodity to be higher in good economies you set MARKET_ECO_ADJUST_PRICE to a high positive value. If you require the price to vary less randomly you set MARKET_MASK_PRICE to a low value (1 or 0). You can work out the rest I'm sure!
The economy*MARKET_ECO_ADJUST_PRICE effectively gives the gradient of the commodity prices as you go up through the economy types. Thus, computers have an adjust price of 13 which means they're cheap at Rich Industrials and expensive and Poor Agriculturals, with a wide price deviation between the two. Platinum, on the other hand, has an adjust price of -2, which means it's slightly more expensive in Industrial systems than in agricultural ones, but overall the price differential is quite small. (Ramirez (2010))
Example
- Radioactives
- MARKET_BASE_PRICE = 65
- MARKET_ECO_ADJUST_PRICE = -3
- MARKET_ECO_ADJUST_QUANTITY = -3
- MARKET_BASE_QUANTITY = 2
- MARKET_MASK_PRICE = 7
- MARKET_MASK_QUANTITY = 7
If MARKET_RND is 133 and the economy is 3 (Mainly Industrial) then:
- price = (65 + (133 & 7) + (3 * -3)) & 255 = (65 + 5 - 9) & 255 = 61
- quantity = (2 + (133 & 7) - (3 * -3)) & 255 = (2 + 5 + 9) & 255 = 16
61 * 0.4 = 24.4 credits per ton, 16 tons available.
Since (MARKET_RND & MARKET_MASK_PRICE) will always be a value between 0 and 7, this sets the minimum price per ton of Radioactives at a Poor Agricultural economy at 17.6 Cr. and the maximum price per ton at a Rich Industrial economy at 28.8 Cr.
Comments on this
Oolite is set up for the simple linear increase or decrease between Poor Agr and Rich Ind which we find in-game. That doesn't mean it is impossible to use the formula for something else, but it means that (a) this is a very tricky business, (b) your possibilities are limited and (c) you may yourself find having to change the whole appearance of the Ooniverse in order to achieve what you want (for instance a solution will highly likely by incompatible with any station-OXPs; which may be a sacrifice that many players (me included) may not be willing to make). (Commander McLane (2010))
Does this mean there's a single linear relationship that computes the prices for all commodities with the same coefficients? i.e. the commodity prices for a system are not computed independently? Or are you just saying that the relationship between a commodity price and an economy type has to be linear? ... The latter (same thread as above).
This was changed by cim for Oolite v.1.92 with the new Trade-goods.plist
Links
- See also the Commodity Calculator to help you with the above calculations.
- Understanding commodities.plist by Commander McLane (2007) - long but good!
- How to convert markets defined in commodities.plist to be usable from Oolite 1.82.
- To merely replicate the main orbital station market use "market_definition" = ();
Oolite since v.1.81
- You now need either to define the market inside the station's Shipdata.plist (under Station keys) or you need a Market Script.
- Trade-goods.plist introduced with Oolite v1.81 in 2014/5 allows definition of new/different commodities and also replaces the old Illegal_goods.plist