THAT... explains quite a lot . Still, it's a nice thing to have!Ahruman wrote:Just to avoid a buildup of expectations, note that Dry Dock is not a modelling tool.
Understanding commodities.plist
Moderators: winston, another_commander
- Disembodied
- Jedi Spam Assassin
- Posts: 6885
- Joined: Thu Jul 12, 2007 10:54 pm
- Location: Carter's Snort
- LittleBear
- ---- E L I T E ----
- Posts: 2882
- Joined: Tue Apr 04, 2006 7:02 pm
- Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.
Wings should sort you out however, as a model builder.
Commander McLane wrote:-
EG if you want to test how your new ship reacts to traders, police, pirates and thargoids, you just add a :-
@TGHC, yeh his modded rockhermit would be a ship as far is Oolite is concerned as he needs to make a clone of a rock-hermit then fiddle with it to add the prices, the name on the ID scanner and any paintjobs applied to the model.
Commander McLane wrote:-
Partly lazyness, but there is a method to my madness! As a lot of the ships I've done have custom AIs, adding numerous ships in the same 10km sphere was handy for testing the AIs. Eg a series of addShipswithinRadius, police prirate, cutsomship etc lets you test how the testship behaves towards pirates traders etc.. I don't know, however, why he uses the addShipsWithinRadius-method. A <string>addShipsAt: trade_occasions_hermit 1 wpm 0 0 4000</string> would do the same trick.
EG if you want to test how your new ship reacts to traders, police, pirates and thargoids, you just add a :-
Code: Select all
<key>testship</key>
<array>
<dict>
<key>conditions</key>
<array>
<string>status_string equal STATUS_EXITING_WITCHSPACE</string>
</array>
<key>do</key>
<array>
<key>testship</key>
<array>
<dict>
<key>conditions</key>
<array>
<string>status_string equal STATUS_EXITING_WITCHSPACE</string>
</array>
<key>do</key>
<array>
<string>addShipsWithinRadius: test 1 wpm 0 0 4000 10000</string>
<string>addShipsWithinRadius: pirate 1 wpm 0 0 4000 10000</string>
<string>addShipsWithinRadius: trader 1 wpm 0 0 4000 10000</string>
<string>addShipsWithinRadius: thargoid 1 wpm 0 0 4000 10000</string>
</array>
</dict>
</array>
</array>
</dict>
</array>
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
-
- Harmless
- Posts: 1
- Joined: Tue Jun 28, 2011 10:56 pm
Re: Understanding commodities.plist
Could someone add the binary description to the wiki on commodities calculations and/or clarify the binary math point in that wiki entry. It is critical to understanding the math and it is not mentioned at all. Additionally most people wouldn't understand the implications if it was mentioned.
http://wiki.alioth.net/index.php/Commodities.plist
sorry to dig up the old thread but it is the only thing with a decent description of how the calculation in the wiki for commodities actually works...
While McClane's initial description of the binary math in this thread will be nigh impossible for some people to work though, it very clearly illustrates how the calculation is being processed in about as simple of a way as possible. Additionally, it or something very similar is a far more relevant example than what is currently in the wiki. I don't know why I didn't think of binary math when looking at the ampersand but until I managed to dig up this thread I played with the example for a few hours and didn't get anywhere.
example from wiki:
price = (65 + (133 & 7) + (3 * -3)) & 255 = (65 + 5 - 9) & 255 = 61
Using decimal based math how do you modify the initial value of 133 by 7 and result in 5? This does it but didn't make any sense - 1*7+2*7+3*7+4*7+5*7 (drop the remainder since it was less than 6*7) 5 is therefor the number of times that I did some random math pattern that happened to work for that set of numbers... The math also doesn't hold up with significantly different values.
So ... could someone either reference this thread in the wiki, edit the wiki entirely or, ideally, both? I created an account here and on mediawiki and couldn't use either to login so I assume that "users" for the wiki are restricted somehow.
I would edit it similar to this:
"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 binary math steps:"
With the example at the end I would add a link back to this thread with the detailed explanation and/or simply copy/edit that detailed explanation into the thread... Ensure that the ampersand is specifically called out as binary math and that the only numbers in the masks that won't give unexpected results are 1, 3, 7, 15 and rarely 31. Refer people back to binary math as to why or else they can accept "because I told you so" or maybe a like back to this thread. There are other binary "whole" numbers that would technically work but for the controls in oolite preventing prices and quantities from getting ridiculously high. So while 31 is technically valid it will usually exceed a limit as with 63 and 127.
31 isn't totally out of line since slaves and platinum both use it in the default station. Narcotics even uses 120 but as we have all noticed, narcotics pricing is the most random of all default pricing and tends to be low priced with none available or high priced with lots and if it is "reasonably priced" with some available it usually isn't "worth it". If another commodity acts this way without the benefit of it being illegal it could easily upset price balance.
As to the most recent discussions in this thread... I really don't think that we need to rework how the stuff is calculated so much as have a clear tutorial or guide for folks that don't speak binary. With a clear guide on what numbers are best (use others at your own risk) people will find the system much more use friendly in terms of coding.
Looking through 10 commodities.plists randomly the number of masks that are not 1, 3, 7, 15, 31 etc is extraordinarily high and the people that did them probably aren't sure why their prices do weird stuff randomly. While the con store OXP has all the right numbers for stable prices and so there must be a conflict with another OXP, I first noticed weird pricing behavior in a con store with Food, Textiles and Slaves all slightly above 100 in price. Then it happened 4 or 5 more times over a few game sessions... and so here I am making this post after researching what the heck was going on with that.
http://wiki.alioth.net/index.php/Commodities.plist
sorry to dig up the old thread but it is the only thing with a decent description of how the calculation in the wiki for commodities actually works...
While McClane's initial description of the binary math in this thread will be nigh impossible for some people to work though, it very clearly illustrates how the calculation is being processed in about as simple of a way as possible. Additionally, it or something very similar is a far more relevant example than what is currently in the wiki. I don't know why I didn't think of binary math when looking at the ampersand but until I managed to dig up this thread I played with the example for a few hours and didn't get anywhere.
example from wiki:
price = (65 + (133 & 7) + (3 * -3)) & 255 = (65 + 5 - 9) & 255 = 61
Using decimal based math how do you modify the initial value of 133 by 7 and result in 5? This does it but didn't make any sense - 1*7+2*7+3*7+4*7+5*7 (drop the remainder since it was less than 6*7) 5 is therefor the number of times that I did some random math pattern that happened to work for that set of numbers... The math also doesn't hold up with significantly different values.
So ... could someone either reference this thread in the wiki, edit the wiki entirely or, ideally, both? I created an account here and on mediawiki and couldn't use either to login so I assume that "users" for the wiki are restricted somehow.
I would edit it similar to this:
"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 binary math steps:"
With the example at the end I would add a link back to this thread with the detailed explanation and/or simply copy/edit that detailed explanation into the thread... Ensure that the ampersand is specifically called out as binary math and that the only numbers in the masks that won't give unexpected results are 1, 3, 7, 15 and rarely 31. Refer people back to binary math as to why or else they can accept "because I told you so" or maybe a like back to this thread. There are other binary "whole" numbers that would technically work but for the controls in oolite preventing prices and quantities from getting ridiculously high. So while 31 is technically valid it will usually exceed a limit as with 63 and 127.
31 isn't totally out of line since slaves and platinum both use it in the default station. Narcotics even uses 120 but as we have all noticed, narcotics pricing is the most random of all default pricing and tends to be low priced with none available or high priced with lots and if it is "reasonably priced" with some available it usually isn't "worth it". If another commodity acts this way without the benefit of it being illegal it could easily upset price balance.
As to the most recent discussions in this thread... I really don't think that we need to rework how the stuff is calculated so much as have a clear tutorial or guide for folks that don't speak binary. With a clear guide on what numbers are best (use others at your own risk) people will find the system much more use friendly in terms of coding.
Looking through 10 commodities.plists randomly the number of masks that are not 1, 3, 7, 15, 31 etc is extraordinarily high and the people that did them probably aren't sure why their prices do weird stuff randomly. While the con store OXP has all the right numbers for stable prices and so there must be a conflict with another OXP, I first noticed weird pricing behavior in a con store with Food, Textiles and Slaves all slightly above 100 in price. Then it happened 4 or 5 more times over a few game sessions... and so here I am making this post after researching what the heck was going on with that.
- Fatleaf
- Intergalactic Spam Assassin
- Posts: 1988
- Joined: Tue Jun 08, 2010 5:11 am
- Location: In analysis mode on Phaelon
- Contact:
Re: Understanding commodities.plist
Don't apologize. We love old threads. This place is full of them.CommanderRodger wrote:sorry to dig up the old thread
And Welcome to the friendliest board this side of Riedquat.
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
Holds the Ooniversal record for "Thread Necromancy"
Re: Understanding commodities.plist
An interesting side-effect of the roll-over nature values of commodities is what could be called the "Platinum Paradox".
( "Platinum", 0, 0, 171, -2, -2, 55, 31, 31, 1 ),
Platinum's base price is 171, which means (171 * 0.4 =) 68.4 credits.
The economy type increases both the number for sale and decreases the price for sale, so for a Poor Agriculture (which = 7):
-2 * 7 = price decreased by -14 or (-14 * 0.4 =) 5.6 credits.
-2 * 7 = -14 reduction in the number for sale (so a net positive increase of 14)
55 kg base amount for sale.
31 is the market mask price, meaning the price can vary from 0-31 on top of the economy-based change.
31 is the market mask quantity, so the number for sale can also vary by 0-31 kg on top of the economy-based change.
Seems simple enough -- in a Poor Agriculture, the price ranges from 157 (62.8 credits) to 188 (75.2 credits) and the quantity for sale varies by...and we have a problem:
55 + 14 = 69 kg is greater than the 63 kg total amount allowed for sale at once, so the amount for sale flips over to 0 going from 63->64 and starts counting upwards again. 69 kg thus becomes 5 kg base amount plus a 0-31 kg variable amount...so 5-36 kg. That's part of the paradox.
The other part is what happens at Rich Industrial systems. The price for sale becomes 171 + 0-31 -- or 171 to 202. In credits, that's 68.4 to 80.8 -- so higher price means higher demand? Yes, but no. Amount for sale changes drastically! The 55 kg base amount varies by 0-31 more, which means sometimes there is 55-63 kg for sale at Rich Industrial systems. But more likely the amount for sale has flipped over at 64 and is only 0-23 kg. That's the 2nd part of the paradox.
While the average prices for Platinum are cheaper in a Poor Agriculture, the amount for sale is sometimes considerably less. When the amount for sale is near-max at a Rich Industrial...the price is low for a Rich Industrial, sometimes even <70 credits/kg.
So the "best" place to regularly find large amounts (55-63 kg) of Platinum at a somewhat low price is a Rich Industrial!
( "Platinum", 0, 0, 171, -2, -2, 55, 31, 31, 1 ),
Platinum's base price is 171, which means (171 * 0.4 =) 68.4 credits.
The economy type increases both the number for sale and decreases the price for sale, so for a Poor Agriculture (which = 7):
-2 * 7 = price decreased by -14 or (-14 * 0.4 =) 5.6 credits.
-2 * 7 = -14 reduction in the number for sale (so a net positive increase of 14)
55 kg base amount for sale.
31 is the market mask price, meaning the price can vary from 0-31 on top of the economy-based change.
31 is the market mask quantity, so the number for sale can also vary by 0-31 kg on top of the economy-based change.
Seems simple enough -- in a Poor Agriculture, the price ranges from 157 (62.8 credits) to 188 (75.2 credits) and the quantity for sale varies by...and we have a problem:
55 + 14 = 69 kg is greater than the 63 kg total amount allowed for sale at once, so the amount for sale flips over to 0 going from 63->64 and starts counting upwards again. 69 kg thus becomes 5 kg base amount plus a 0-31 kg variable amount...so 5-36 kg. That's part of the paradox.
The other part is what happens at Rich Industrial systems. The price for sale becomes 171 + 0-31 -- or 171 to 202. In credits, that's 68.4 to 80.8 -- so higher price means higher demand? Yes, but no. Amount for sale changes drastically! The 55 kg base amount varies by 0-31 more, which means sometimes there is 55-63 kg for sale at Rich Industrial systems. But more likely the amount for sale has flipped over at 64 and is only 0-23 kg. That's the 2nd part of the paradox.
While the average prices for Platinum are cheaper in a Poor Agriculture, the amount for sale is sometimes considerably less. When the amount for sale is near-max at a Rich Industrial...the price is low for a Rich Industrial, sometimes even <70 credits/kg.
So the "best" place to regularly find large amounts (55-63 kg) of Platinum at a somewhat low price is a Rich Industrial!