Democracy 4

Democracy 4

The Think Tank
Have a bright new policy idea? or want to add your country? or include new political/economic events into the game? Welcome to the politics think tank
QBall 31 Jan, 2023 @ 5:10pm
Modding math issue
I am trying to add a new situation and there seems to be something wrong with my understanding of how the quantities work, or else how the game does math. Any clarification would be appreciated.

The relevant part of my situations.csv entry is "NuclearWeapons,(0.25+0.1*x^0.2),2". Assuming that the game still treats policies that have discrete settings (i.e., not continuous) as amounts ranging from 0 to 1, USA starts with Nuclear Weapons at the sixth of seven notches, which should be 5/6=0.8333.... Then the contribution would be 0.25+0.1*(0.8333^0.2)=0.3464. However, when I run the game, it says that the contribution of Nuclear Weapons to the situation is 69.81%, which is close to but not exactly double what it should be. What's going on here?

I am having a similar problem with the effect of Foreign Relations, which is specified with "ForeignRelations,-0.4+0.5*(x^0.5),12". At USA's initial Foreign Relations this should have a net negative effect, but when I run the game it's slightly positive (about +1.6%).

If it matters, the full string is [the EU icon is placeholding for now] #,AmericanSecurityUmbrella,FOREIGNPOLICY,,sit_icons_eu,1,0.7,0.6,0,0+(1.0*x),0,0+(1.0*x),"MilitarySpending,(x^2.5)*(ForeignRelations^0.6)*(GDP^0.2),2","NuclearWeapons,(0.25+0.1*x^0.2),2","ForeignRelations,-0.4+0.5*(x^0.5),12",#,"ForeignRelations,0.1+0.02*x,20","InternationalTrade,0.05+0.01*x","_globaleconomy_,0.1+0.05*x,24",,,,,,,,,,,,

Thanks for reading, and hoping you can help!
< >
Showing 1-3 of 3 comments
Chantern15 1 24 Sep, 2024 @ 4:10pm 
Did you manage to fix this?
QBall 27 Sep, 2024 @ 2:07pm 
I haven't tried recently. Someone else told me that parentheses don't actually work in the math; it just executes operations in the order that they're given. This makes use of some function structures actually impossible without breaking out quantities into separate variables. If I remember correctly, that explained at least some of the trouble I was having.
Chantern15 1 27 Sep, 2024 @ 3:22pm 
Originally posted by QBall:
I haven't tried recently. Someone else told me that parentheses don't actually work in the math; it just executes operations in the order that they're given. This makes use of some function structures actually impossible without breaking out quantities into separate variables. If I remember correctly, that explained at least some of the trouble I was having.


What's the workaround which you found?
< >
Showing 1-3 of 3 comments
Per page: 1530 50