Modding Guides Basics Policies Dilemmas Events Situations Simulation Countries Installers

What can be modded in the game?

Democracy 3 is certainly a complex game, and coding and designing it was no easy task, but actually, modding the game is surprisingly easy. Almost all of the simulation elements within the game are loaded from simple text or csv files, which can be edited using any (free) text editor or spreadsheet program. You don't need to download any SDK, learn any languages or install any software. Anyone can mod Democracy 3, even if you've never done any modding or scripting of a game before. You can add new countries, situations, dilemmas, policies and more, using nothing more than a copy of windows notepad (or similar). You may need a graphics program to create any new icons for your policies though...

The basic modding principles

Democracy 3's simulation engine is based on a neural network. This is a computer simulation designed to work in a similar way to the human brain. Pretty much everything in the game is simulated in the same way, such as a voter, a group of voters, a policy or an event. All of these 'objects' are connected to each other by 'effects'. So an object might be 'IncomeTax' and an effect might be the link between IncomeTax and the happiness of the middle class voter group. The objects and effects in the game are not hard coded, they are all loaded in from 'csv' files, which can be opened in a text editor, or more conveniently by a spreadsheet program such as Microsoft Excel. You can edit these files, and save them, then start a new game and immediately play with the changed simulation.

CSV Files

You will find the majority of the CSV files for the game inside the games \program files\democracy 3 \data\simulation folder. the names should be pretty self-explanatory. The most interesting one is probably 'policies.csv'. You should be able to open this up directly using Microsoft Excel. If you edit and then save this file be SURE that it gets saved out as a CSV file, if you let the file format change in any way, it will be unusable by the game, and you will need to start again. For this reason, always back up any files before you edit them! The CSV files for the game all have the same format with a line that starts with '#'indicating that this is an object that should be loaded into the game. Any line without a starting '#' is effectively ignored, so can be used as a comment, to help you organize things.

Effects

Looking at the policies file, you will see a whole bunch of columns in there that load in various bits of data, but towards the end of the list of columns you will see the 'effects' for that policy. For clarity, the effects are denoted as any column to the right of the '#effects' column, and there can be as many there as you like. Some policies have a few effects, some have many, but each effect entry takes up one 'cell' and has the same format which is...



[target],[value1][operator1]([value2][operator2][values3])[operator3][value4],[inertia]



Now this may be confusing because [operator3][value4] is entirely OPTIONAL, and not often included. Lets look at an actual example,. which is the very first effect in that spreadsheet, and represents adult education subsidies first effect. it reads...



Education,0.04+(0.04*x),4



In this case the target of the effect is Education. because the effect is an output coming from a policy, the magic value 'x' gets substituted with the current value of the slider for AdultEducationSubsidies.The final value gives us an 'inertia' of 4 for this effect, meaning it averages out over the last 4 values of the slider (in other words it takes up to 4 turns for any slider changes to fully take effect on Education). So let's say that the AdultEducationSubsides policy has been consistently set to 0.5 for 4 turns. What would the value of the effect be?



Final Effect = 0.04 + (0.04 * 0.5) = 0.06



In other words, with the slider at 50%, we are saying we want a 6% boost to the value of our countries education, coming from the AdultEducationSubsidies policy. This is not the *whole* story, because as this is a government policy, that final value might be a bit lower if the policy is not fully implemented yet, plus it may be tweaked up or down slightly depending how competent your minister for public services is, but the principle remains the same.

,br> So what happens if we add in those optional extra values? lets look at that, along with another special ability we have, which is to reference another object from the game, for example another statistic entirely of 'Technology'.



Education,0.04+(0.04*x)*Technology,4



In this case, the equation is entirely the same, but we end up multiplying the bracketed result by the current level of technology. like everything in the game, we can assume that the value for Technology is between 0 and 1. This lets you scale the effectiveness of a policy on the level of another value, and it is used in various places especially Taxes, where the income from alcohol tax is dependent upon the current level of alcohol consumption, as well as the slider for alcohol tax itself. To be absolutely clear, I'll add some brackets to show you how this last bit is calculated:



Education,0.04+((0.04*x)*Technology),4



You don't have to just have + or * as your operators, you can also use - / and ^. ^ is 'power', and is used to generate a lot of the fancy curves that make some of the equations so interesting. I recommend playing around with the free 'graphcalc' program to see the exact effects you can achieve. Get it here.