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

Democracy 4 DLC now available to add to wishlist!

All the cool kids these days are trying to get people to add their upcoming games to their wishlist. Its literally the coolest game in town. You wouldn’t want to not be cool right?

In all seriousness, the reason indie devs do all that is because its widely believed that steams algorithm internally keeps track of what new games are ‘hot’ by how many people are following them or adding them to their wishlists, and this helps to determine how much visibility those games get at launch. I suspect the effect is much reduced with DLC because it sells to a smaller audience anyway, and perhaps steam prioritizes new IP over expansions and DLC anyway. We have no way of knowing.

But you DO get notified by steam when a pre-release game you wishlist has been released, so if nothing else, its just a handy reminder to people that they were interested in X a while back, and its out now…

So here is the store page for the new expansion so you can do this right now:

This DLC has actually been really hard to make, and in many ways was tons harder than doing the voting systems expansion. I can imagine many people might think it is the other way around, given that the voting systems DLC added some new core functionality to the base game whereas this expansion ‘is just a few new countries’. There are two reasons why this was not the case…

Firstly its SIX new countries, which was a bit silly of me. It should have been 4 max. I had totally blanked out that part of my memory where we did all the research and balancing for all the countries in the base game, and also forgotten that many of the base game countries had been modelled before, so we already had a lot of the data. Secondly, I massively forgot how much research is needed to do a proper job of just ONE country. The game has all of its usual policies, plus a bunch of new ones, plus all the content that used to be in 3 expansion packs for D3, plus some new stuff that is specific to the previous expansion pack on voting systems.

Because no economic/political model can EVER really model the reality of a single country in all possible states, let alone model 10, and certainly not 16, there are bound to be a bunch of weird anomalies and inaccuracies in any new countries that get added to the game. Perhaps its REALLY easy if you play Poland as a super-religious libertarian who loves carbon taxes? Maybe Greece is unwinnable for people who want to play Environmentalist-Capitalists if you start with a global economic boom? The problem is…there are too many permutations to test.

I did actually code some AI that plays the game automatically, but the trouble is in extracting any useful data from it. The game does a lot of processing, and even if I get each turn down to under a second (I can get it below 2 seconds already, and thats without multithreading), that means a 5 year term with 5 terms is around 2 minutes of AI-modelling. This might sound quick, but if I can only do 30 playthroughs an hour (720 a day) then thats nowhere close to the number of playthroughs needed to accurately build up a statistical model of imbalance…

I’m not saying that I will not revisit that experiment later…just that the sheer number of combinations of decision in the game mean you really need several million games to be played and analyzed to detect any issues. In other words several years of dedicated processing…

Anyway… I do have a bunch of time set aside between now and release which is basically just me playing each country a LOT, and tweaking all the numbers so they are playable. Democracy 4 is more of a sandbox than a conventional game, so I’m not aiming to get every permutation perfectly balanced anyway. Thats an impossible dream. I do have to ensure nothing crashes or goes super weird in a normal playthrough on each of these six countries though…

That brings me to the price. I’ve set it at $9.99. I did a lot of agonizing about this, and talked to some fellow devs a lot about pricing. Both urged me to price it higher than this. One urged me to double that. Its a really difficult thing to get right, and a decision that I find really interesting.

We all know that the marginal cost of each copy is zero, so in a way, it doesn’t matter if I charge $0.01 or $100, its just a matter of picking the number that maximizes total revenue. This depends a lot on who I think the target market is, what they can afford, and how much value I think the DLC represents… All very difficult things to be exact on. Eventually I figured that given that the base game is $26.99 and has 10 countries….6 countries for $9.99 is a good deal. Its also worth considering that anybody even considering buying some DLC clearly already likes the base game, and has played it enough that they want some extra content. That implies that their play hours are high enough that their cost-per-hour for Democracy 4 is low, and thus are willing to consider any new content favorably with regards to expected play time.

I see this a lot in my daily multiplayer Battlefield V games with friends. I am a serious Battlefield V addict. I have over 1,200 hours in BFV and thousand more in the earlier games. My cost per hour for BFV is about £0.05. Thats insane for something I enjoy that much. Its like going to see a new Hollywood movie and paying £0.15 for it. Madness.

The irony is, that as your perceived playtime cost per hour falls, the value proposition of new content shoots up. If they added one new map to Battlefield V, thats maybe a 5% playtime bonus for me, or 60 hours of entertainment. Even if I will only pay £0.50 an hour, that map should be a good deal to me for £30. A 3-map pack should be £99.

