Difference between revisions of "Commodities.plist"

From Elite Wiki
(Amended formula to give final price in credits. Gave example calculation.)
m
Line 13: Line 13:
 
# The unit of quantity (0 == tons, 1 == kilos, 2 == grams)  
 
# 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:-
+
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:
+
 
Code:
+
<br>
  // calculate the local price  
+
<code>// calculate the local price </code><br>
price = (MARKET_BASE_PRICE + (MARKET_RND & MARKET_MASK_PRICE) + (economy * MARKET_ECO_ADJUST_PRICE)) & 255  
+
<code>price = (MARKET_BASE_PRICE + (MARKET_RND & MARKET_MASK_PRICE) + (economy * MARKET_ECO_ADJUST_PRICE)) & 255</code><br>
+
<br>
// calculate the local quantity available  
+
<code>// calculate the local quantity available</code><br>
quantity = (MARKET_BASE_QUANTITY  + (MARKET_RND & MARKET_MASK_QUANTITY) - (economy * MARKET_ECO_ADJUST_QUANTITY)) & 255;
+
<code>quantity = (MARKET_BASE_QUANTITY  + (MARKET_RND & MARKET_MASK_QUANTITY) - (economy * MARKET_ECO_ADJUST_QUANTITY)) & 255</code><br>
+
<br>
// if the quantity gets too high it's zeroed  
+
<code>// if the quantity gets too high it's zeroed</code><br>
if (quantity > 127) quantity = 0;
+
<code>if (quantity > 127) quantity = 0</code><br>
+
<br>
// limit the quantity to 0..63 units  
+
<code>// limit the quantity to 0..63 units</code><br>
quantity &= 63;
+
<code>quantity &= 63</code><br>
+
<br>
// price in credits is the final price x 0.4  
+
<code>// price in credits is the final price x 0.4</code><br>
price *= 0.4;
+
<code>price *= 0.4</code><br>
  
 
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!

Revision as of 23:28, 9 January 2006

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 commodity 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.

Each market is an array of 17 commodities, each in itself an array of 10 items:

  1. The name of the commodity
  2. Units available at a market (this is calculated at each marketplace)
  3. Price per unit at a market (this is calculated at each marketplace)
  4. The base price per unit MARKET_BASE_PRICE
  5. An adjustment to price based on the economy MARKET_ECO_ADJUST_PRICE
  6. An adjustment to units availble based on the economy MARKET_ECO_ADJUST_QUANTITY
  7. The base quantity available to a market MARKET_BASE_QUANTITY
  8. A 'mask' which defines how the price varies MARKET_MASK_PRICE
  9. A 'mask' which defines how the quantity varies MARKET_MASK_QUANTITY
  10. 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!

For 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_PRICE = 7

If MARKET_RND is 105 and the economy is 3 (Mainly Agricultural) then:

  • price = (65 + (105 & 7) + (3 * -3)) & 255 = (65 + 5 - 9) & 255 = 61
  • quantity = (2 + (105 & 7) - (3 * -3)) & 255 = (2 + 5 + 9) & 255 = 16

61 * 0.4 = 24.4 credits per ton, 16 tons available.