Market Prices from items.xml

rjlive
Posts: 6
Joined: Wed Jun 10, 2020 10:09 am

Market Prices from items.xml

Post by rjlive »

Has anyone deconstructed the market prices from items.xml in the save game files yet?
I'm trying to get the prices for each product in the market, but failing at the moment. :-(

I know Amplitude, Period and Time in each of the CurveBaseCurve and Curve1 nodes are the dynamic values, and the rest are generally static but not worked out the formula yet. I'm currently on the route of it being FFT (but may be well off the mark).
User avatar
Guil
Posts: 7432
Joined: Fri Aug 21, 2015 8:43 pm
Location: Ireland

Re: Market Prices from items.xml

Post by Guil »

Hi, this thread may be of help to you.
viewtopic.php?t=167448
rjlive
Posts: 6
Joined: Wed Jun 10, 2020 10:09 am

Re: Market Prices from items.xml

Post by rjlive »

Hi Guil,

Thanks for the reply. I'm not sure I can see that thread answers my question (unless I missed a post on the 8 pages). It more talks about what items are the most profitable.

I'm more looking for how to get the value of the stock from the items.xml in the saved game.
For example: I know that putting the below into the items.xml will give the wheat market price of 488. My question is, what formula gives that 488.


<stats fillType="WHEAT" received="0.000000" paid="0.000000" priceVersion="1" isInPlateau="true" nextPlateauNumber="1" plateauDuration="51840000" meanValue="0.000000" plateauTime="50870172.000000">
<curveBaseCurve nominalAmplitude="0.067400" nominalAmplitudeVariation="0.050550" amplitudeDistribution="2" nominalPeriod="172800000" nominalPeriodVariation="64800000" periodDistribution="1" amplitude="0.102459" period="79647848.000000" time="59735888.000000"/>
<curve1 nominalAmplitude="0.033700" nominalAmplitudeVariation="0.006740" amplitudeDistribution="1" nominalPeriod="604800000" nominalPeriodVariation="120960000" periodDistribution="1" amplitude="0.037597" period="528833056.000000" time="115962080.000000"/>
</stats>


Thanks
User avatar
kahfs
Posts: 489
Joined: Fri Nov 11, 2016 8:08 am

Re: Market Prices from items.xml

Post by kahfs »

Crop prices are normally defined in the fillTypes.xml file within the mod map.
K. Henneberg/ArmChairFarming. Author of RealLifeNumbers (FS19, FS22)
humbe
Posts: 1447
Joined: Sat Jan 18, 2020 9:33 pm

Re: Market Prices from items.xml

Post by humbe »

There's a mean price defined in game or overridden by some mod, but the XML above is from the savegame, likely indicating how the prices are fluctuating right now, which can be used to calculate the price at some sellpoint for exactly that crop right now. If you figure it out, what do you need it for?
rjlive
Posts: 6
Joined: Wed Jun 10, 2020 10:09 am

Re: Market Prices from items.xml

Post by rjlive »

Just writing a little bit of software to give a bit of a to do list of the save game I'm playing.

e.g.
Good price available to sell wheat at x sell point.
Harvest x field etc

It's the calculating of the price I'm having trouble working out at the moment. My current guess is that it's some advanced maths to create the curve but it's over my head at the moment. Haha.
humbe
Posts: 1447
Joined: Sat Jan 18, 2020 9:33 pm

Re: Market Prices from items.xml

Post by humbe »

I've written software to analyze savegames too.. But haven't extracted sell point sell values. But I do detect that we have sold, and tracking exactly how many liters of crop I'm missing, and calculating price we got for it.
rjlive
Posts: 6
Joined: Wed Jun 10, 2020 10:09 am

Re: Market Prices from items.xml

Post by rjlive »

I ended up cheating / hacking a little bit as I failed in working it out from the xml files although I'm quite sure it creates two Sine waves, just couldn't work out how.

After a lot of screaming and head scratching, I created a mod that outputs the prices every x amount of seconds into an xml file, then my outside app checks whether that file has been updated. Luckily the "random delta" is available internally which looks to be the only value missing from the save game xmls.
Napster653
Posts: 1
Joined: Tue Jan 10, 2023 1:21 pm

Re: Market Prices from items.xml

Post by Napster653 »

Sorry for reviving an old thread, but I was wondering if that mod you made could be ported to FS22. I'm looking for exactly that and it's very frustrating as you know.
humbe
Posts: 1447
Joined: Sat Jan 18, 2020 9:33 pm

Re: Market Prices from items.xml

Post by humbe »

I guess noone has found an answer for this in FS22 yet? Trying to do the same thing in my savegame tracker again ;D..

I've found the base crop prices in maps_fillTypes.xml, which a map mod can override if wanted (possibly linking to a differently named file). Here it also lists the base variations between the months. Starting from March sadly as that's the first period in FS22. So for instance 1.07 means that on average there's 7% higher prices than mean prices this month..

Then the save game has a separate set of definitions in careerSavegame.xml. As the months passes, it seems that the price for the period is then somehow randomly adjusted around that month, so the savegame's xml file will list the actual difference from the mean for this period in this specific year. I haven't calculated correctly the whole thing, so I can't be certain, but it looks like the multiplier in careerSavegame.xml replaces instead of adds onto the default periodic change, (but is a bit above or below due to some randomness function).

In the placeables definitions, you can find price adjustments for each selling station. I think they are mostly set to 1, but in the western wilds map I'm playing, the train station is for some reason set to a factor of 1.5, and thus you can sell goods there for +50% higher price, which always makes this the best selling station. This applies on top of the value above.

But then, the last factor (which looks to be a fairly small factor), is a small variation which is set per selling station. This is typically what makes different selling stations offer different prices, and likely explain differences within the same period. As explained above, the placeables.xml for the savegame will have data like:

Code: Select all

<stats fillType="OAT" received="0.000000" paid="0.000000" priceVersion="1" isInPlateau="false" nextPlateauNumber="1" plateauDuration="51840000" meanValue="0.000000" plateauTime="0.000000">
  <curveBaseCurve nominalAmplitude="0.008858" nominalAmplitudeVariation="0.000886" amplitudeDistribution="2" nominalPeriod="172800000" nominalPeriodVariation="64800000" periodDistribution="1" amplitude="0.008619" period="73266584.000000" time="18415596.000000"/>
  <curve1 nominalAmplitude="0.008858" nominalAmplitudeVariation="0.000886" amplitudeDistribution="1" nominalPeriod="604800000" nominalPeriodVariation="120960000" periodDistribution="1" amplitude="0.008835" period="502730496.000000" time="348835520.000000"/>
</stats>
I agree with the original poster that it's likely constants to adjust a function, and it sounds like two periodic functions combined. I haven't figured out the function either, though I haven't actually tried much, apart from trying to see if I could find something obvious. But an amplitude in such functions, is typically the maximum change from the mean value, and thus an amplitude of 0.008858 would mean that the prices vary less than 1% of the mean value, which is a fairly minor effect. I see some amplitudes getting a bit higher. It looks like products may have higher variations than raw products.

I've failed to figure out the formula the above inputs into. I guess it is unlikely to be documented anywhere public, as it's likely an internal development detail for a function in code to add some random variation between sellpoints. But with the period changes from the savegame and the selling station adjustment ratios, I at least get fairly close to the price.
Post Reply