Logo Platform
logo amplifiers simplified

Differences in handling "DustInflation"

Reply
Copied to clipboard!
7 years ago
May 6, 2018, 7:01:07 AM

I'm trying to give some changes to dust inflation mechanics. And I found several ways to handle the "DustInflation"


SimulationDescriptors[Marketplace].xml

<Property Name="DustInflation" BaseValue="1" MinValue="0.25"/>

<Property Name="DustInflationLastTurn" BaseValue="1" MinValue="0.25"/>

<Property Name="DustInflationFactor" BaseValue="0.000175" MinValue="0"/>

<!--Dust Inflation-->


<BinaryModifier Priority="-10" Right="$(DustInflationFactor)" BinaryOperation="Multiplication" Left="$(DustGlobalProduction)" Operation="Addition" TargetProperty="DustInflation"/>

<Modifier Priority="-10" Operation="Force" TargetProperty="Inflation" Value="$(DustInflation)" Path="ClassMarketplace/ClassTradableCategory/ClassTradableSubCategory/ClassTradable"/>

<BinaryModifier Priority="-10" Right="$(DustInflationFactor)" BinaryOperation="Multiplication" Left="$(DustGlobalProductionLastTurn)" Operation="Addition" TargetProperty="DustInflationLastTurn"/>

<Modifier Priority="-10" Operation="Force" TargetProperty="InflationLastTurn" Value="$(DustInflationLastTurn)" Path="ClassMarketplace/ClassTradableCategory/ClassTradableSubCategory/ClassTradable"/>

In 'SimulationDescriptors[Marketplace].xml', DustInflation was calculated with DustGlobalProduction.


In 'SimulationDescriptors[Empire].xml' also, practically same thing goes again.




SimulationDescriptors[Tradables].xml

<Property Name="Inflation" BaseValue="1"/>

<Property Name="InflationLastTurn" BaseValue="1"/>

In 'SimulationDescriptors[Tradables].xml', it just uses inflation value without any path specification or calculation. I thought that 'Force' operation in 'SimulationDescriptors[Marketplace].xml' was the procedure of sending inflation value to 'SimulationDescriptors[Tradables].xml'.




SimulationDescriptors[TradableCategories].xml

<!-- Value -->

<!-- Just standard price variations for buy / sell transactions -->

<Modifier Value="$(ValueLastTurn)" Operation="Addition" TargetProperty="Value" SearchValueFromPath="true" Path="TradableSubCategoryShip/ClassTradable"/>

<Modifier Value="$(InflationLastTurn)" Operation="Division" TargetProperty="Value" SearchValueFromPath="true" Path="TradableSubCategoryShip/ClassTradable"/>

<Modifier Value="$(PriceChange)" Operation="Addition" TargetProperty="Value" SearchValueFromPath="true" Path="TradableSubCategoryShip/ClassTradable"/>

<BinaryModifier Operation="Addition" TargetProperty="Value" SearchValueFromPath="true" Path="TradableSubCategoryShip/ClassTradable" Right="$(MinDemandPriceChange)" BinaryOperation="Multiplication" Left="$(PassedDemand)"/>

In 'SimulationDescriptors[TradableCategories].xml', it seems getting the inflation by specifying path and name of variable.




   ElectionActionDefinitions.xml


<CustomCost Instant="true" ResourceName="EmpireMoney">150 * (Property(StockLocation,@'../ClassEmpire,!AffinityGameplayVampirilis', SystemCount,true) + Property(StockLocation,@'../ClassEmpire,AffinityGameplayVampirilis', MothershipCount,true) ) * Property(StockLocation,@../ClassEmpire/ClassSenate, ElectionActionCost) * Property(StockLocation, @ClassEmpire, DustInflation)</CustomCost>


   EntityActions[Fleet].xml


<CustomCost ResourceName="Strategic1" Instant="true">Property(Context,@'../ClassEmpire',SuperColonizationCost) * Property(Context,@'../ClassEmpire',SuperColonizationStrategicCostFraction) / Property(Context,@'../ClassEmpire',DustInflation)</CustomCost>


   Simulation\EntityActions[Pirate].xml


<CustomCost ResourceName="EmpireMoney" Instant="true">(250 * (1 + (0.3 * Property(PirateEmpire,@'ClassEmpire,EmpireTypePirate',BuyMarkPirateActionCount)))) * Property(StockLocation,@ClassEmpire,DustInflation)</CustomCost>


   ResourceConverterDefinitions.xml


<InterpreterModifier>($(Input)) * Property(StockLocation,@../ClassEmpire, GameSpeedMultiplier) * Property(StockLocation, @../ClassEmpire, DustInflation)</InterpreterModifier>


   TradingCompanyImprovementDefinitions.xml


