Game Design, Programming and running a one-man games business…

Consequences in Democracy 4

As discussed in an earlier blog post, I think what democracy 4 needed was a way to bring home the true consequences of actions to the player. This has always been an area that was missing from the democracy 3 design. You can give the police machine-guns, you can legalize heroin, you can put in place all the apparatus of a police state, or a religious theocracy, and the only real consequences you see are some numbers going up and down.

Of course, the democracy games are known for being interesting complex simulations, not for whizz bang visuals or for feeling like ‘yuo are really there’. Thats a deliberate design decision, in that I would rather spend the time (and money) making a complex like graphics-lite sim than making a shallow, simple game with some 3D people doing limited things. Its a foolish indie developer indeed who thinks they can ever compete with triple-A studios in terms of graphics.

However, I think I can have some of that feeling of emotional resonance, just by using text, if the text is worded right, and if it fits within the style of the rest of the game. As a result, I’m introducing this new ‘media reports’ feature into the game. Here is an example:

These are new things that crop up on the next turn screen now and then. They are not called ‘events’ internally, so I’m avoiding that term here. An event is something like a change in your credit score or a factory closure, which has actual measurable consequences wwithin the simulation. They can be great news or disasters and can shift the simulation in a way you have to respond to. Here is an ‘event’:

By contrast, the media reports have no consequences whatsoever. They are simply putting into words the impact of decisions you have made (or in some cases not made, such as policies not implemented). The idea behind them is that they make you stop and think about the choices you have made, and have to accept thoughts like ‘Yeah, shes going to die because of my policy, but I guess thats acceptable’.

In the real world, this sort of stuff does happen. The media is generally rubbish at doing analysis and taking a broad view and educating the citizens on what is going on in an accurate way. I would be astonished if one in a hundred UK citizens have any idea what our GDP is, or even what our current unemployment rate is, or be sure if they knew if crime, and violent crime had gone up or down in the last 5 years, ditto pollution, or productivity.

Basically the media knows most people will not choose to take in data that way, so they pick ‘human interest’ stories that they think reflect broader trends. This is the classic case of the war reporter zooming in on a child’s teddy bear in some rubble. it tells us nothing about a war, apart from reminding us that children are affected too, but that can have a huge political impact.

So anyway, I now have a system for adding this to Democracy 4. Its basically a folder full of text files that contain data that describes the circumstances under which it triggers, and some text templates I can populate with citizens names (so they will be suitably local). Example:

[config]
Name = labourlaws
Text = "A special report tonight on the closing down of one of our oldest manufacturing 
businesses.
between her tears, CEO [FEMALEFULLNAME] tells us how heartbreaking it is for the family 
firm to close down.
'Its just impossible to run a business in this country with
the state of our [POLICYNAME]?' She told us. 'The unions are
running us into the ground. We cannot compete any more'."
Policy = "LabourLaws"
Type = MRT_POLICY_CONSEQUENCE
[conditions]
LabourLaws,1,0.65,1.0
GDP,1,0,0.6

This is a media report that triggers if labour laws is a policy currently implemented, and if its set somewhere between 65 and 100%. It also requires GDP to be below 60%. This is so that we don’t have a media event about a business closing when the economy is going super-well.

All thats required to add these is just some time and imagination, and some spell checking :D. Its just text, and there is no problem adding hundreds of them. The only reason the game is unlikely to actually ship with hundreds is that it means HUGE translation costs, because a proper professional translation is maybe $0.10 per word. So that media report is $6.70 to translate. This probably seems reasonable, but if we have 100 of these, it means $670 to translate them…

…into one language.

If we do the bare minimum for a strategy game (English, French, Italian, German, Spanish). Thats over $2,500. We definitely want to add Chinese, Russian, Portuguese to the game, and this pushes it close to $5,000 just for this feature. Its probably a tenth of the games text at most, and I anticipate a proper paid translation of the game to my target languages is going to cost $50-60,000 at this rate.