Obviously not all Battlefield players are so obsessed, but with DLC *you are selling to the hardcore*, so the value proposition is way better than it seems to the casual player. This is why it makes sense in F2P games to have some really expensive stuff. There are definitely people who will not only buy a lot of it, but they will consider it a good deal. Thats assuming you aren’t tricking/exploiting people with dark patterns and other horrible business practices obviously…

So…Yup, this DLC will be $9.99 and I think its actually a pretty good deal for people who have played at least all of the maps in the base game once. Its also probably an attractive proposition for anybody who is actually living in one of those six new countries (Ireland, Poland, Switzerland, Turkey, Brazil and Greece). I guess I’ll find out if people agree with me on that in about a months time :D

Officially announcing the next Democracy 4 expansion

In the old days, I used to send press releases to news websites etc…and maybe I’ll still do that once I’m testing this and have some screenshots to show. Not that screenshots of Democracy 4 are exactly a visual feast that makes people’s jaws drop as they gasp at the photorealism…but there ya go.

There is to be another expansion pack for my latest game Democracy 4. It will be a straight data-only expansion, which will add six new countries to the game. Those countries are:

  • Greece
  • Ireland
  • Poland
  • Turkey
  • Switzerland
  • Brazil

I think this represents a pretty good mixture. Greece and Ireland are fairly similar to some of the other countries in the game, but we have a fair bunch of players in those countries and people like to play their home country. Plus Ireland is a bit interesting because it is basically an economic disaster due to geography, which is able to work mostly because it has ludicrously good rates for companies to base their HQ there for tax purposes. Its basically the largest respectable country that serves as a tax haven.

Brazil is obviously interesting because of its size, and its rainforest, and its status as a relatively poor country with relation to the existing game countries. Switzerland has its own unique properties, such as being super mountainous, fanatically neutral in diplomatic terms, and its hyper-democratized system of voting. Its also famous for nuclear shelters everywhere and a high level of gun ownership, but low gun crime.

Turkey is a fascinating country, as it sits between two continents and has influences from both. There are obviously some unusual positions regarding democracy and religion there, that are not really explored in the existing countries.

Poland is also interesting, sitting between western Europe and Russia, one of the last green countries in terms of energy use, and a country very nervous (with good reason) about its borders.

Its going to be hard to really capture the flavor of all these different countries, and I expect at least one major post-release revision as I collate feedback from players. It should be interesting though, and hopefully widen the appeal of the game a bit.

I don’t have a final release date yet, or pricing, but here is the status of the current todo list:

  • Initial statistics for each country 100% DONE
  • Country descriptions 100% DONE
  • Map icon and flag icons 100% DONE
  • Initial policy positions: 55% DONE
  • Extra dilemmas TODO
  • Extra Events TODO
  • Extra Situations TODO
  • Country specific simulation overrides TODO
  • Translation of all text into all languages TODO
  • Testing TODO

…so still lots to do…

In unrelated news, I got covid, and omg it was horrible. I basically suffered badly for a week, but am feeling much better. I have also been avoiding social media, which I increasingly view as a mistake, a dumpster fire which anybody who values their sanity should run screaming from. I might use it in future only as a way of linking to my blog.

In even less related news, I finally moved positech’s entire online presence away from a dedicated physical server (a hangover from days long gone when I had a lot of direct traffic, and hosted forums on the server, as well as a site dedicated to indiegames), and to a simple VPS. Like any hosting company, I was recommended a server package that was stupidly overspecced for my needs, but politely declined that. As a result I managed to cut my hosting bill by more than 50% which is very welcome.

There is still the ongoing saga of the solar farm BTW. Its not abandoned, we are still hoping to get it done, but its going to be at least another 3 months of bureaucracy (don’t get me started on this…) plus a likely extra year of waiting for a grid connection even if we get it. If there is ever anything to report, I’ll blog about it…

The impossible task of country simulation in a video game

As you may know, I make the ‘Democracy’ series of video games. They are pretty serious, pretty complex, fairly in-depth simulation games where you run a real world country. At one point I experimented with fictional countries, but it turns out everyone hates that, they want to be the president of their own country, and show they can do a better job than the current leader. Fair enough.

The only problem with this is it means that I need to simulate real world countries accurately enough that people living in them think I have made a proper effort to do so. This is staggeringly difficult to do with a single (albeit flexible and complex) model of politics and economics. What makes it way more difficult, is that it has to be politically, economically and temporally flexible as well.

Allow me to explain.

Imagine you spend months reading statistics and articles and set all of the values of all of the policies for a single country in Democracy 4, for example the UK, and you get all the various values in the model as close as possible to reality. Unemployment looks about right, GDP looks about right, Wages look about right…and on through literally hundreds of different measures. This is VERY hard to do, and a lot of values need to be flexible in interpretation. For example what level is income tax in the UK? Obviously it depends on how much you earn and many other factors…