<CustomCost Instant="true" ResourceName="EmpireMoney"> (100 * (1 + Pow((Property(Context, @ClassTradingCompany, DustImprovementCount)+Property(Context, @ClassTradingCompany, LuxuryImprovementCount)), 1.5)) - 50) * Property(Context, @../ClassEmpire, TradingCompanyImprovementCostReduction) * Property(Context, @../ClassEmpire, DustInflation) </CustomCost>

They seems to be everal examples of property function. But they have some differences.


Here's the questions.



Q1. Why 'SimulationDescriptors[Marketplace].xml' and 'SimulationDescriptors[Empire].xml' do the same calculation separately?


Q2. What's the difference between force operation method in 'SimulationDescriptors[Marketplace].xml' and SearchValueFromPath method in 'SimulationDescriptors[TradableCategories].xml'?


Q3. In property function examples, they have some differences.



Property(StockLocation, @ClassEmpire, DustInflation)
Property(StockLocation,@ClassEmpire,DustInflation)


Property(StockLocation, @../ClassEmpire, DustInflation)


Property(Context, @../ClassEmpire, DustInflation)

Property(Context,@'../ClassEmpire',DustInflation)

A(Object) - StockLocation & Context

B(Path) - @ClassEmpire & @../ClassEmpire & @'../ClassEmpire'


Are they doing somehow different work? I can't discern the differences between them.




0Send private message
7 years ago
May 7, 2018, 9:45:19 AM

Hey PARAdoxiBLE!


Q1. Why 'SimulationDescriptors[Marketplace].xml' and 'SimulationDescriptors[Empire].xml' do the same calculation separately?

Here's a rapid architecture of the Simulation:


> Empire (major, minor, pirate, lesser)
  > ColonizedStarSystem
    > ColonizedPlanet
      > PopulationPlanet
      > ColonizedResourceDeposit
      > PlanetImprovement
    > Hangar
      > Hero ship
    > Hero
    > PopulationStarSystem
    > StarSystemImprovement
  > DepartmentOfCommerce
    > TradingCompanies
  > DepartmentOfForeignAffairs ("Diplomacy")
    > DiplomaticEmpire
  > DepartmentOfEducation ("Education")
  > Fleet
    > Ship (ship, hero ship, mothership)
      > Section
        > Module
    > Hero
  > LostSystems (systems that have been captured)
  > Unassigned hero
  > Relations with minor empires
  > "Phantom garrison"
    > Fake ships for empire's ship designs
      > Section
        > Module
  > PopulationEmpire
  > Quests
  > DepartmentOfResearch ("Research")
  > Senate
    > Active law
    > Senator
  > Uniques (tags for unique buildings)
> Marketplace
  > TradableCategory
    > TradableSubcategory
      > Tradables
> Galaxy
  > Star system
    > Planet
      > ResourceDeposit
> VictoryManager

As you can see, both Empires and Marketplace are on the left, and it means they can't interact with each other.

The Sealed property DustGlobalProduction is built from the empires and set on the Marketplace and all empires, and modifiers have to be duplicated to produce the same "final" result. 

The Empire has a DustInflationModifier, which is used by an EmpireImprovement (reduces the inflation's effects by 20%), that's why both operations are made separately.


Q2. What's the difference between force operation method in 'SimulationDescriptors[Marketplace].xml' and SearchValueFromPath method in 'SimulationDescriptors[TradableCategories].xml'?

In the marketplace modifier, the Force operation sets the value of Inflation and InflationLastTurn on the Tradable, using its own property DustInflation.

Then, in the TradableCategory, the Value (price without taxes) of the Tradable is affected by the value of InflationLastTurn on the ClassTradableShip...

I don't really know why it is done this way instead of just doing it on ClassTradableShip, but I guess there's a good reason.


Setting SearchValueFromPath to true means the value of the modifier will not be taken from the object which has the modifier (category), but from the target of the modifier (tradable):

InflationLastTurn is defined only on the Tradable, not the TradableCategory.


Q3. In property function examples, they have some differences.

All of these function do the same thing, but they are used at different locations which change the parameters and their name:

- When computing a cost, the location of where the cost will be paid is called "StockLocation", most of the time. The parameter Context is also sometimes valid and the same object...

- When computing a prerequisite, the location of the check is called "Context", most of the time.

- In some situations, the programmer decided it was some way instead of another, and there are no specific rules on this: we're supposed to add comments which explain what is what, but we don't always do, and sometimes they get accidentally erased...


As for the second parameter, the path, when it is certain the object StockLocation is the empire, the path can simply be 'ClassEmpire'.

But when the parameter may be something else (for instance a Colonized star system for a system improvement), it is safer to write ../ClassEmpire.

When a path is complex, eg. '../ClassEmpire,AffinityGameplayCravers', the path must be written between quotes, because the ',' would cause issues otherwise.

If the path is simple (no ','), the ' are not needed but they do no harm.

Updated 7 years ago.
0Send private message
?

Click here to login

Reply
Comment

Characters : 0
No results
0Send private message