Page 1 of 2

Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 4:50 pm
by Frame
I'm proud to present the

Oolite Commodity Calculator

A tool to calculate prices for your OXP station, or for where to head next planning your journey across the stars..
It comes with no instructions as for OXP developers it should be pretty straight forward and testing and practice makes perfect..

It is written in HTML 4 & Java Script, therefore you should have no problem in running it. If you are getting errors, please PM me
these along with a console readout of the error.. (consult your Browsers help documents for the whereabouts of this).

Image

Download here (your browser might block downloadeble html files, just allow for this once only)

http://www.box.com/s/pgh49z5g2luq48zn2554

Cheers Frame

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 5:13 pm
by Commander McLane
Looking good! :D

I have one suggestion: the highest and lowest price alone can be deceitful because of the overflow issue. For instance, lowest = 1.2 and highest = 100.4 looks like an even distribution across the price range at first sight, but may actually be anything but. It could (and is likely to) reflect a price range from 83.6 to 103.2 in steps of 2.8, and only the last step causes an overflow. Therefore you would never see a price between 1.2 and 83.6. Or it could reflect a price range from 100.4 to 120 in the same steps of 2.8, with all values beginning from 103.2 overflowing. 120 would translate into 18 and you would never see a price between 18 and 101.4. For this reason it would be helpful to add the actual price range as an information, from the lowest to the highest price before the overflow takes place.

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 7:13 pm
by Frame
Commander McLane wrote:
Looking good! :D

I have one suggestion: the highest and lowest price alone can be deceitful because of the overflow issue. For instance, lowest = 1.2 and highest = 100.4 looks like an even distribution across the price range at first sight, but may actually be anything but. It could (and is likely to) reflect a price range from 83.6 to 103.2 in steps of 2.8, and only the last step causes an overflow. Therefore you would never see a price between 1.2 and 83.6. Or it could reflect a price range from 100.4 to 120 in the same steps of 2.8, with all values beginning from 103.2 overflowing. 120 would translate into 18 and you would never see a price between 18 and 101.4. For this reason it would be helpful to add the actual price range as an information, from the lowest to the highest price before the overflow takes place.
I'm afraid i lost out on that discussion. And you lost me in regard to "overflow". I have tried understanding what you wrote, but you seem to contradict your self
Therefore you would never see a price between 1.2 and 83.6
you would never see a price between 18 and 101.4
Link Please to something with more clarity please :), I do not understand.
Cheers Frame...

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 7:32 pm
by Frame
ok a bit of cross searching on your nick and "overflow" brought me to that constrores got that "overflow bug", which i think is fully intentional.

Constores got some odd prices..


If i punch in the numbers for a constore Food Commodity I get this.

Image

I can see there is a big jump from Rich Agricultural to Average Agricultural.. But I cannot see how this can be deceitful..

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 9:09 pm
by Switeck
It is "deceptive" because the price range seems like an even distribution between the largest and smallest values when it's anything but.

Narcotics from the main station can also flip over from 102 to ~1.2 credits/TC.

The fact that quite a few OXP stations suffer from ridiculous price differences from the main station makes them almost game cheat "free money".

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 9:48 pm
by Frame
I would not classify that as a bug, rather expected behavior.

I think the main reason that some OXP stations got trouble with prices is because they do not understand
how the commodity entries work..

Now with this tool, you can see the Maximum and Minimum Prices, even target such behavior, should
it be wanted.

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 10:01 pm
by Commander McLane
Switeck wrote:
It is "deceptive" because the price range seems like an even distribution between the largest and smallest values when it's anything but.
Thank you, 'deceptive' is the word I was looking for.

The overflow is not a bug, but a feature. It's simply a part of the calculation formula. The final '& 256' ensures that only the first eight bits (= range between 0 and 255) go into the final price, all higher bits are ignored. As a result the value flips over: 256 becomes 0, 257 becomes 1, 258 becomes 2, and so on.

After the calculation the result is multiplied with 0.4 in order to get the actual price. This determines the total price range: 0 * 0.4 = 0; ... 255 * 0.4 = 102. No prices lower than 0 or higher than 102 can ever be in the game. Again, higher prices 'flip over': 256 becomes 0, 0 * 0.4 = 0; 257 becomes 1, 1 * 0.4 = 0.4. And so on. (Apologies if this is only a repetition of well-known facts.)