maybe I shouldn’t care about this, after all its a mostly text-based game, isn’t that an acceptable chunk of the games budget? Also I do know that a lot of indies (even big name successful ones) rely on fan-translations. I am tempted to consider this, because the professional costs are just crazy, and I’m not sure the quality is any different. My only concern is liability. I need to know the translation is correct, not some random angry political rant snuck into my game by someone else…. hmmm…

Oh BTW yes, we will eventually support this being trivially moddable too, so people can add their own :D.

Democracy 4: A better economic simulation

For a while now I have been putting off addressing a problem in the economic simulation for Democracy 4. Basically we have no monetary policy in the game, only fiscal policy, and for a long time, thats been pretty much fine and nobody has complained.

To put things simply, fiscal policy is when the government raises money through taxes and spends it on stuff. Monetary policy is where government messes around with how much actual cash exists in the economy. They are different ways to do things, and there are fierce arguments (what a surprise) about which works best in which situations.

For the lifetime of Democracy 3, its been a moot issue, because outside of Zimbabwe, nobody has made any major monetary policy decisions for a very long time. Inflation has not been a hot political topic for ages, and the terms ‘deflation’ and ‘stagflation‘ have not been in the news for probably forty years. Thus nobody objected to them not being in D3.

But 2020 is not 2013. Since the global financial crisis, a number of policy instruments have become more popular, and the discussion of monetary policy is suddenly very real. The two policies that have been active and also discussed are Quantitative Easing and helicopter money. Both are now in the game…

If I'm Holding Cash, Where Should It Be? - Osbon Capital Management

Quantitative easing is basically printing money, although policymakers pretend it isn’t, to avoid comparisons with the Wiemar republic or Zimbabwe, because it has a very bad reputation. QE is a special form of money printing where the central bank pushes a button and gives itself (for example) 100 billion dollars, then buys bonds and other relatively safe assets on the stock market worth 100 billion dollars. No ordinary people see any of this money, but it pushes up the stock market, resulting in higher business confidence, more wealth for stockholders, and with any luck, a more stable and maybe even booming economy!