…but then the very same model has to work if you change some of those variables. Maybe a player decides to abolish the national health service. Or double the minimum wage. Or scrap nuclear weapons, or introduce a new tax on luxury goods. The same model has to cope in all these circumstances, and it has to be credible over time. The national debt is a certain level NOW, and we know roughly what impact it has, but how do we possibly model what will happen in the future? How do we model the impact of increased automation on unemployment, productivity, wages, and international trade? Ideally a video game is made to be playable for many years. Will Democracy 4 make sense in 2025? in 2030? When we all have self driving cars and teslabots, what do the economics look like?

This is all hellishly hard, but one of the particular aspects of what makes it hard is a thing I’m encountering today. I am taking the first gentle steps into looking at an expansion pack that would add some extra countries to the game, and trying to be more organized, and sensible about adding them so that the model is consistent and makes sense. Its way harder than it sounds.

Take for example: BRAZIL. An exciting country to add to the game, as its so different to the others. I am looking forward to adding a special situation for the amazon rainforest, with all its potential economic boom, tourism value and also massive environmental controversy regarding deforestation. Lots of cool stuff here for a potential Democracy 4 player! But lets zoom in on a single statistic:

What is the correct value for the military spending slider for Brazil?

This is not as simple as it sounds. Its pretty easy to google the military budget of Brazil, in USD terms. Thats 25.1 billion USD with a source here: https://worldpopulationreview.com/country-rankings/defense-spending-by-country. It would be easy thus to look at the UK spending (55Bn USD) and do a relative comparison to where we position the UK slider (42%), and use that calculation to set the Brazil military spending at 19%. However, doing a straight USD comparison is fraught with inaccuracies. I cant even find out if that USD number is actual real USD (ie: the value of the Brazilian reals converted at the current exchange rate to USD) or ‘purchase-power-parity‘, which is a different (and generally better) measure altogether. To put it simple: You can probably pay a Brazilian soldier less in USD equivalent than you would pay a US marine. If a Brazilian soldier can buy a house and clothes and food way cheaper than the USD-equivalent spent in a US town, then in effect your military budget is going further…

One way to adjust for this is to take a second measure, using totally different comparisons. So for example, you can also look at the percentage of GDP that is spent on the military, and use that as a baseline. In this case Brazil spends 1.4% of GDP on defense, compared to 2.2% in the UK. Making that adjustment means that the Brazil military slider turns out to be 28% instead of 19%.

To start with, before I go back and play balance and adjust everything (which will take weeks) I’m setting the initial value for those military sliders to be the average of these two measures, so comparing military spending as % of GDP, then absolute value in USD and then averaging the two slider positions. This gives me the following values:

Greece 29%

Ireland 3%

Poland 26%

Switzerland 9%

Turkey 35%

Brazil 23%

At first look, these seem reasonable. Switzerland is famous for its neutrality. Poland is naturally (given its history) more jittery. Ireland… well I cant remember having ever heard of the Irish military at all. Turkey, given its location, probably thinks it can justify quite a strong military.

You might think this is a paper-thin approximation. You are right. I’m sure multiple people have phds in studying the relative military spending of countries around the world. Sadly, I’m just a video game designer and do not have that time, but I do what I can to get sensible numbers where possible, and have to keep in mind that the first priority of any game is to be fun, not accurate.

Still a lot of stats juggling to go!

VOTING SYSTEMS DLC out now!

So.. at last I finally did it, and managed to get the voting systems DLC released yesterday for Democracy 4. If you want to watch a long video with me rambling about voting systems, boy do I have the video for you:

Also if you fancy grabbing the DLC, you can get it here, or just use the fancy humble widget to buy it direct from me. bwahaha!

Anatomy of a rare, and weird heisenbug in Democracy 4

Heisenbugs are bugs in code which seem to go away, or change when you look at them in a debugger. They are the worst possible bugs, because they actively resist being found, or even observed by the coder responsible. Any kind of bug that can be reproduced on a developer’s machine, in their development environment can easily be analyzed, stepped through and reasoned with. But heisenbugs are a nightmare. I just (I think) fixed one, and certainly fixed A bug, even if not this one. I thought you might enjoy the process…

First some background. Democracy 4 is the fourth and latest in my series of political strategy games. They are text and diagram heavy, with a properly unique user interface, in 2D, and all of the code is custom, with a custom engine originally coded by me, with a unicode text implementation and vector rendering system coded by jeff from stargazy studios. This means all of the UI elements you take for granted in middleware you use, were custom coded by us. In this case, the bug is my fault, in code written by me. Here is a screenshot:

