jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

ENH: Default Pricing #48

Closed jpcsupplies closed 8 years ago

jpcsupplies commented 8 years ago

Although admins will likely tweak this - For the default RRP price book pricing, if the pricebook has not yet been created; we should have an internal constant which populates the prices when we do create it so the price table created has plausible pricing.

Examples, buy price lower than sell price weapon related materials more expensive common materials like stone and iron, less expensive slightly rare essential materials a little more costly uranium etc more rare materials like silicon etc somewhere middle priced precious metals like gold/silver/platinum more expensive etc

jpcsupplies commented 8 years ago

Ice should be costly, say 40 a unit at most. Gravel and stone really cheap like less than 1 each

Demolish50 commented 8 years ago

There is this:

http://ripexz.github.io/se-trade/

midspace commented 8 years ago

The pricing behind http://ripexz.github.io/se-trade/

    {"name": "Stone", "type": "raw", "rate": 310},
    {"name": "Iron Ore", "type": "raw", "rate": 500},
    {"name": "Nickel Ore", "type": "raw", "rate": 20},
    {"name": "Cobalt Ore", "type": "raw", "rate": 22},
    {"name": "Magnesium Ore", "type": "raw", "rate": 24},
    {"name": "Silicon Ore", "type": "raw", "rate": 22},
    {"name": "Silver Ore", "type": "raw", "rate": 20},
    {"name": "Gold Ore", "type": "raw", "rate": 20},
    {"name": "Platinum Ore", "type": "raw", "rate": 20},
    {"name": "Uranium Ore", "type": "raw", "rate": 44},

    {"name": "Gravel", "type": "refined", "rate": 279},
    {"name": "Iron Ingot", "type": "refined", "rate": 350},
    {"name": "Nickel Ingot", "type": "refined", "rate": 8},
    {"name": "Cobalt Ingot", "type": "refined", "rate": 6.6},
    {"name": "Magnesium Powder", "type": "refined", "rate": 0.168},
    {"name": "Silicon Wafer", "type": "refined", "rate": 15.4},
    {"name": "Silver Ingot", "type": "refined", "rate": 2.2},
    {"name": "Gold Ingot", "type": "refined", "rate": 0.2},
    {"name": "Platinum Ingot", "type": "refined", "rate": 0.1},
    {"name": "Uranium Ingot", "type": "refined", "rate": 0.308}

Ice is not mentioned, so I'm assuming the pricing is a little old, and may actually be dependent on SEToolbox having processed the asteroids to produce breakdowns. The distribution has changed since Ice was introduced, and will further change when Planets are also added.

midspace commented 8 years ago

