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

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.

Tesla in 2020. A good investment?

Tesla’s stock price recently surged past $1,000. it has since fallen back slightly, but I have no doubt it shall return. The last few months have been a roller-coaster for TSLA stock holders. What can it all mean? Is the company now over-valued? or is this actually the market catching up with reality?

It always helps to get some of the big important numbers out there as a basis to analyze this sort of thing. Numbers are always open to interpretation, but you still need them…

  • In 2019 Tesla produced 367,500 vehicles. source.
  • The market cap of the company is currently $180 Billion.
  • The automotive gross margin is approximately 25%
  • YoY revenue growth is 38%

If you look at the number of cars Tesla makes, its still quite a niche player. How can it possibly be worth the same as Toyota, or SEVEN times the value of the ford motor company? How is this a sensible valuation? Here are some points to consider:

  • Tesla has decent profits on each car

Teslas automotive margin is actually REALLY good, and its been growing too, from 20% a year ago to 25% today. How? Tesla do NOT advertise. That already saves them a fortune. They do NOT have any middlemen (you buy online, or in store, direct from tesla), which cuts out a whole other bunch of middlemen, and tesla have such a reputation for good tech that they can attract top talent without exorbitant salaries. The promise of tesla stock is worth way more to potential senior hires than any actual cash anyway.

FWIW Fords gross margin has varied between 18% and 12% over the last 14 years. Thats ford, one of the biggest car companies on earth, and one of the oldest, yet they aren’t as good at making profit from a car as Tesla…

Plus Tesla is the first car company to make actual money from software. The FSD (full-self-driving) hardware is in every new car (they don’t use LIDAR so its cheap), and you can upgrade your car after purchase to enable FSD or in some cases extra range or speed. Thats pure 100% profit.