Then key thing that matters there is the text block under ‘food stamps. This is a policy screen in the game, and that text is the description. Depending on the length of the description (partly influenced by the language you play in), and the screen resolution, it might be that all the text fits in the available space, or it does not. That means sometimes there is a scrollbar to the right of that text, and sometimes its not there. As you would imagine, the scrollbar works just like any windows scrollbar. That means it responds to mousewheels, and also clicks, on the top and bottom buttons (very small) for example.

…anyway…

VERY rarely. And ONLY when I was playing the game outside the debugger, and only in very arcane sets of circumstances that seemed totally utterly random… screens like this (but not just this one) would occasionally not let me click on some elements in the interface. They would not respond at all… BUT… that block of text would scroll upwards, like it was being scrolled through. It was like completely unrelated events (clicking somewhere else) activated a scroll function on a user element I was nowhere near.

This was of course, absolutely infuriating, because it was REALLY rare. And the times I tried crazily to reproduce it in the debugbuild, or even in the release build, but launched from Visual C++, it would not happen. And there were NO reliable steps to reproduce. In fact, even quitting a screen when it DID happen, and then returning to that screen would make it go away.

What the hell?

After a LOT of time, I realized two interesting things. Firstly, when it happened, the game DID make the click sound associated with a mouse click (so the game IS realizing I clicked somewhere) and the scrolling only happened with text inside a specific UI element called a GUI_TextContainer. Although I did not realize it at the time, it was also the case that it ONLY happened where that text container did NOT have a visible scroll bar.

The clue to the bug lies in a closeup of the scrollbars used:

Like all such bars, there is a clickable ‘scrollup’ button, a draggable bar, with above/below page up/down regions, and a clickable down scroll button.

When I create a new GUI_TextContainer, I created a new GUI_ScrollingWindow, which is a container with all of those elements in side. Like any child element, I added it to the Text Container object with AddChild() to ensure it responds correctly and is processed blah blah. Thjn, later when the textwindow is initialized with its position, and the relevant translated text, I do a lot of calculating to work out if that text *is* going to fit in the available space. If not, I set the scrollbar in the correct position on the right, and make a note that the text does not fit (sets BFits to false). Then later, when drawing this UI element, I could skip out a lot of nonsense I don’t need if the text fits, and render it simply as a word-wrapped string. If It does NOT fit, I then drew the scrollbar, and the text in a different way, cropping the text render to the space given the scroll position and so on, blah blah.

All of this sounds reasonable. But it was a big mistake.

I was correctly NOT drawing the scrollbar if it was not needed (why bother! the text fits!) but I had pre-emptively added it as a child of the window anyway. Worse still, I had never initialized the position of the scrollbar and its sub-components AT ALL. This means that in debug / release-from-the-development-environment, all of the relevant variables in that window were getting set to zero, But in a live ‘customer’ environment, the initial positions of those subcomponents could be ANYTHING.

So what could happen, really rarely, is that the ‘scroll up’ or ‘page up’ parts of the scrollbar, might have coordinates like -32054,-5128,27140,41543. In this case, those clickable elements filled the whole screen… but were INVISIBLE. Thus, I have a huge UI mess-up, but I cannot see it, because my ‘quick and easy bath’ that checked BFits, doesn’t draw it.

So very rarely, I create a screen with an invisible scroll up button that fills the entire screen, and happily responds to every click with a scroll-up command. It even nicely plays the button click sound. Luckily, these buttons do not handle keys, so the escape key still quits that whole screen, and the next time it gets created, I’m probably lucky and the invisible bar has moved somewhere harmless.

I’ve changed the code now, to be efficient so that I do not even THINK about creating this scrollbar until I need it, and otherwise its NULL. I also make sure to safely delete it before creating it, in case somehow I go mad and initialize the same text container twice with different blocks of text. I could also have fixed it by initializing the position of a scrollbar safely to 0,0,0,0, but I also like the neatness of ensuring I don’t have a pointless orphan UI element at any point.

This was a classic dumb error. I added an element when I shouldn’t have, and its member variables were not safe. My own dumb slackness. I document it clearly to illustrate how the weird unrelatedness of a bug ‘clicking down here, scrolls text up there. sometimes. only in German, on a Wednesday etc…’ eventually makes total sense.

Hundreds of thousands of people have played probably over a million hours of the game, with this bug in it. No code is bug free, but if you do things right, the ones left in are pretty arcane.