The problem (considering I'm the SEToolbox author), apart from SEToolbox been unable to read current asteroid file formats, is that SEToolbox can only read asteroid files from 'touched' asteroids. Any procedural generated asteroids that haven't been touched, will not be accessible by SEToolbox.

The way around this, is I could write a quick and dirty mod to actually analyse in game asteroids (same as the /detail command in the Admin mod), and process that data into a text file. A sample, of say 1000 asteroids, should give us a good idea of the distribution of ores.

midspace commented 8 years ago

Refined ore (ingot) values is very dependent on a few of factors.

  1. Your refinery speed in game configuration.
  2. The individual refinery and arc furnace as each block type has individual refine speed and efficiency rate.
  3. And any upgrade modules connected to refinery and arc furnaces.
midspace commented 8 years ago

The following figures are from a sample of 235 asteroids (which was all that is available in standard 20Km visibility range), all of which are the procedural asteroids. I have specifically excluded the stock asteroids (centralAsteroid, centralAsteroidmoon, etc.) which are be spawned at origin 0,0,0 and don't necessarily match the same distribution. I've accumulated the Iron_01 Iron_02, as well the the Ice and Stone into single listings for convenience.

Ore_namedeposit countmeter³percentage
Cobalt604734813.1450.61%
Gold5712194894.571.56%
Ice19742417884.125.43%
Iron235401726692.751.41%
Magnesium5610114095.181.29%
Nickel655524046.1840.71%
Platinum5311723734.471.50%
Silicon5210607933.361.36%
Silver586355505.980.81%
Stone235268914299.934.42%
Uraninite987028055.3760.90%
Total1166781341955100.00%
midspace commented 8 years ago

I'm doing a full sampling of 50Km currently, which is over 3000 asteroids. It will take some time to analyse all asteroids. To do this right, I will present the figures based on an average per asteroid, average per 100Km³, and a base weighted average.

jpcsupplies commented 8 years ago

stone and iron in equal ratios.. that is a surprise. But stone is still often a throw away item.. The deposit count compared to cubic meters seems a bit strange tho. 34% vs 51% for same deposit count. Well this is handy, we can work out some inverse price relationship formula vs 100 maybe, Eg uranium 100-0.90 gives us a price of 99.1 that would make cobalt the most valuable ore weird. Probably need additional conditions, eg divide price by further 10 for items under 30%, and by 100 for items over 30%.. That gives us uranium: 100-0.90 = 99.1. 99.1/10 = 9.91 per kg uranium ore And stone: 100-34.42=65.58. 65.58/100=0.6558 per kg ore

Actually extrapolating on your detail comment - we could have the server perform an ore analysis on startup, then use some sort of inverse price formula to build the initial price table, which would make it adapt to the available ores in that world at first run to set initial prices. You could liken it to the NPC merchant doing a mineral survey and setting prices accordingly.

If we really wanted to be fancy we could add a command or timer to periodically recalculate the prices.. or have it run every launch of server not just first run. Command is probably safer.. analysis of everything in 20kms could slow things down a lot and admins may have tweaked their prices already. First run behavior + admin command is probably safest. (although when we get the config file working it could become an option)

midspace commented 8 years ago

The deposits is pretty irrelevant, as it is just counting how many types or ores per asteroid. Not a useful figure. These figures I forgot to mention, are just based on asteroids. The mining rates of each ore differ significantly. I haven't found what eactly the mining rate means in the voxelmaterials.sbc file. So the actual ore in hand after mining will have a different ratio.

Analyzing the asteroids takes some time. i wouldn't recommend it. 3 mins for 100 asteroids on my system.

jpcsupplies commented 8 years ago

Owch.. although as a first run (only run once first time mod is loaded) it may work.. but i could just do the calculations and setup a constant in the code when i get a moment

midspace commented 8 years ago

Scenario: Asteroids. Asteroid Amount: Infinite High density. View Distance: 50 Km

Total asteroids found and analysed: 3,218 Time to process: 1 hour 35 minutes. Volume of space covered: 5.23599E+14 m³. Volume of space covered: 523,598.7756 km³. 1 Asteroid per 162,709,377,128.12 m³ of space. 1 Asteroid per 162.71 km³ of space.

Total overall ore in asteroids

Ore namemeter³percentage
Cobalt87,643,702.710.96%
Gold70,391,905.820.77%
Ice322,126,920.073.54%
Iron4,959,500,433.9054.53%
Magnesium97,537,313.261.07%
Nickel70,645,362.770.78%
Platinum73,006,618.400.80%
Silicon88,502,734.550.97%
Silver107,905,015.591.19%
Stone3,057,583,862.1833.62%
Uraninite159,950,508.351.76%
Total9,094,794,377.62100.00%

Average ore per asteroid

Ore namemeter³percentage
Cobalt27,235.460.96%
Gold21,874.430.77%
Ice100,101.593.54%
Iron1,541,174.7854.53%
Magnesium30,309.921.07%
Nickel21,953.190.78%
Platinum22,686.950.80%
Silicon27,502.400.97%
Silver33,531.701.19%
Stone950,150.3633.62%
Uraninite49,704.941.76%
Total2,826,225.72100.00%

Ore per 1 km³ of space

Ore namemeter³percentage
Cobalt167.390.96%
Gold134.440.77%
Ice615.223.54%
Iron9,471.9554.53%
Magnesium186.281.07%
Nickel134.920.78%
Platinum139.430.80%
Silicon169.030.97%
Silver206.081.19%
Stone5,839.5633.62%
Uraninite305.481.76%
Total17,369.78100.00%

Base weighted average

Ore nameWeightMinedOreRatioFinal Weight
Cobalt34.891.0034.89
Gold43.440.7062.05
Ice9.490.3031.64
Iron0.621.000.62
Magnesium31.351.0031.35
Nickel43.281.0043.28
Platinum41.880.8052.35
Silicon34.551.0034.55
Silver28.340.9031.48
Stone1.001.001.00
Uraninite19.120.3063.72
jpcsupplies commented 8 years ago

Here is where i am at price wise, tho not sure how to price scrap(used 1), or organic (Hydrogen bottle !? are they about to add hydrogen to game?), ive blacklisted those

Ore pricing is based on rough inverse calculation by scarcity (/10) with a /100 modifier on items over 30% yield. On gold, uranium and magnesium i used a /8 to inflate price slightly.

tool/component based on value of materials to build buy (from player) price is 11% deducted from sell (to player) price across the board.

the "qty" fields are just starting reserves for the NPC, and don't represent anything interesting (it is not the unit purchase amount or anything interesting like that)

I've not yet built an "ingot" table the prices in my table are I believe based per KG of raw material. I'll have to ponder that a bit more.

Apparently you can't build a constant array in c# so i've built a suggested price table here in CSV (export from excel): https://github.com/jpcsupplies/Economy_mod/blob/master/itemlist.txt

I will post the spread sheet too so i can access it here or at work.

When i get time ill manually key it into an itemlist export from our xml file

midspace commented 8 years ago

There will be plenty of Organic on planets. Insanely high amounts. Its purpose is still unknown and a tightly guarded secret.

I've not yet built an "ingot" table the prices in my table ar...

I was wondering where that was.

Apparently you can't build a constant array in c#

Different ways to do this:

        #region GetDefaultPriceTable
        public MarketConfig GetDefaultPriceTable()
        {
            const string xmlText = @"<MarketConfig>
  <MarketItems>
    <MarketStruct>
      <TypeId>MyObjectBuilder_AmmoMagazine</TypeId>
      <SubtypeName>NATO_5p56x45mm</SubtypeName>
      <Quantity>0</Quantity>
      <SellPrice>1</SellPrice>
      <BuyPrice>1</BuyPrice>
      <IsBlacklisted>false</IsBlacklisted>
    </MarketStruct>
    <MarketStruct>
      <TypeId>MyObjectBuilder_AmmoMagazine</TypeId>
      <SubtypeName>NATO_25x184mm</SubtypeName>
      <Quantity>0</Quantity>
      <SellPrice>1</SellPrice>
      <BuyPrice>1</BuyPrice>
      <IsBlacklisted>false</IsBlacklisted>
    </MarketStruct>
............
  </MarketItems>
</MarketConfig>";
            return MyAPIGateway.Utilities.SerializeFromXML<MarketConfig>(xmlText);
        }
        #endregion
jpcsupplies commented 8 years ago

Ok, have a csv, xml and xls file with suggested retail pricing.. I used a few calculations, inverse pricing based on ratio or ores in asteroids for a base price, then some additional corrections based on manufacturing losses which gives us ore values vs ingots; Common ores have an artificially reduced price, rare ores a slightly increased; for components they are flat multiplied by the value of the ingots used in their construction. Organics, and hydrogen bottle is blacklisted since i have no point of reference on scarcity or components in construction. (is hydrogen bottle just a a filled o2 bottle or something else?)

You may be surprised by what the actual value is for some items.. i would double checking a few that cost hundreds but it seems to check out with my data..

Players are going to love this i think...

midspace commented 8 years ago

I always get confused between the buy and sell prices depending on the perspective. From what you have added, just so we are clear those buy and sell prices are the market prices, not the player prices. Prices will be swapped around when offered to the player. Ie, what the market sells at, is what the player buys at.

jpcsupplies commented 8 years ago

Think of it from the perspective of the NPC trader. He sells to the player at $11 for example, and if a player wishes to sell his ore to the NPC, the NPC buys from the player at $10.

So yes what the market /sells/ at is what the player /buys/ at.

.. not related - Given I was basing prices on scarity and production waste with some arbitrary modifiers, I am quite surprised at the pricing I arrived at, have you had a look? Some stuff works out quite expensive due to rarity and waste. Quite interesting. On some items i rechecked a few times and found errors, on others its correct - medical is quite expensive lol.. and platinum is worth more than gold

midspace commented 8 years ago

Given I was basing prices on scarity and production waste with some arbitrary modifiers, I am quite surprised at the pricing I arrived at, have you had a look?

I haven't had enough time. Working on 3 mods this morning, and I haven't even looked at the game update yet.

midspace commented 8 years ago

P.S. The prices are now in.

jpcsupplies commented 8 years ago

ahh good work... ooh ive not checked to see what todays update was at keen ..

jpcsupplies commented 8 years ago

Default Pricing now set, and good to go