... iEuropeVolumeAttrition (I really hope it's not % multiplier, then)
No, it is not a % modifer, I had checked again.
It is a flat integer that is added / substracted every turn.

leave iPriceCorrectionPercent ?
I would not touch it, otherwise the prices may become a bit "bouncy".
(Which I originally thought was what you wanted.)
 
Ok, thanks for help! I think I'm on good path to understanding system now :)

(Which I originally thought was what you wanted.)
It's because I originally had absolutely no idea what do I even want to achieve :hammer2:



Actually, now I started to think - maybe system would work with all iPriceCorrectionPercent being = to 0. I don't really like randomness and... adjusting attrition to good value might be good enough.
 
Won't that mean prices don't change at all? If I've understood the price change mechanics correctly, the best way to reduce randomness would be to set iPriceCorrectionPercent to 100, but to compensate by raising the iPriceChangeThreshold very high - that way it'll be predictable, instantly changing exactly when the threshold is exceeded and not otherwise.
 
iPriceCorrectionPercent to 100
If you do this, then every turn the price will be reset back to "Original" price.
--> No more price changes at all basically.
  • iPriceCorrectionPercent = 100 --> No more price changes (instant "self-recovery" back to original prices, all trade effects from selling / buying will be countered)
  • iPriceCorrectionPercent = 0 --> No more "self-recovery" mechanism (the mechanism to counter trade trends from selling / buying is deactivated)
 
I found the guide I read a while back:
Actually I think you are correct. :think:

-----------

It is a factor multiplied by "diff between threshold and actual".
(So the bigger the diff, the more likely a price change,)

Then it is compared against a random of base 100 which makes it kind of "percentish".
(And yes, only if that is true an actual price change will occur.)

-----------

So yeah, it is basically the "volatility" and the higher it gets, the more volatile the prices react on selling / buying beyond the thresholds.
The "recovey mechanism" I had in mind, is really just done by EuropeVolumeAttrition.

-----------

Code:
void CvPlayer::doPrices()
{
   if (isEurope())
   {
       for (int iYield = 0; iYield < NUM_YIELD_TYPES; ++iYield)
       {
           YieldTypes eYield = (YieldTypes) iYield;
           CvYieldInfo& kYield = GC.getYieldInfo(eYield);

           if (kYield.isCargo())
           {
               // R&R, Androrc Price Recovery
               GC.getGameINLINE().changeYieldBoughtTotal(getID(), eYield, kYield.getEuropeVolumeAttrition());
               //Androrc End

               int iBaseThreshold = kYield.getPriceChangeThreshold() * GC.getHandicapInfo(getHandicapType()).getEuropePriceThresholdMultiplier() * GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getGrowthPercent() / 10000;
               int iNewPrice = kYield.getBuyPriceLow() + GC.getGameINLINE().getSorenRandNum(kYield.getBuyPriceHigh() - kYield.getBuyPriceLow() + 1, "Price selection");
               iNewPrice += getYieldBoughtTotal(eYield) / std::max(1, iBaseThreshold);

               if (GC.getGameINLINE().getSorenRandNum(100, "Price correction") < kYield.getPriceCorrectionPercent() * std::abs(iNewPrice - getYieldBuyPrice(eYield)))
               {
                   iNewPrice = std::min(iNewPrice, getYieldBuyPrice(eYield) + 1);
                   iNewPrice = std::max(iNewPrice, getYieldBuyPrice(eYield) - 1);
                   setYieldBuyPrice(eYield, iNewPrice, true);
               }
           }
       }
   }
 
Last edited:
Top Bottom