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

If anyone can do it, everyone will.

Every now and then I come across a story about how mid-tier youtubers are making an absolute pittance, or that indie bands on spotify earn less than minimum wage, or that writers (like my wife!) can expect to earn a really trivial amount for what they do.

This is totally and utterly expected, and its down to barriers of entry, of which there are a few.

Barriers to entry is an economics term that refers to all the stuff you need to have to produce a certain product in the market. Some industries naturally have small barriers to entry (busking only requires a guitar, for example) and some have huge barriers (spaceships, cars, silicon chip production). Generally speaking, barriers to entry are very bad, from an economics point-of-view, because high barriers-to-entry lead to ‘abnormal profits’ by people in that market, as its difficult for newcomers to enter the market and bid down the price of the product.

It might seem that this explains why indie game devs rarely make any money, because the barriers to entry for indie dev are tiny. You need an office chair, a laptop, an internet connection, and…a rudimentary skill in programming and game design. Thats a LOT of people, and its WAY more than it used to be, now you dont have to code your own engine and dev-tools are affordable.

SIDE-NOTE: YES amazingly cliff is aware that there are millions, if not billions of people who cannot afford a laptop and broadband. Well done! 10 internet points for you! But this blog post isn’t aimed at solving inequality. Not everything on the internet is aimed at everyone, or is a political statement!

Anyway… indie game dev does indeed have super-low barriers to entry and this should mean that nobody in that industry makes much profit, but hold on! some of them do! Jonathan Blow! Introversion! Me! The Factorio & RimWorld devs… how is this possible?

Barriers to entry can include personal ones as well, not just financial requirements. Sure, anybody can buy visual studio (my dev tool of choice, about $500), the same chair as me (aeron, about $1k) and a decent PC (maybe $1,500 tops?). They can then decide to make an indie game. This will not be profitable, as there are a LOT of people in this green segment below…

Some games are technically much easier to make a first-game in than others. Platform games come to mind, as do arcade games. If you are using unity or similar, maybe a primitive FPS. Some genres are harder. Strategy games are harder, as are RPGs, Simulation games can be really hard. By choosing one of the ‘harder’ genres, you are already putting up barriers to entry to prevent your market value being competed down. Of course your job just got harder, but thats to be expected. There are fewer people in the white segment below.

Where it gets more interesting is in leveraging barriers than cannot easily be broken down by any means. That comes down to what makes you…YOU. Leveraging that unique venn diagram of skills and interests that makes you capable of making the game that YOU can make, but its unlikely any other dev can.

In my case, studying economics at LSE, and the son of parents who were both trade union reps, someone who got taken on ‘fun trips’ to the Trades Union Congress and Labour Party conference as a child (yes really), plus an aptitude for maths and logic (and clearly being on the autism spectrum) means that my venn diagram screams MAKE COMPLEX POLITICS SIMULATIONS. There are a handful of people in the white segment below. maybe me and Brad Wardell and half a dozen others?

Now in theory, anybody could try to clone Democracy 4 and force down my profits, but in practice its hard because you have to REALLY be a politics geek to spend the time and effort to make that sort of game, and the coding challenge is sufficient that it still gives me headaches after 39 (yes really) years of doing programming. Plus I have a special super-power that allows me to be even better suited to that exact project:

I’m pretty much a centrist. Politically I’m slightly right leaning on economics and slightly left leaning on social issues, but generally speaking I’m a moderate. That means I can sit down and have a meal and a chat with a hardcore bernie sanders supporter OR a trump-supporter, and get along with both as people. That means I’m not trying to have a big political agenda with my politics game, which broadens its appeal. (I’m not going to attempt to add another circle to that diagram…)

Every extra circle you can add to your indie game dev venn diagram of uniqueness™ is going to boost the probability of you earning decent money. Of COURSE…. you still need to work hard and make a great game, and make it appeal to enough players and do the other 999 things. This system only helps you maximise the returns WHEN you have an idea, and execution that results in something people want, and buy. I still think its worth keeping in mind.

Pak files

I just added pak file support to Democracy 4. Its something I already had coded for an earlier game, but I had to do a bit of fussing to get it to work properly with democracy 4.

Pak files are basically big phat files that contain other files inside them. If you are a new developer, you probably have no idea they exist, because you probably use unity and AFAIK they handle it for you. Pak files are pretty old school, as I recall Doom and Quake used them (maybe called wad files), anyway the principle is pretty simple:

A pak file contains two sections, an index that tells you where all the other files are inside the main section, and a big phat list of data that is the contents of those files. All of this gets stuck in a single flat blob of binary data. A class exists that lets you grab the memory address of the file you want if you pass in the name of the file, so hopefully to anybody who didnt write the pak file code, using it is easy. You can read the contents of a file just like its on disk, except you have to use functions that read from memory, not ones that explicitly read disk files.

In my case, that meant stepping into the engine code, and the opengl stuff that reads in graphics files (we are only using a pak right now for dds and pngs), and just changing the contents of one function. Instead of using this code to load the data ready for creating a dds:

fread(filedata, filesize, 1, fp);

I now use this

memcpy(filedata, GetPakFiles()->GetData(pentry->StartOffset), filesize);

Big deal :D. Similar changes happen for pngs. To keep things super-simple, the old code for loading a file will run if the pak file reports it cant find that file, so you can stick a ‘loose’ png or dds file into the bitmaps folder structure and it will still get found, and the rest of the code doesnt even know the difference, which is perfect for mod support.

Most of the hassle in getting this to work was just writing some code to enumerate (that means list really…) the contents of a folder from within the pak file. I had to support this for stuff like minister profile pics, because the code previously would ask ‘what files are in this folder, I need to know so I can select a random one’, and now that code gets handled by the index at the start of the pak file instead.

So why bother with this?

Basically speed. Do you know wwhat the read speed of your hard drive is? Checking a random new one on amazon.com shows 6Gb/s. I assume thats bits not bytes, so thats 750MB per second. My hard drive is a little bit older, so lets say 500MB/second. I’ll just copy a big chunk of the source and obj files from D3 to another disk, brb…

Ok…copy speed is between a low of 1MB/second up to 100 MB/second. Wow. Thats so much slower. Why?

A HUGE amount of bullshit happens on a PC when you access files. To simplify it, it goes something like this: *deep breath* You ask to read in a file. The OS then looks up the file table to check that file exists. it then asks the security system if the current user has permission to access that file. When it gets a yes, it then opens that file, and sets attrributes so other processes will know that file is in use. The antivirus software then kicks in, and hooks into the file read so that it can check to see if that file is excluded from scans or not, and gets ready to analyze its contents. The O/S then has to use the file-table to work out where all the various scattered chunks of that file are, and start reading in each block. This means talking to the driver, and ultimately to the hardware, which may also have to check its cache to see what blocks have been cached and whether or not it has to start the glacial process of spinning an old physical drive or not (faster with SSDs obviously).

THEN! when the file read is complete, we can close that file again, notify the system that its not in use by our process any more. We can then start the process of opening the next file in our list..

You do that bullshit for EVERY DARNED FILE. But the good news is… if you have a big phat pak file…you do it once. Just once. The rest is free.

So Democracy 4 goes the extra mile, because our pak file is small (only a few hundred MB). We dont just open the file on startup, we stream all 200MB into RAM. That should take way under a second. We then have the entire file system of dds and png files in memory already, and able to be loaded almost-instantly into our engine. (RAM->VRAM is mega fast)

99% of players will not notice the speed difference. But if you have especially shit anti-virus running on a laptop, in low-battery mode, with an extremely fragmented hard drive, running democracy 4 on a train, you will be glad I bothered. Its really easy to code. My PakFile code has 263 lines in it. Many of them are whitespace or comments.

The death of UK Television

Its shocking just how awful UK TV is these days. I am old enoguh to remember just 3 channels, broadcasting stopping totally around midnight, and no TV at all during the mornings. TV quality was actually BETTER back then.

We now have about 500 channels, and they are uniformly awful. As a creature of habit aged 50, I still optimistically find myself seeing if anything is on TV tonight. There never is. its all dumbed-down, patronizing crap, repeats, movies from fifteen years ago, or TV that honestly seems designed to rot peoples brains. The cheaper the TV the better, so reality TV is king, and anything where the ‘content’ is just random unpaid members of the public waffling is ideal.

British Tv just cannot compete with amazon prime, the disney channel and netflix. its game over. Why the hell would I watch UK TV when programs that are world reknown, cost 100x the average BBC budget and everybody is talking about…are just a convenient click away, scheduled whenever I like them? Of course I am FORCED to pay for thew BBC by law.

For a LONG time I listened to radio 4’s political ‘today’ program when I woke up. I now wake up listening to the theme music from Star Trek:DS9. I feel I’m more informed, educated, and calm listening to that than I do to the shouty, interrupt-laden cross-talking imbecilic bullshit that passes for ‘political journalism’ in the UK these days.