Now look at the Narcotics prices in the various economies. From 'average industrial' up to 'rich agricultural' they are not affected by the overflow, they don't flip over. They follow an easily to see pattern: the difference between the lowest and highest is exactly 48, and for each higher economy both highest and lowest are 11.6 above the previous economy: AvInd low = 3.2, high = 51.2 (difference 48); PoorInd low = 3.2 + 11.6 = 14.8, high = 51.2 + 11.6 = 62.8; MainInd low = 14.8 + 11.6 = 26.4, high = 62.8 + 11.6 = 74.4; and so on. Now what about rich industrial? According to the formula just established we can take the low and high value of the average industrial and subtract 11.6. This gives us 3.2 - 11.6 = -8.4 and 51.2 - 11.6 = 39.6. Thus, -8.4 and 39.6 are the actual lowest and highest prices for narcotics in rich industrials. But there are no negative prices. The price flips just like a price higher than 102 would flip, only in the opposite direction. What leaves at the upper border of the range re-enters at the lower border. And what leaves at the lower border of the range re-enters at the upper border. The price of -8.4 becomes 102 - 8.4 = 93.6. Therefore the real price range for Narcotics in rich industrials is from 93.6 to 102, and from 0 to 39.6. Because prices grow in fixed steps (in this case in steps of 2.8 ), neither the 102 nor the 0 are actually hit, but 100.4 and 1.2 are the steps closest to the flipping point. If you just look at the two numbers in the calculator you could assume that prices are somehow evenly distributed between 1.2 and 100.4, but you would be wrong. In reality there are a couple of possible prices between 1.2 and 39.6, and another couple of possible prices between 93.6 and 100.4, but you will never find a price between 39.6 and 93.6.

The same goes for the last two economies. The actual price range in average agriculturals is 49.6 + 11.6 = 61.2 as low price and 97.6 + 11.6 = 109.2 as high price. Again, everything above 102 flips over and therefore you get an effective range from 61.2 to 102 and from 0 to 7.2, with nothing between 7.2 and 61.2.

Finally, in poor agriculturals the low price is 61.2 + 11.6 = 72.8 and the high price is 109.2 + 11.6 = 120.8. Again, the 120.8 flips over and you get an effective range from 72.8 to 102 and from 0 to 18.8, with nothing between 18.8 and 72.8.

In order to get a feeling for which prices are actually met in the game and which are not, I think it's important to know the true price range for each economy without the flipover (or overflow). The numbers that happen to be the lowest and highest after the flipover (like 1.2 and 100.4 in case of RichInd) don't convey this information. That's why they are (or at least can be) deceptive (thanks again, Switeck, for giving me the right word).

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 10:30 pm
by Frame
I get it now, you mean

Commodity prices are not Evenly distributed across the Economies, when price of example: Rich Industrials is so low that when it stepwise is lowered according to the formula & economy so when it hits 0 its flips and becomes approximately 102.. and vice versa, its hard to predict what end of the price range it will be, according to the Economy of the system.

That is the way I always thought it worked, and for computers & luxuries and the rest, care was taken to ensure it cannot happen...

This behavior is entirely up to the OXP author to decide...

and from my lower chart with high/low prices you can still get a feeling for what the prices can be, its still going to be a guessing game as everything depends on MARKET_RND

Thanks for the feedback.

Cheers Frame

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 10:47 pm
by SandJ
Frame wrote:
... It comes with no instructions as for OXP developers it should be pretty straight forward and testing and practice makes perfect...
Hmm. It has been my experience sometimes in the past that "No documentation" = bugs or misunderstandings or poor product. I think this happens because one who cannot, or do not want to, describe what the software does, is not confident themselves of its output or how it produced it.

Go on, make it easy on the newbies and write a few hundred words explaining what it does and why. Having put so much effort into writing the tool, it is a shame to spoil it by not finishing off the job nicely by. It'll only take an hour or two to write a "how to" guide and then you can include version tracking, ownership and credits too. :)

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 11:04 pm
by Switeck
Commander McLane wrote:
Switeck wrote:
It is "deceptive" because the price range seems like an even distribution between the largest and smallest values when it's anything but.
Thank you, 'deceptive' is the word I was looking for.