A culture of constant re-investment and expansion has meant the company has not posted a full year profit yet (although it has multiple sequential quarters of profitability. Expect that to change very very soon, probably in a few months.

  • Tesla is growing like crazy

The global car market is in real trouble, but the company that is not only bucking the trend, but seemingly accelerating into space (literally) is tesla. check out production:

Tesla Has Best Ever 1st Quarter — 102,672 Vehicles Produced ...

Note that Tesla is selling every car it makes. These are not cars made to sit on showroom forecourts for months hoping someone walks buy. There are waiting lists for these cars all around the world.

Remember that its PROFIT in the FUTURE that determines a company valuation. Ford has historically made a LOT of relatively unprofitable ICE (internal combustion engine) cars that suddenly people don’t want. Thats not a good thing, but more of a liability. Hundreds of thousands of employees, and many factories designed and trained to make internal combustion engines are basically a stranded asset (worthless). Ford is well placed to continue breeding horses just as the automobile has been invented.

Note also that the VAST majority of Tesla’s output is from a single car factory in Freemont, an ex GM/Toyota plant for ICE vehicles. Their first dedicated EV-factory in china is currently ramping up, so expect rapid growth. Plus they are already building the 3rd car factory in Berlin. A fourth is expected soon in Texas. This company has only just got started…

  • Tesla has zero competition

Fancy an electric Audi? you can get $20,000 knocked off the price of a new e-tron, a supposed tesla-killer that nobody wants. Or maybe you want a jaguar I-pace? Both of these cars were heralded as the cars that would crush Tesla. Both are relative flops.

Tesla = 75–85% of US Electric Vehicle Sales | CleanTechnica

Even the chevy bolt, a car that GM LOSES money on, is no real competition.

  • Tesla dominates in a rapidly growing market segment

Electric cars are the exception to the declining car industry, in terms of growth. Would you want to be the biog player in this rapidly accelerating market, or a dinosaur left at the top of the crumbling mess that is ICE cars? Dieselgate was the first shot-across-the-bows, but the experience of clean air post-covid19 and the looming nightmare of climate change shows that there is no future for ICE cars. Countries all over the world have already set dates to phase out ICE sales. The leading car companies of the future will be electric car companies first and foremost.

Demand for battery metals strong despite weak EV sales

People always talk about Tesla as a car company, but thats similar to how amazon was a bookstore. Tesla is a transportation and energy/software company, whose current main seller is a car. Tesla energy is a little-appreciated but growing part of the business, and Teslas solar roof tile product is finally starting to ramp up. This diversifies the company and enable it to adjust to changes in demand across sectors.

Software is the real wild card, which brings us on to the topic of….

  • Autonomy

People do not generally appreciate the HUGE lead Tesla has over every other company on earth in the field of self driving vehicles. Everybody else is using HD maps and local geo-fencing, or LIDAR, neither of which actually scale. You can get a REALLY cool reliable little bubble car that drives around a geo-fenced and controlled environment like a retirement village right now, that will work amazingly 99% of the time. Lots of different companies are showing off stuff like this, as a way to grab the cash of ill-informed venture capitalists. Tesla is not trying to hype up specific cases, its driving to solve autonomy in the general case, globally, in all conditions, 100% of the time, and its getting there.

The difference between 99% autonomy and 100% doesn’t sound like much but its game changing. 100% means no steering wheel, no driver, and no worries. 99% means basically very good cruise control. My Autopilot v1 Tesla model S is VERY good on highways. It makes long drives safer and way more relaxing. Its not autonomous. When its 100%, I can get drunk in restaurants. I can watch a movie or read a book on long drives.

Tesla Self-Driving Demonstration | Tesla UK

A 2 hour commute is currently a nightmare, but when you can literally be asleep, or reading, or playing games, or working in the car… its not so bad. This will change where people live and work, and how they work. Imagine Uber, but safer, with nobody you have to talk to (or tip), and at one quarter the cost. You could play games/stream music/watch TV in your uber, because nobody else is in it…and thats safer for lone women too. Autonomy at 100% is a MASSIVE big deal financially, and there is a VERY good chance Tesla gets there before anybody else and just eats Ubers breakfast, lunch and all other meals.

Why?

Waymos autonomous cars have driven 20 million miles. In one country. AFAIK in one state. Woohoo. Tesla were at 2 BILLION in November last year. Don’t forget every car they make has autopilot hardware, and the rate they make them is accelerating. Some people value waymo at 30 billion. Lolz.

So to sum up, I don’t KNOW the true value of Tesla, because the companies output and capabilities are accelerating so fast its hard to pin a target on it. Given the actual number of cars shipped, it seems a high valuation, but that number will change a lot in the next year or so, and as EV incentives come out of the EU and the UK, and ICE sales continue to plummet, I can see more people seeing a $1,000 TSLA stock price as actually quite a bargain.

BTW the companies stock has tripled since the last time I blogged about why its a good buy.

Liberalism/Socialism tweaks

I’ve been looking at the political compass part of Democracy 4 while running the first few decent play-tests and it was clear that the compass was not accurately reflecting my policy choices. Some further digging suggested that the problem was that not enough of the choices the player made were affecting the underlying values for global ‘liberalism’ and ‘socialism’.

In the game, every player has a (more or less) random innate level of socialism or liberalism (there are a few voter group and country based adjusters). Initially, this determines the extent to which they identify as socialists/capitalists and liberals/conservatives. The game also models all the effects on the global values of socialism and liberalism and pre-calculates how this will have adjusted voters opinions before the game starts.

I also take those global values to indicate where the country currently lies on the political compass:

It was clear that I had missed out those effects from a whole ton of policies and simulation values, where I might be upsetting liberals, but that didn’t actually make them less liberal. Obviously these are different things.

Some policies in the game (or situations etc…) anger people with a certain view, which is often instantaneous, and some actually change peoples view over time. For example, if you legalize cannabis, then this is likely to upset conservatives and make liberals happy, almost immediately as the change in policy hits the news cycles. The longer term effect though, is likely to be increased liberalism, and people get used to the idea that cannabis is legal. This is a shift in nationwide attitudes.

This has happened a lot in my lifetime. Attitudes in the UK towards homosexuality have definitely changed dramatically since I was a teenager. The idea that a CONSERVATIVE government would be the one to legalize gay marriage would have been ridiculous in the 1980s, for example. Also there have been big changes in the attitudes towards a free press and deference to politicians. (Free press in a driver of liberalism in the game). By the way, gay marriage and also gender transition are policies in the game.

In many ways, what I’m trying to model here is shifts in the overton window, which is a concept that illustrates how political values shift over time:

The way this works in our simulation is that we are effectively moving voters around on the political compass as you change policies (in fact-oh-my-god as I type this I realize I could add a mode that plots them all on there…). The actual policies you implement have to stay within that virtual overton window in which the majority of the voters are contained. In fact, I can plot it as a sort of flexible overton splat :D

I think the last two days of fiddling with this stuff have gone well, and the game is more balanced, more accurate and more fun as a result. I wrote some extra debug mode code that let me dump out a nice list of all of the potential inputs to these values to a spreadsheet so I could check everything looked as it should. Doubtless there will be further tweaks over time, in response to player feedback, but its a step in the right direction.

Anyway, thats enough blogging, I’m going to go add tiny voter dots to the political compass :D