Obviously this has side effects. This basically causes stealth inflation (possibly not visible because it is used to prevent deflation (prices falling) as a last resort. There is no way to avoid the fact that any form of money printing creates inflation. This makes people will cash deposits worse off (people with some savings) and can drive up prices. It also makes your currency weaker. However, if you have shares on the stock market, you are better off, and arguably it can cause an asset-bubble.

Anyway…

Helicopter money is similar. Its another form of money printing, but you basically hand the money in envelopes to every citizen. This has a similar effect in stabilizing the economy, but it makes the poorest better off (typically everyone gets the same payment), and is not skewed towards wealthy stockholders. The problem with helicopter money is you cannot reverse the process if it goes too far, whereas with QE, you can basically sell the bought assets, then destroy the imaginary money you bought them with, thus reducing the money supply, and stopping inflation going mad. FWIW I am lumping in ‘Peoples QE‘ with helicopter money to simplify things.

So…with those two very quick-and-dirty explanations out the way, how does this fit into Democracy 4?

18 Curious Facts You Didn't Know About Hyperinflation – Len Penzo ...

Both QE and Helicopter Money are ways to IMMEDIATELY boost GDP, and either make the rich/poor happy/sad depending which you pick, that do not cost anything at all. (You printed the cash remember!). Obviously there has to be a catch right?

Well yes… inflation and the eventual risk of hyperinflation (which is catastrophic and rarely recoverable). This means I have had to model both inflation and hyperinflation (I also added a border wall policy at the same time btw :D). These are now in the game, with a variety of inputs and effects and I’m still fiddling with getting the balance right which is HUGELY difficult. (The true economic theories here are amazingly complex and often contradictory so you can imagine what a mess it can all be…).

I have found (so far) that the best way to model the negative effects of inflation is through prices on food and oil. Most countries do at least some importing of oil and food, and this is a way to reflect the broader globalization trend and the impact of your currency weakening against the country from which you buy stuff. (For the US this would be china). To put things bluntly, if Donald Trump gave everybody in the US an extra (printed) hundred thousand USD, then the USD / Yuan exchange rate *should* change, making goods imported from china more expensive.

NONE OF THIS IS 100% CORRECT OR ACCURATE BUT YOU GET THE IDEA.

I am sure there will be very many long, multi-page debates on my forums once the game goes into pre-alpha sales and people with economics degrees, MSCs and PHDs p[lay the game and argue if certain effects make sense or are too strong/weak. This is tough stuff to model in a video game.

And yet… it has to be in Democracy 4. Look at any online politics forum and you will find people (especially on the left of the political spectrum) arguing that the government can print money as an alternative to austerity, and people on the right saying thats nonsense and we have to live within our means. It HAS to be in the game, and I bet loads of people will argue that I’ve done it wrong.

I guess thats game design for you :D

Healthcare cost and benefits in democracy 4 (kind of)

I read the infamous article yesterday that a lot of UK people are screaming and hurling abuse at over twitter. Basically a commentator wrote about the tradeoffs between continuing with a lock down in the UK due to COVID19, or letting people go back to work, and the relative impact on health in the short and long term.

99% of people hurling abuse did not read the article, and if they did, they did not understand it.

Here is a shorter & simpler version of the argument:

  • The UK lock-down will prevent X deaths from people with an average life expectancy of Y and a general state of health of Z.
  • The economic cost of the lock down will result in W extra deaths from suicide/obesity/other factors and K extra deaths due to the reduced funding for healthcare over P years as the economic cost of the lock-down bailout package is repaid
  • Therefore it MIGHT be the case that the cure is worse than the disease and we should stop it, allowing X people to die.

Now pretty obviously, whether or not the argument is right depends MASSIVELY on the values for X,Y,Z,W,K and P. These figures are all highly speculative, and open to interpretation and re-evaluation, and we cannot be sure of any of them…but thats fine, it doesn’t change the core of the argument, an argument which we already have enshrined in UK government in an organisation called NICE.

Britain's National Health Service Continues to Struggle | Neil ...

NICE is the national institute for health and care excellence, and its job is basically to look at drugs/treatments the NHS might like, and work out if they make economic sense for the NHS to use them. Given non-infinite money, and cash spent on treatment Y cannot be sued on treatment Z, so obviously NICE has to do a balancing act to ensure that the most lives are save for a given health budget.

Sometimes, people get upset about NICE refusing drugs, and thats understandable when it affects you, but I cannot help but see what NICE does as logical, and essential. Budgets are never infinite, choices MUST be made.

In Democracy 4, the player makes these decision all the time. If you set the state healthcare (or alternative policy such as vouchers) budget to maximum, then health will go up. The link may not be linear, but it will definitely go up. However, the budget for this needs paying for, which if you are unlucky, can mean a debt crisis, or cutbacks in other areas leading to recession, thus unemployment, obesity, poverty…all things that will…reduce the standard of health…

This feedback mechanism, where in some cases raising X to boost Y, also reduces A, which causes B which then paradoxically REDUCES y… is a common theme both in the game, and in real world economics. Basically…real-world-shit is complicated! Its also something that is intuitively hard for us to grasp. As primitive mammals we didn’t need to think 6 moves ahead. We barely needed to think 2 moves ahead, which is why Democracy 3/4 is an interesting challenge and feels interesting to play. Its also why most people suck at chess, and go. We are not good at this.

Sadly this is disastrous for public policy. NICE *HAS* to exist, despite peoples anger, and the calculation as to the economic cost of a healthcare measure OBVIOUSLY has to happen. Modern political discourse (shit-flinging on twitter about comparing this to eugenics) means that it can never be openly debated by grown up politicians. We force them to lie…

So a politician may say we will do WHATEVER IT TAKES to get the virus under control. This is a lie. You also hear people say “If the only effect of this $50 million policy is that it saves one persons life…its been worth it.” This is also a lie. But modern sound-byte culture means the truth can never be discussed.

I think I need to work on reflecting this a lot more in Democracy 4. Maybe we need event to pop up and say more media-style things like this:

“Lucy Matthews, age 24, has died due to breathing difficulties partly resulting from the high level of pollution on our streets. She leaves behind a daughter Emily, age 4. Her death could have been avoided if the country had introduced emission limits on cars.”

That might be a bit harrowing, or distressing, or maybe a bit…manipulative, but I think it would accurately reflect the dilemma for real politicians who have to balance the knowledge that they are absolutely choosing to let some people die, with every decision they make. Thats just inevitably part of the job.

Should I add that sort of thing?

CO2 Policies in Democracy 4

I’m starting to fine tune some of the values in the simulation so that they reflect a better approximation of real world choices in 2020, as well as keeping the game fun to play, and taking into account some new policy options that we have introduced. A runthrough of all the current options in my policies list that affect CO2 emissions DIRECTLY gives me this:

This is in NO WAY the extent of the CO2 sim, because its also affected indirectly. For example we now model veganism/vegetarianism and its impact on emissions, and you can indirectly affect them by policies that encourage less meat consumption, which happens (again indirectly)( through tougher food standards and food labeling and certain dilemmas and events.
Also a lot of emissions come from Cars and Planes, and we have taxes and other systems such as bus and train subsidies that allow you to affect the take-up of those forms of transport, as well as the conversion from fossil fuel vehicles to electric..

HOWEVER! That does not mean I should just throw my hands up in despair and go ‘its too complex!’. I need to keep checking values to ensure they make at least some rational sense right? :D So what do I need to change here…

Obviously the carbon tax is WAY too good. It has negative impacts too, in that it damages the economy and upsets capitalists at the extremes, but not nearly enough for a policy that brings in so much cash. At the extreme end it brings in more than twice as much as inheritance tax at its extremes. Something I REALLY should model is one of the paradoxes of taxes like these…

A carbon tax is an externality tax. Its basically punishing people for doing something bad thats not otherwise reflected in the market. If such taxes do their job… people do less of that thing. if people do less of that thing… the tax REVENUE goes DOWN. In other words, as we put the tax up, the revenue should rise and then plateau and then fall…

Luckily thats easy! because we support all sorts of equation types in the game, Currently the game has a multiplier on the income from the carbon tax like so:

CO2Emissions,0.5+(1.0*x)

Which is rubbish, because if we reduce emissions to zero, the tax should clearly be zero too. We need to change that to be a straight linear multiplier instead. Also I think we need some extra negatives for that tax. It effectively acts as an energy tax (annoys everyone) a car tax (annoys motorists…scaled by the electric car transition…) and a flight tax (annoys wealthy and reduces tourism).

Looking at the other end of things, Carbon Capture & Storage is ludicrously ineffective yet expensive. Is there a reason for this? Well it is VERY fast acting, unlike many of the others (which makes sense, as it ACTIVELY takes carbon out of the atmosphere, instead of hoping one day people buy less polluting cars…), but even so… I may have to bump up its usefulness and tweak the cost down a bit…

Other noticeable ones are new car subsidies having minuscule effect and huge cost. It reduces our emission by 4% at best. Cars contribution to emissions is roughly 12% of the total (data here). Assuming that the new car subsidies at their peak involve maybe 50% of cars being replaced, that should affect 6% of emissions…so new cars being more efficient really is a drop in ocean. Yikes.

Meanwhile in the real world about 50% of CO2 is from the energy sector, yet my renewable energy subsidies only reduce emissions at maximum by 15%, whereas pollution controls are 19%. That seems backwards at best, but maybe pollution controls needs a major reduction in effectiveness. After all, its just ‘controls’ without specifying more, so that might limit emissions, but certainly not stop them entirely. Its likely focused on particulates and even water/ground pollution too…

Also mandatory micro-generation looks a little generous. As effective as centralized subsidies? I doubt it. Even if EVERYONE starts to retrofit houses with solar panels, that still doesn’t cover winter/night-time generation, and in terms of bang-for-your bucks, Hydro and Wind (esp offshore huge farms) are likely to be more cost effective.

Also I reckon eco home regulations is under-effective. It will take a LONG time to take effect, but as someone who RIGHT NOW is getting new windows fitted (see below my thermal camera image showing the new (Blue) and old (yellow!) and can feel the difference… I think that this should be a more effective overall and per-dollar policy.

warmerhouse.jpg

Lots more to tweak!

I’ve been using GPUPerfStudio

Have you heard of it? I had not either, but its a thing, and its a free thing, and its pretty cool. Its a similar tool to nvidia nsight, which I used to love, until they basically broke it entirely for older copies of visual studio. I would love to live in this delusional world where people make dev tools and think that every developer is sat there, staring at their code thinking ‘it would be great to take a few days off to install a new version of this IDE, with virtually no improvements, but lots of changes and incompatibilities. Plus I am tired of having money, take my dollars…”

FWIW I develop Democracy 4 with Visual Studio professional 2013. Its great. It works, and I don’t see any reason to ever upgrade. I think the previous version I had was one I sued for about eight years, so theoretically I might consider upgrading in 2021… but why would I?

The question should always be ‘why should I upgrade?’ not ‘why should I stay on an old version. an IDE is just a tool. My office chair is a tool, and I think thats about 8-9 years old now. I expect it to last another 10 years minimum. Stick with stuff that works well.

Anyway, lets talk about GPUPerfStudio!

This is a free tool you can get here. Its a way of debugging the way you draw stuff in your game, and it seems to support directx, opengl and vulcan whatever that is :D Its not flawless, but its pretty easy to setup and use, which is one of the most important criteria for devs like me who code everything, and thus the debugging of rendering issues is only a tiny part of my job… With that in mind here is a tutorial on how to use GPUPerfstudio with your game.

It seems all you do is download and unzip the thing into a folder, and launch the executable (GPUPerfClient.exe). BTW whats weird about this tool is that to actually run a program and debug it, you click this top left icon that looks like a monitor… whats wrong with a ‘play’ icon? You then browse to the path of your .exe file (debug or release builds are both fine, and click on ‘next’, then ‘connect’.

This then launches some command line window which you can ignore, and your actual app. It then pops up a dialog box for you to confirm what graphics API you are using, and wahey! you can run and use your app as normal until you get to a screen you want to analyze. When you are there, you click back to the GPUPerfStudio window and hit the ‘pause’ button. NOTHING happens! Until you click back to give your game window focus. It then takes a snapshot, and you are in business, and its time to hit that (now highlighted ) frame debugger button. This then generates some cool stuff:

You need to click around on various stuff to get the layout the way you like, but to be simplistic about it, on the left hand side in a column of every draw call made to render this scene. To the right of that is a diagram showing the various stages in preparing and rendering each draw call, and to the right of that is a bunch of render targets and textures you can zoom in on by clicking on them. I’ve selected RT[0] which is essentially the screen, and selected one of the later draw calls. I’m not using fancy shaders so I don’t care about the RHS windows, I just want to see what is rendered when.

With that in mind, I can select an earlier draw call on the LHS…

Tada! Thats draw call #6 where a bunch of icons get drawn to the screen. I can click on the source texture for all that and see how much of it using and what the source looks like, and if I want more detail on the actual draw call data I can click on VAO for the vertex stuff, and actually inspect the contents of the vertex buffer I’m using…

BTW the pink highlights on the screen texture are showing you the verts you draw in the current call, which is clearer if I look at a later draw call:

You can see there that I just drew all those blue rectangles on the left of the screen (with a single draw call, for max speed).
Also check out this cool screen, the CPU API Trace, which seems to show you a timeline of all your draw calls and how long each thing took. If you suspect one draw call takes way too long, this may explain why, or at least confirm it…

BTW top tip: ctrl+mouse wheel on the top progress bar does fine-tuning of zooming in and out to see each item…

Ultimately, tools like this are a great way of working out when you are doing *really dumb stuff*. I found out yesterday that despite writing super cool code to batch drawing all of the voter strips in 3 or 4 draw calls, I was then rendering each one of them individually in bits again right afterwards due to a bug. I would NEVER notice this any other way, because obviously you cant tell when items have been drawn twice perfectly on top of each other, but it was killing my frame rate.

Anyway, this software is cool, interesting, seems to work, and its free. What else can anybody want?