03-25-2010, 01:24 PM
I'd think the math wouldn't be that hard.
Price = P
NumBricks = NUM_B
Desired Bricks = D_B
D_B = 1000
Base Price = BP
BP = 1.00
P = D_B/NUM_B * BP
It would just have to do the math on a per brick basis
IE.. if Quantity of Bricks was 1000 and Desired Bricks was 1000 and you were selling 10 bricks
The Brick 1 would calculate a selling price of:
Price = 1000 / 1000 * 1.00 so the first brick sells for 1.00 gold
Brick 2 caluculates at 1000 / 1001 * 1.00 so the 2nd brick is .999 gold
...
Brick 10 calculates at 1000 / 1009 * 1.00 so the 10th brick is .991 gold
So you sell your 10 bricks for 9.955 gold total
I don't think the server side processing is that tough I wrote a program to do that in 10 minutes in foxpro just now to see if I could. It processes slower than I'd like if doing over 700 at a time it's not instantaneous (it was about 15 seconds if processing 9000) like you'd want/need in a game setting, I think it would process much faster coded in a diffrent language.
When it comes to NPCs you'd also probably want to modify the buying / selling formulas to always give an advantage to the "house" so maybe the base price for the NPC selling bricks is 2.00 and the base price for the NPC buying bricks is 1.00 Another possibility would be to add diffrent formulas at diffrent quantity levels of bricks the NPC merchant had. Maybe the base price for bricks when the merchant has 501-1500 bricks is D_B/NUM_B * 1.00 Then when the merchant has 1501-2500 bricks is D_B/NUM_B * .75 and 2501-5000 bricks is D_B/NUM_B * .5
There are definate ways of doing this. It could even be simplified if desired:
Merchant Prices
Num_Bricks ----- Sell ---------- Buy
0-250 --------- 10.00 ---------- 5.00
251-500 -------- 2.50 ---------- 1.25
501-750 -------- 2.25 ---------- 1.10
751-2500 ------- 2.00 ---------- 1.00
2501-5000 ------ 1.75 ---------- 0.90
5000-10000 -----1.50 ---------- 0.50
10001+ ---------- 1.25 ---------- 0.01 or maybe won't buy them because too overstocked
Ideally this allows for a player to find a merchant in a town near where bricks are common with 10,000 bricks for sale. He can buy as many bricks as he can carry in his inventory and set off for a town that takes ~4 hours to travel to that buys bricks for twice as much cause they're rarer there. That player could make a small profit from transporting those bricks along with picking up experience if he choose to fight mobs on the path between cities or if he really wanted to just play as a "merchant" he could avoid contact with mobs as best he could and make his way to the other town sell his bricks for a profit and buy something there that he knows he can sell for a profit in another town and head there next.
Price = P
NumBricks = NUM_B
Desired Bricks = D_B
D_B = 1000
Base Price = BP
BP = 1.00
P = D_B/NUM_B * BP
It would just have to do the math on a per brick basis
IE.. if Quantity of Bricks was 1000 and Desired Bricks was 1000 and you were selling 10 bricks
The Brick 1 would calculate a selling price of:
Price = 1000 / 1000 * 1.00 so the first brick sells for 1.00 gold
Brick 2 caluculates at 1000 / 1001 * 1.00 so the 2nd brick is .999 gold
...
Brick 10 calculates at 1000 / 1009 * 1.00 so the 10th brick is .991 gold
So you sell your 10 bricks for 9.955 gold total
I don't think the server side processing is that tough I wrote a program to do that in 10 minutes in foxpro just now to see if I could. It processes slower than I'd like if doing over 700 at a time it's not instantaneous (it was about 15 seconds if processing 9000) like you'd want/need in a game setting, I think it would process much faster coded in a diffrent language.
When it comes to NPCs you'd also probably want to modify the buying / selling formulas to always give an advantage to the "house" so maybe the base price for the NPC selling bricks is 2.00 and the base price for the NPC buying bricks is 1.00 Another possibility would be to add diffrent formulas at diffrent quantity levels of bricks the NPC merchant had. Maybe the base price for bricks when the merchant has 501-1500 bricks is D_B/NUM_B * 1.00 Then when the merchant has 1501-2500 bricks is D_B/NUM_B * .75 and 2501-5000 bricks is D_B/NUM_B * .5
There are definate ways of doing this. It could even be simplified if desired:
Merchant Prices
Num_Bricks ----- Sell ---------- Buy
0-250 --------- 10.00 ---------- 5.00
251-500 -------- 2.50 ---------- 1.25
501-750 -------- 2.25 ---------- 1.10
751-2500 ------- 2.00 ---------- 1.00
2501-5000 ------ 1.75 ---------- 0.90
5000-10000 -----1.50 ---------- 0.50
10001+ ---------- 1.25 ---------- 0.01 or maybe won't buy them because too overstocked
Ideally this allows for a player to find a merchant in a town near where bricks are common with 10,000 bricks for sale. He can buy as many bricks as he can carry in his inventory and set off for a town that takes ~4 hours to travel to that buys bricks for twice as much cause they're rarer there. That player could make a small profit from transporting those bricks along with picking up experience if he choose to fight mobs on the path between cities or if he really wanted to just play as a "merchant" he could avoid contact with mobs as best he could and make his way to the other town sell his bricks for a profit and buy something there that he knows he can sell for a profit in another town and head there next.
Mistahapie - 50 Warlord or Champion <Defiant> - Faemist
Master Armorsmith / Weaponsmith
Airyth - 50 Pyromancer or Chloromancer <Defiant> - Faemist
Mistahapie - 70 <Defiant> Troll War Mannoroth
Airyth - <Defiant> 70 Troll Mage Mannoroth
Iriani <Innoruuk's Legion> 52 DE Enc - Ebay
Mistahapie Bedwetter <Defiant> 70 TR War - VZ
Airyth <Defiant> 70 DE Enc - VZ
Crinekx <Defiant> 70 Frg Wiz - VZ
Master Armorsmith / Weaponsmith
Airyth - 50 Pyromancer or Chloromancer <Defiant> - Faemist
Mistahapie - 70 <Defiant> Troll War Mannoroth
Airyth - <Defiant> 70 Troll Mage Mannoroth
Iriani <Innoruuk's Legion> 52 DE Enc - Ebay
Mistahapie Bedwetter <Defiant> 70 TR War - VZ
Airyth <Defiant> 70 DE Enc - VZ
Crinekx <Defiant> 70 Frg Wiz - VZ
