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

Democracy 4 Updated to build 1.23

Lots of changes, here is the complete list:

[1.23]
1) Fixed incorrect or broken effects & costs for EV transition, Plant Based Diets, Judicial Independence, Nuclear Fission.
2) Changed scaling for simulation values so in ‘value’ mode they show difference from the midpoint.
3) Added South Korea as a playable country!
4) Added support for country-specific minister art groups.
5) Improvements to how sensibly the icons are positioned on the main UI.
6) UK now has Tobacco Awareness Campaign enabled to reflect the warnings on packets.
7) Reforestation policy is now slower to implement, and slower to impact the environment.
8) Synthetic meat research now boosts plant based diets, and pleases instead of upsetting environmentalists.
9) Improved election analysis screen so it uses tiny people symbols rather than an ambiguous ‘dot’.
10) Slightly boosted impact of voter ‘complacency’ over time for when they start to take the governments policies for granted.
11) Fixed a bug that artificially limited how complacent voter groups could be at a lower level than it should.
12) Party analysis screen now also uses people icons instead of meaningless dots.
13) Possible fix for rare bug where alt-tabbing to and from the game can lead to ‘phantom clicks’ on items like the next turn button.
14) Fixed bug where the background fade effect disappeared when canceling an industry privatization.

And todays blog video!

How I address a tricky, user-interface layout / physics code challenge

Democracy 4 has one aspect of its GUI that still screams IMPERFECT at me, and needs fixing, but its at least 10x harder than it sounds. Its the sizing, and positioning of the icons on the main UI:

This looks like just a bunch of different sized circles on a screen. How is that tricky? Let me count the ways:

  • The icons have to be in specific zones, which are not rectangles, but could be any polygon. These change size and shape over time
  • There has to be consistency of size. A radius 10px icon in zone A has to represent the same value as a radius 10 icon in zone D
  • We could have ANY screen resolution or aspect ratio.
  • There could be ANY number of icons.
  • There is finite time, on perhaps a CPU-limited laptop to do all the calculations.
  • The icons cannot touch the center icon, or each other, or the zone boundaries.

Now it turns out…coding that is a real pain in the neck. The system that you *think* will solve it all, is to have each zone boundary and icon project a sort of repulsive force on to all the others, then step through an iterative system of applying forces and moving stuff around until an equilibrium is reached. Well kinda… but no. Look again:

Those icons with black arrows are the pain. They are kind of stuck next to corners and other icons. its the shortest distance between two icons ANYWHERE on the screen that limits the size of all of the others.

My initial solution to fix this, DID make it better, but its not good enough. What was it? Basically I do the physics-repulsing-forces thing as usual, then I ‘jiggle’ each icon in turn, randomly kicking it a few pixels in different directions, then checking to see if the overall separation of the icons got better or worse with each jiggle. I keep the jiggles that improved the situation.

Actually I improved that algorithm by first finding the icon that was the closest to the others and giving that 32 initial jiggles. This is the result, (less force is better, it means the separation is better)

Pre Jiggle. Total force:[0.39] Strongest: [0.14]
Post Jiggle. Total force:[0.03] Strongest: [0.03]
Pre Jiggle. Total force:[1.31] Strongest: [0.45]
Post Jiggle. Total force:[0.23] Strongest: [0.23]
Pre Jiggle. Total force:[1.67] Strongest: [0.32]
Post Jiggle. Total force:[0.19] Strongest: [0.19]
Pre Jiggle. Total force:[1.23] Strongest: [1.19]
Post Jiggle. Total force:[0.06] Strongest: [0.06]
Pre Jiggle. Total force:[1.14] Strongest: [0.13]
Post Jiggle. Total force:[0.17] Strongest: [0.17]
Pre Jiggle. Total force:[2.17] Strongest: [0.68]
Post Jiggle. Total force:[0.31] Strongest: [0.31]
Pre Jiggle. Total force:[0.53] Strongest: [0.40]
Post Jiggle. Total force:[0.26] Strongest: [0.26]

Which is what brings me to the current state of affairs. However, this is just one of those tasks’ that humans excel at and machines suck at. I bet you can see locations where the icons should be shuffled really easily.

Something I intend to experiment with is a more focused approach to the jiggling! I can tell now which icons (in this case two of them) seem ‘trapped’ and are causing the biggest problems, so rather than just going through all of the point containers and jiggling everything, I should now focus my attention just on the containers with the problem

Maybe I can even focus my attention just on the half-dozen icons per container that are closest to the problematic ones, but that may not actually be the solution. Check out this section in more detail:

