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

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:


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.


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?

Legacy car companies and the shift to EVS. Why they cannot win.

BTW if you followed my tip on tesla stock last year, you would have tripled your money…

Yesterday General Motors gave a presentation about Electric Vehicles and how they were a big part of GMs future. They rolled out a long line of executives onto a stage to make passionately written (but embarrassingly delivered) speeches about how they were going to continue to be the world leaders in EVs. The CEO even wore a leather jacket. It was excruciating, but the presentation is not the problem. The problem is the facts, and the facts are harsh.

Image result for GM EV day

There is a very powerful attempt to drive down the price of tesla stock (an attempt that is failing, but nevertheless, well funded by oil companies). part of the narrative is that tesla is doomed because ‘competition is coming’. This was a claim first made when tesla produced the model S. It was repeated for the model X, then for the model 3, and the model Y gets released this week, and we are hearing it again. So far the claim has turned out to be bullshit, because 58% of EVs sold in the USA are made by tesla still. Thats bad enough, but the future is even worse for the ‘competition’.

There are a bunch of reasons why big legacy auto companies cannot compete, and they aren’t all obvious. I thought I’d list them here for anybody considering selling tesla stock and buying GM or Ford.

Software/hardware expertise

EVs are just TOTALLY different to conventional cars. The expertise in making petrol or diesel engines is useless when it comes to an EV. the actual body design has to be different too. Tesla puts the battery in the floor and the motors between the wheels, but trad companies are still putting the motors in the front because…thats where the engine used to go. This means zero front crumple zone, and no frunk storage, but they do it anyway. A bottom heavy car is safer, as it rarely (if ever) flips, but even now the big gas-car companies don’t get it. They are stuck in gasoline car hardware design mode.

Software wise its even worse. tesla make their own software, and are even now making their own self-driving AI chips. Thats right, they are designing the silicon for their cars in-house. Thats a crazy amount of expertise. Legacy companies instead use dozens of chips each from different manufacturers, with virtually no in-house software expertise, and have a nightmare hiring decent auto-experienced software devs, who all clearly want to work for elon musk.

Image result for tesla autonomy day

BTW that self-driving chip is not just a prototype, they have been shipping it in cars for months already.

Factory Design

Teslas fremont factory used to be a legacy car factory and its a MESS in design terms. It was originally built to make ICE cars a long time ago, and is far from optimal design or layout for modern production. EVs require a totally different approach. This is why their chinese factory is built from scratch as a huge EV-only factory to produce super-modern cars. Legacy firms can’t demolish old factories and re-start, they have neither the time, money or the support of unions/governments to do so. Teslas 2nd purpose built factory (Germany) is breaking ground this month.


Legacy auto is heavily unionized and unions HATE EVs. They have good reason to, as an EV is much, much simpler to build, and requires a much smaller workforce. A shift from legacy cars to EVs threatens jobs and the unions know it. Teslas workforce is, and always has been EV-only.


Tesla sells direct, but legacy is stuck with a dealership network they have to support for legacy cars. The dealerships HATE EVs, because so much dealership income is from maintenance and servicing, and EVS require almost none (My own EV has been serviced once in 4.5 years. Nothing was wrong). Also virtually nobody at any dealership knows anything about EVs. Consumer feedback from dealership visits is highly critical. often the customer knows more than the sale staff, who want to sell you an ICE car anyway. You are lucky if 1/10 cars in the ‘showroom’ is an EV anyway.

Late to market

Make that VERY late. Tesla made it clear EVs could be cool with the roadster in 2008. Then came the model S in 2012. Thats eight years ago. EIGHT years after the first mass-market electric vehicle, and the legacy auto firms are talking about delivering a certain number of cars in five years (optimistically). Its WAY too late. Many people already equate electric car with Tesla. 58% of USA EVs are Tesla. Their market lead is huge.

(BTW I didnt forget the Audi E-tron, Jaguar I-Pace and Nissan LEAF in that chart, they just dont even make the top 5… BTW this is not the end-game, tesla is still growing like crazy:


Tesla make their own batteries in Nevada (and soon in China too). They partner (for now) with Panasonic to do this, but the tech is owned by tesla. They are the first company to go all-in on building a massive EV-battery production facility. other companies rely entirely on outside suppliers. Tesla have the best battery management technology in any EV. (See chart below),

Image result for tesla battery efficiency chart

If you want to work in EV battery research, its absolutely clear who you go to work for, and its not GM or Ford. Batteries are VERY expensive. Anybody can make a 400 or even 600 mile EV, you just have to put a staggering amount of batteries in it, but making an affordable 300 mile car is VERY hard, and its purely about battery tech.

Tesla Model 3


Tesla tout EVs as the future, and ICE cars as the past. They are right. Everybody knows it, but the legacy autos cannot say it. They make the overwhelming amount of their profit from ICE cars. Even GM admit that the bolt loses them money. They cant market their cars as the future or superior without admitting 99% of their lineup is inferior and the past. They HAVE to be pro-ICE cars because thats what they make, but in doing so, they have a conflicted marketing message. Meanwhile Teslas advertising budget is still ZERO dollars.

So to sum up..

Legacy autos have a workforce that hates EVS, assembled in factories designed for ICE cars, Their sales people hate EVS, and their hardware and software experience is minimal or actively damaging. They outsource the most important components, they are woefully behind, and their own product line prevents them from marketing EVs successfully.

TL;DR: Don’t believe the bullshit. The ‘competition’ for Tesla is fucked. There is way more chance that BYD or even Google/Apple could be a serious EV player than any of the old auto companies.