Just a FEW of the traits of modern TV ‘news’ (ha!) reporting that drives me insane.

  • TWO presenters. One male, one female because….why? wwe need to double the salary? I dont give a fuck what gender reasds the news, I only need one person to do it for fucks sake.
  • SMILE SMILE SMILE. Why? You just look like a drooling imbecile. I dont smile that much in a month.
  • BIG HAND GESTURES. For no apparent reason. Why the hell? just talk. I dont need you to immitate someone doing fucking origami as you explain the news.
  • TOTALLY random EMPHASIS on the OCCASIONAL word for no EASILY understandable REASON. Nobody on the planet talks like this to their friends. What on earth are you doing?
  • Completely pointless cross-focus camera effects to go from a leaf, to a street sign as somebody is talking. WHY?
  • Taking some random item in a scene and using it as the background for a CGI graph to show that you can do that. Am I supposed to clap?
  • Walking slowly towards the camera as it pans backwards to reveal that you are in a busy street, walking extra slowly, and babbling to nobody like some sort of maniac. For fucks sake stand still.
  • Cutting back and forth between the person being interviewed and the interviewer, nodding, like an idiot when we all know these ‘nodding’ bits are filmed afterwards. We understand the concept that you are still there for fucks sake.

All of this gives me the strong impression that modern UK TV is aimed at idiots. Anybody who can tie there shoelaces is supposed to get their news online, but hopefully not from the similarly dumbed-down drivel and lecturing, patronizing bullshit that is the BBC news website.

Oh By the way… climate change is in full force right now. its 45 degrees above normal in the fucking ARCTIC CIRCLE and nobody has even put this on the bloody news. You have zero future, and we are heading towards a climate armageddon. Enjoy Love Island.

That's a lot of singletons! 150,000 people apply for the new ...

Democracy 4: The fixed income rewrite

About a week ago I had this mad idea that it would be cool to plot every single Democracy 4 voter’s wealth on a graph, so that you could see where they were clustering in a nice easy-to-understand way. Within an hour it worked, within a day, a new rewritten version that looked much nicer with blue dots on it was done, and I was tweeting, and people were saying ‘yay’, and then everything went fucking mad.

By hovering the mouse over one of those blue dots, you could see a breakdown of how that persons income was affected by every government policy or situation, indirectly, through their membership of voter groups. This data already existed in Democracy 3, it was easy, it was just GUI code, and done really quick… and that showed me what an absolute mess the simulation was…

Democracy 1,2,3 and 4 are all coded as a homebrew neural network. Every neuron has a value either capped from 0->1 or -1->+1. Everything in the game is a neuron, a voter, a voter group, a policy, a minister, an event…everything. Voters also have an ‘income’ neuron which tracks how much money those voters have. So…in supersimplistic terms if you want to know why Bobs income is 0.78, you look at the 21 weighted inputs from all the voter group income neurons, and you see all the +0.2, -0.1,+0.32 etc, that adds up to 0.78. If you want to go one stage further up the hierarchy you can track the origins of those effects to policies etc.

Thats worked for 3 games perfectly. But its a crap system.

The trouble is, peoples incomes are on a 0->1 scale. And all effects are percentages. So for example if free bus passess give retired people a 0.05 income boost, that increases the income of all retired people by 5%. Fine?

NO

Because working class ex-street sweeper mavis just got a bus pass worth $500, but retired hedge fund manager Boris just got a buss pass worth $15,000. WTF? why does democracy hate poor people? The problem is that we have only ever been able to use effects to apply percentages to incomes. That means EVERY benefit, or tax, or effect is proprotional to your income. That means lambourghini drivers pay more in car tax than skoda owners (maybe intentional), but means the state pension depends on how wealthy you already are.

Its fixed. it was hard.

Basically I have had to code an entirely new shadow system of fixed-income neurons that can cope with values beyond 1, and then (this is the hard bit) written code that stitches it all back together internally so that we can still use the same mechansims to move people between middle-income and poor etc, and still display everything in the UI as though nothing has changed.

This was hellish, because it also means restitching together lists of totally different UI items on the fly with different calculation methods to come up with a result that looks the same as it used to. Its taken a week of fixing edge cases, checking, altering UI, and writing lots and lots and lots of code which mostly will go underappreciated :D.

But thankfully it now works, and it means we can have effects in the game which are +10% income of retired people, and also effects that are +$10,000 income of retired people, as the designer or modder sees fit. This means helicopter money can actually be fixed for everyone, free school meals no longer serve foie gras to rich students, and so-on.

You wont notice it immediately but its a massive improvement in the underlying simulation code in the game. It stressed me and tired me out so much to do it that im forcing myself not to code today so I can recover.