This row of icons has basically got trapped. Moving any of them upwards and to the right is going to be tricky, unless the icons *above* them can get out of the way. The trouble is, we need some super-clever algorithm that could move an icon above them higher (thus making *that* icon worse off… so that later we can jiggle these others… and everyone will be better off.

It might be that the initial force algortihmn is too linear. A linear force would not concentrate midns enough of the dire plight of the icon in the bottom left. If the squeeze here was not seen as just *slightly* worse than the squeeze on others, but exponentailly worse… that might fix it.

…and also this icon is receiving some strong forces from its location in the corner., Unlike other icons, boundaries cannot move, so maybe we should prioritize their plight more? Surely no coincidence that both worst-case icons are in corners?

This all strikes me as something that would be easy if I’d learned more physics and maths, but hey… working it out alone from basic principles is kinda fun. I have plenty of ideas to tweak my algorithm.

Why Positech Games has no discord server

Yes its true. Prepare to have your minds explode. Positech Games is not on discord. We have no discord server/channel. None. There may be people discussing our games on discord in unofficial servers, we do not no, or to be honest…care. Why?

Its because there are just TOO MANY different places on social media that an indie game developer needs to keep track of. When an indie dev has 8 employees and one of them is the dedicated marketing/social media/PR person, perhaps, maybe, just perhaps, there is some value in having a discord server where that person can be constantly replying to people and talking about the game… but even then I seriously doubt the ROI on that.

Right now, our social media and online presence consists of the following list:

  • My personal (cliffski) twitter account
  • reddits for Democracy3 and 4, also some older games which we never check now.
  • facebook pages for virtually every major game we made. (Only Democracy really checked now)
  • Our amazing forums, hosted by discourse, but paid for on a business subscription by us.
  • This blog
  • The widely publicized email addresses for me, which means a LOT of spam.
  • A keymailer account, that we barely check now (none of the key-requesters actually cover the game)
  • The steam forums
  • Steam curator connect
  • My youtube channel (effectively positech games youtube channel)

Thats ENOUGH. In fact thats WAY too much. Some of that gets constant attention (my forums, youtube, twitter), some less so (facebook, reddit, steam stuff), some is all but abandoned (keymailer, curator connect).

My feeling is that if people really want to find you, then they will. I am a member of a tesla forum, but also follow a spacex reddit. Why the difference? well all the tesla chat seems to be on forums, all the spacex chat seems to be on reddit. I am not (and I suspect few people are) so massively invested in a single social media platform that I only communicate with people that one way.

To put this another way, I suspect if we just closed down our democracy3 and democracy 4 reddits, and the facebook pages, a fair chunk of those users would eventually find their way to our forums or this blog, or my twitter account. I decide NOT to do that, because I really do not want to lose *any* existing followers/users, but the idea of possibly adding another split in the ‘fanbase’ to yet another format is not appealing.

When you think about it, I could also be trying to promote my games through instagram and tiktok and twitch too. Why not?

Its worth thinking about how many different forums you can possibly cope with communicating with your players when you have to also remember that you *need to also work on making the actual game too*. How much bandwidth do you really have? enough for 5 social media channels? 10? 20? Do not kid yourself that you can cope with all of them, as the number is only going to go up in the future, you need to pick your battles.

Plus…sometimes an entire social media platform turns evil (remember Facebook suddenly deciding to charge you money to message your own page followers? or that time they they totally banned me from ever advertising on Facebook because…I dunno, I make games about politics? (yes really)). And even when they do not turn evil, then can turn stupid, like completely deleting the entire online presence of the terraria devs for no reason and with no warning (yes really), or maybe just realizing they suck and giving up (remember google plus!).

I still maintain the best possible platform for an indie developer to communicate with players is their own forum. It can be hosted elsewhere, but NOT for free (they *will* either go bust or change the terms later…). You have NO SAY what the rules or membership of the steam forums are like. You have no real control or ownership of your Facebook or reddit pages, or your YouTube channel. It can all disappear at the whim of someone in silicon valley.

And so… discord, a company with no real business model whatsoever, and entirely funded by venture capitalists who will want to monetize (track/exploit) all the users soon… forgive me if I don’t get all excited about leaping into the setting up, promoting and running of a discord server. There are plenty of other more productive uses of my time.

Balancing Democracy 4 using stats and number crunching

I’m still working away on improving the balance for my political strategy game ‘Democracy 4‘ which is in Early Access, and likely the hardest game to balance in the history of humankind, due to the insane number of interconnecting variables.

Something I was working on today was the likelihood of each dilemma popping up. These are occasional ‘situations’ that are urgent and need the player to make a choice one way or the other. Basically the choices are always hard, because they mean upsetting someone, or causing an effect that may be undesirable given your goals.

For example, if a company is about to collapse, you could bail it out (pleasing the workers, but setting a bad example for other companies, maybe upsetting capitalists, who prefer a free market), or not, and your decision depends on who you can afford to (or choose to) upset at that moment.

Some of the dilemmas are totally random, but most are influenced by some variables so that they seem fairly ‘relevant’ to the way you are playing the game. So they all have inputs based on certain variables, and thus as the game designer I don’t know in advance when they will happen (they are not timed or scripted in a conventional way).

This is all very easy to design and code, but the problem is you can end up with the inputs being unbalanced, and thus maybe everybody is sick of seeing dilemma A, regardless what they do or how they play, whereas interesting and exciting dilemma B hardly ever gets triggered. For a small studio with a limited budget, having any game content that is rarely seen by the player is an efficiency disaster.

Luckily I (anonymously) keep track of every trigger of a dilemma by version number, so I can guild up big databases of such events. The events database is currently about 4GB in size, and is testing the limits of my MySQL optimization abilities. Thus I copy the last 2 versions events into a much smaller (600MB) database for me to query. That lets me get cool charts like this:

Which lets me visualize the extent to which some dilemmas (the ones with long red bars) are triggering WAY more than they would if their distribution was completely random. I’ve been using this data for the last few versions, but I still have the unbalanced issue despite a lot of manual revisions, so I’m working on code today to visualize this better.

I actually found this easier in excel, once I had data that showed me every dilemma, and what percentage of dilemmas each one represented, over the previous 2 versions:

I can then work out what percentage they *should* be, thus the error in terms of over or under representation. Luckily I’m analyzing 100 dilemmas, so its a simple 1%. I calculate an error in percentage terms, for each version, then calculate the change. A positive value is movement towards better balance, a negative one is movement away, (worsening the balance). This can then be conditionally formatted in excel:

Which is a cool trick, but also depressing to see the extent to which I often am having a trivial effect towards balance, or even making things worse (negatives).

However, at least having a nice process to visualize this stuff makes it more obvious to spot where I am being too timid in my corrections. In an ideal world, this would all be integrated into a single web query, and in an ideal, ideal world, some sort of cool machine-learning AI would be making these adjustments instead of me…

But hey, its a big step up from just ‘setting some numbers and then playing it a lot before release’ which is what I did ten years ago :D I’ll gradually get this stuff more and more optimized.

The emotional satisfaction of physical creation

Long ago, before netflix, twitch, steam, social media, broadband or even Tony Blair, I worked in a boatyard nailing boats together. They were smallish rowing boats. This was hard work, as was building wooden bridges. here is a bridge I helped build.

The Chinese bridge - Picture of Painshill, Cobham - Tripadvisor

And here is a boat I probably helped restore/build etc.

Thames Camping Skiff Hire

To be honest, it was stupidly hard work (often involving lying on the floor while holding a lead weight above your head as someone hammers it.), and not exactly well paid or with great prospects. However, at the end of the day, something got built. You could point at it, and say ‘we made that’, and there was great satisfaction in that.

I definitely don’t miss the physical work, although I miss having very strong forearms and being super slim despite eating like a horse.

What I do miss, to an extent, is the fact that however hard I work, there is nothing *tangible* to show for it. I can point to stuff I bought with the money I made form doing the work, but thats not the same. The work I do rearranges some bits on a hard drive, which then get copied and put on hard drives around the world, but there is nothing to really SEE. I cannot grab a hold of my work and lift it up to the sky in that dramatic fashion people do with their first child in classic TV series ‘roots’.

sidebar: Did you know who played kunta kinte in roots? Here he is from the series:

Here he is older. Yes really. Amazeballs…

Israeli scientists develop prototype of Geordi's Star Trek VISOR

anyway…

I spent a lot of time reading about car manufacturing when I made my earlier strategy game, Production Line, about car factories. I also follow the progress of the electric car company Tesla, a lot, and have got sucked into reading about lithium ion battery manufacture as a result. I am now reading a book on solar farm financing, and solar panel manufacture, because thats the kind of person I am. And my conclusion from all this is…

Manufacturing is AWESOME.

We have gone through a big shift over my lifetime from a world where manufacturing was a big deal, and something people were excited to work in (my father worked in a factory, making various steel things), to a world where factory work is considered menial, and low paid and boring, and the smart people worked in offices…typing.

Now I know that there is more to computer programming than typing, and more to law and marketing than typing…but it still lacks that gritty sense of achievement you get from working somewhere where stuff is MADE.

Ultimately the real progress in society is not being made with an app. Uber is fucking useless unless someone makes cars. Deliveroo is useless unless someone is cooking pizzas. Facebook and Instagram are useless unless someone is making phones. Meanwhile, we all have to eat, need somewhere to live, need decent clothes and shoes, and a decent TV and we need power and heating…

I feel like society has lost respect for the admirable job of MAKING stuff. Real PHYSICAL stuff. We sit in our airconditioned offices looking down our noses at people who have to sweat for a living, or work somewhere with physical goods, without which our lives would be hellish. The scales have tipped too far and they need to tip back.

Besides which…manufacturing has moved on. Its not people working a lathe anymore. Here is a modern battery factory:

Someone had to design that, build it, maintain it, optimize it. This is AWESEOME. I would love to do this. I’m too old to re-train, but if a teenager asked me what industry they should aim for, I would be hard torn between tech (AI/programming) and manufacturing/logistics. I’m going to stick at programming for the rest of my working life, but I’m trying to get involved in another industry, one that actually makes things. I’m sick of just ‘investing’ in something built by someone else. Making things that other people want to invest in is the REAL hard bit, and I suspect the rewarding bit.