The overflow is not a bug, but a feature. It's simply a part of the calculation formula.
Or if deceptive is too loaded a word...confusing isn't. :lol:

Indeed the overflow is a feature, not a bug. However it may be considered a bug in OXPs that do not take that into consideration when choosing price ranges for commodities.

Even if OXPs do avoid overflows in the commodities, they can still result in huge price swings relative the prices for the same items at the not-too-distant main station in the same system. Possibly the most extreme example is food at 102 credits max value at an average agriculture Constore (assuming Constores could ever appear at such!)...while the main station's food price is 2.8 or 3.2 credits and there's 18-19 TC for sale. Intentional or not, such huge price differences are game-imbalancing "free money". At least when buying Narcotics for cheap at a main station, you're going to be an offender or fugitive the moment you launch from the main station with them...and there's no guarantees you'll quickly find another main station buying them for >90 credits/TC before Vipers and bounty hunters find you.

I'm pretty sure Platinum has an intentional overflow on how much is for sale at main stations.
...while Gold at the main station and minerals at Rock Hermits both appear to have an unintentional overflow on how much are for sale.
Due to Gem-Stones starting out at 250 (-5?) base amount for sale, you'll be hard-pressed to accumulate >100g quickly by buying them at Rock Hermits and main stations...outside of cargo contracts or scooping cargo canisters.

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 11:08 pm
by Cody
Switeck wrote:
At least when buying Narcotics for cheap at a main station, you're going to be an offender or fugitive the moment you launch from the main station with them...and there's no guarantees you'll quickly find another main station buying them for >90 credits/TC before Vipers and bounty hunters find you.
Ain't that the truth!

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 11:09 pm
by Frame
SandJ wrote:
Frame wrote:
... It comes with no instructions as for OXP developers it should be pretty straight forward and testing and practice makes perfect...
Hmm. It has been my experience sometimes in the past that "No documentation" = bugs or misunderstandings or poor product. I think this happens because one who cannot, or do not want to, describe what the software does, is not confident themselves of its output or how it produced it.

Go on, make it easy on the newbies and write a few hundred words explaining what it does and why. Having put so much effort into writing the tool, it is a shame to spoil it by not finishing off the job nicely by. It'll only take an hour or two to write a "how to" guide and then you can include version tracking, ownership and credits too. :)
I'm confident, I'm just lazy. I got a pretty laid back attitude towards this and i'm doing this in my freetime, documentation would be like..

enter the values in the fields & press button calculate Price to get the prices..
do the same for quantities. You can insert the default values by selecting the wanted commodity clicking that very button..
you can change the commodity name of the plist string for commodity.plist file by simply changing the name in the preset field


come on, I care to think that my fellow olitiens are clever enough to figure that one out, and text on screen is provided, version tracking is already in file as a comment.
I want to keep this as low maintenance as possible.

Cheers Frame

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 11:15 pm
by Frame
Switeck wrote:

I'm pretty sure Platinum has an intentional overflow on how much is for sale at main stations.
...while Gold at the main station and minerals at Rock Hermits both appear to have an unintentional overflow on how much are for sale.
Due to Gem-Stones starting out at 250 (-5?) base amount for sale, you'll be hard-pressed to accumulate >100g quickly by buying them at Rock Hermits and main stations...outside of cargo contracts or scooping cargo canisters.

The maximum amount for sale can never exceed 63, infact if it exceeds 127 its zeroed.

Code: Select all

ridn_ind_quantity = (MARKET_BASE_QUANTITY+(i&MARKET_MASK_QUANTITY)- (t * MARKET_ECO_ADJUST_QUANTITY)) & 255;
			
			
			if(ridn_ind_quantity > 127)
			{
			ridn_ind_quantity = 0
			}
			ridn_ind_quantity &= 63
Cheers Frame...

Re: Introducing Commodity Calculator Version 1.0

Posted: Fri Feb 17, 2012 11:25 pm
by DaddyHoggy
As somebody who has chosen (when I have chance to play) to never dock at a main station, I find the pricing at the non-main stations rather exciting, a real chance to make or lose a fortune in a single run!

I know it's a bug/feature but I have factored it into my playing style in my Ooniverse.

Re: Introducing Commodity Calculator Version 1.0

Posted: Sat Feb 18, 2012 11:24 am
by Svengali
Thanks Frame for this handy helper .-)