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

The irritating last-minute bug

So…I am 99% sure I’ve fixed this, but it was a bug hell nightmare and worthy of a blog post. It also kept me coding till midnight last night, so I did probably 14 hours work yesterday. arrrghhh. no wonder I slept late this morning. Anyway…

Democracy 4 releases into steam early access on Tuesday, but we already have 3-4,000 players, and I had no showstopper bugs., Most noticeable the game was 32 bit, and only in English. Very recently we switched to 64 bit, and I guess some combination of that, and some people playing in different countries started me on a journey of bug tracking hell.

I got one bug report “game crashes on next turn, or if you change sound volume”. I tested my copy, worked fine. Tested on my laptop too, worked fine. Asked them to try and repro on another PC, arrogantly assuming user error. Then another customer reported the same thing, then a third. This is NOT GOOD. I asked for debug logs, which handily my engine does do, and are fairly comprehensive.

Nothing in the logs explained the actual crashes. Everything looked good. nothing was especially shocking except an error about failing to find a specific neuron (no name supplied). This could be just a typo, or a badly written mod. This *shouldnt* happen, but the game should recover. its not critical… but then why didnt MY copy give me the same error… weird?

I put together a new build of the game that outputs the NAME of the neuron it can’t find (should have done this anyway tbh), and I get back a log from a user where the missing neuron is called 0,00.

WUT?

That sounds like a bug with a comma somewhere, as the equation Socialist,0.00+(2*x) for example must have a typo, so instead of the name ‘Socialist’ we are getting the value. Ha! a simple typo. But why am *I* not getting the bug? I do a windows search of the whole data folder looking for 0,00. I get two hits… neither file actually contains the string. Windows search is WORSE than useless. Weird…

So I change the code again to output the name of EVERY attempt to get a neuron by name so I can compare mine with the users, and see where in the code they were just before this goes wrong. This turns out to be no help, as its inside the Voter processing, which makes no sense… there is simply no way any string like that is being passed at this point in the code. this makes ZERO sense.

And then I notice it. I’d normally missit…but it was weird. REALLY weird. In the debug logs of the players:

PreCalcCoreSimulation time: 0,70 seconds

No big deal, this value will vary based on CPU, but on my PC it said this

PreCalcCoreSimulation time: 0.92 seconds

Yup. Mine has a period/full stop, theirs has a comma. No big deal, its debug logging, who cares. Maybe its even an artifact of copy/pasting the log to my forums… I check this…nope. I ask the player to verify thats really a comma in that log file, not a full stop, they confirm its a comma. How? HOW is this possible? I check the code:

char temp[256];
sprintf_s(temp, 256, "\n\nPreCalcCoreSimulation time: %.2f seconds\n\n", elapsed);
GetDebug()->DebugOut(temp);

This is simple stuff. I just used the very low level, very basic, very simple good old fashioned sprintf function to convert a value into a decimal number in a string. I do some googling and… what the actual fuck? apparently even good old c++, ignoring anything higher level, is looking up the regional settings, and deciding whether or not commas or periods are used in decimal strings. In english its full-stops (.). It is VERY VERY important to the structure of my code and engine that its full stops. When the majority of your data uses comma-separated values, you cant go messing around with the definition of a comma for fucks sake…

So theoretically easy fix, find the function that hacks in the ‘locale’ to be English for this app…and boom! No! it doesn’t work. Sure, I can use

setlocale(LC_NUMERIC, "en-US")

to force the number format to be full-stops, and when I check that the locale really has been set…it has! and everything is fine but… once the game loads a new level, everything has gone haywire, all the values are wrong, all the policies are set to zero, and checking the locale returns what the PC has set it to (I temporarily changed mine to commas as a test). In other words….my setlocale is being overrriden.

Arggh. Now its late, I am tired, I am thirsty, but not enough to leave my desk and lose my concentration. I am very tired now. I spam the code with multiple checks to read the locale at every possible location to see where the hell it goes wrong… And eventually I find it. Its the text renderer, which does use some middleware, to convert fonts into vector graphcis, render them into memory and then paste them as strips to the screen, dynamically. Its all very clever and supports any language, any font size, its super l33t. It also has its own opinions about locales.

So now the game is fixed, by me setting the locale to the US the millisecond the game starts, and then the minute its rendered its first bit of text (and thus the middleware has overrriden me, it sets it AGAIN, to ensure no funny business. Everything now seems to work. Hurrah. I hate computers. I need sleep. Why the hell cant humans agree on what a decimal point looks like in 2020?

Enough of your juvenile hot takes, Show me the DATA

I read some stuff on twitter today (I wont bore you with the details) that is absolute crap. I guess 99% of the useless lies that I see each day on social media just fly past me, but I knew about this subject, and so I noticed it right away. To my dismay, it is heavily upvoted, liked, shared and cheered on, as always. The problem is, nobody wants to take the time to actually do any research whatsoever. The laziest of all seem to be so called journalists in the mainstream news.

Top 10 Data moments from Star Trek: The Next Generation | VODzilla.co |  Where to watch online in UK

One of the major problems behind this is the concept in news of an ‘angle’ or a ‘take’. The idea is that we have to have one of these in our news, otherwise we cannot understand what people are telling us. Telling us that a town was attacked in an air strike and X citizens died is apparently something our feeble brains cannot process, unless we see a picture of a child’s teddy bear in some rubble. I presume news desks have a folder on a shared drive called ‘kids toys in rubble’ that they have a shortcut to on their desktop, to save time. We simply don’t understand the impact of war otherwise, apparently. If a teddy bear is found, the air strike was unjustified. I guess that’s the theory?

I recently heard a BBC interview of 2 party-leadership candidates that touched on Universal Basic Income. I am not a UBI supporter myself (not in principle, but in practice…another topic…), but even I could get angry at the nonsense that the ‘journalist’ was saying. Apparently we are too stupid to understand the concept of ‘universal’ unless its described as ‘people like J K Rowling will get the money too!’. Oh the horror.

This is what you get when you have spent forty years trying to explain things in ‘olympic sized swimming pools’ or ‘length of london buses’ or ’round the earth X times’ instead of using miles or kilometers, which is the whole POINT of universal systems of measurement. Apparently we cannot understand actual data any more.

Do you know how long a london bus is? or how big an olympic sized swimming pool is? Me neither. (FWIW 11.23 meters long and 50 meters).

Very Soon You'll Only Be Able To Board A New Routemaster Via The Front Door  | Londonist

Once our media went from reporting facts and data, to enclosing it in ‘angles’ and ‘takes’ it was a very short trip in the days of clickbait to transform the story entirely, picking and choosing context to whip up as much anger as possible. The media salivates the minute anybody is killed at a protest, or if a police officer kills someone right now, because OMG this will drive people CRAZY. No facts are required, no context required, no analysis or data required. All that is needed is the race of each person involved, and hopefully some shaky-cam footage that we can edit in order to create as much outrage and as much anger (from both ‘sides’) as possible.

Everybody knows ‘where they stand’ on a number of big political issues. We all have our tribes, and our beliefs, but how much of it is emotion, and how much of it is based on data? You are pro or anti-brexit mostly based on emotion. You are pro or anti gun-rights mostly based on emotion, and when it comes to economics…OMG peoples grasp of the data is absolutely embarrassingly slight.

Here is a quick quiz to see how well the media has informed you on some random topics.

  1. What percentage of US government spending goes on interest on the debt?
  2. Whats the most common cause of death in the US and how many does it kill each year?
  3. What percentage of US households earn over $100k per year?
  4. How much does a US senator get paid?
  5. What was the turnout at the last US presidential election?
Indonesia: Some children return to school in quake city hoping to see  friends | World News,The Indian Express

I would be very surprised if anyone was close to all those answers ( I certainly was not). Here they are:

  1. 7.8%
  2. Heart disease: 647,457
  3. 30.4%
  4. $174,000
  5. 55.5%

We discuss politics using memes instead of facts. We either think senators are out-of-touch super-rich, or underpaid considering the tough job they do…but how many know what they get paid? The national debt is no big deal, or catastrophic depending on your tribe, but how many know what it actually is? There is no room for subtlety, or context, but only room for deciding if a number is good or bad BEFORE you find out what it is.

Our news providers do a TERRIBLE job. They talk about how the pound has ‘fallen dramatically’ without showing us a chart, or that gold prices have ‘soared’ without showing us a chart. Unemployment is ‘plummeting’ or ‘soaring’, again, where is the chart? Its 2020, we can cope with pie charts and bar charts and stats and numbers on the TV, but we rarely actually see them. I hear daily, yes DAILY reports about the covid crisis in the UK, but when did you last look at actual CHARTS showing you deaths and cases. here are some (official government ones):

We are not idiots, we can look at charts and form our OWN opinions. Its about time we started telling ‘journalists’ that terms like ‘plummeting’ or ‘soaring’ or ‘steep’ or ‘brisk’ are great fun in poetry, but they should play no part in serious news reports to a literate population who can understand the concept of numbers and charts.

When it comes to national elections, we are BOMBARDED with infographic hell for hours and hours showing us polling results in the most ridiculously over-analyzed detail. Why the hell cant we get those same infographic people to show us what’s going on BETWEEN elections? Give us more DATA.

But no… want to see how bad its got? I’m writing this in wordpress, using the latest editor. Its marking down my headline as not being divisive enough. I’m not kidding, there is a score of 48/100 and ‘tips’ to make my content get more clicks. Basically be more divisive. check it out:

WordPress! Now with free hints on writing divisive clickbait to help tear society apart even more… /cries.

Why bother upgrading?

My office is having new windows put in (at last!) which will mean its no longer unbearably cold in winter (yay) or unbearably hot in summer (yay), so I am currently sat at a laptop, researching the current state of abortion legislation in the USA for Democracy 4.

Anyway…

The laptop I’m typing this on is a nice shiny Asus Intel core i7 laptop. To be precise, its an Asus zenbook ux303ua i7-6500 12GB RAM, running windows 10. I mainly use it to surf, check twitter, watch the odd TV thing, blog and do forum posting, plus the odd casual game now and then. I bought it in 2016 for £767.

Its fine. In fact its great. It runs fairly fast, The screen is still fine, the keyboard still works, it doesnt crash, it doesnt lag. I had to reinstall windows once (repair from the existing install), but thats it, in four years of owning it. I cannot think of any real justification for getting a new laptop, other than the fact that my wife’s laptop is newer, and bigger, and theoretically better.

Four years might not sound old for a laptop, but it is for me. As a developer, I can get the benefit of claiming the VAT (sales tax) back, plus its a business expense. So no VAT (saves 20%) and effectively saving another 20% on the tax. Plus I LIVE for computers and online stuff, so its easy to justify a new PC at the most flimsy justification!

How Much Is Your Old Vintage Apple Mac Computer Worth? | TurboFuture

But…not any more. Its four years old and its an i7. Whats new these days? The i9? sure you CAN get them, at 4x what I paid for this laptop, but are they four times better? even three times? twice as good? Even a noticeable difference? I dont think so, unless you want to play an FPS like Battlefield V with HDR and so on, laptops that are used for work are basically very happy with an older, cheaper i7 or even i5 chip. Even the 12GB RAM is overkill tbh. I upgraded my desktop from 8->16GB and noticed very little difference.

I am not one to trot out the ‘640k is enough for everyone’ line. I am a developer, and my main PC is pretty decent (still just an i7 though), with an RTX card and a monitor the size of Texas. I get it, but most people are not software devs, and even most gamers are not playing super-demanding games. I am pretty sure I could play minecraft or fortnite on this laptop, even league of legends and football manager, so thats 99.99% of gamers covered right there!

I think we have reached a bit of a plateau where laptops are simply overpowered. The reasons to upgrade are minimal, and it shows! if I check amazon for just ‘laptop’ I’m recomended the best seller at £159.99. Thats hilarious. Laptops used to always cost a thousand pounds or more…

Asus VivoBook 14 X412FJ-EB023T - Notebookcheck.net External Reviews

Its not only laptops, but many things seem to be going that way. I’ve had the same ‘smart’ TV for five years and despite checking regularly there seems to be little benefit to an upgrade there. Even my bleeding edge car (tesla model s) is from 2015, and the only possible reason to upgrade would be to get a slightly smaller one, or with extra autopilot cameras. Quite hard to justify even for me, a tesla fanboy.

This is actually *not a bad thing*. Maybe if we were better at designing economic systems, somehow things would shift from selling increasingly over-specced gadgets to the wealthiest, to just get ‘adequate’ tech to everyone. There are hundreds of millions of people around the world who would love that £159.99 laptop, or a modern low-power-usage TV, or even a decent fridge. The question is how to shift the focus of an economy in that direction, in a way that people accept.

I dont have any answers. I’m a capitalist, and believe in the free market, but believe it needs a nudge now and then. Maybe its actually a good thing that western tech companies have manufacturing based in relatively poorer countries, as at least some of that money then goes into the pockets of those very people who would be an eager market for the suddenly-affordable tech. Like everything though, the inter-relationships of that business model are all over the place. Should we really be shipping physical goods all over the world by container ship? what happens to the US economy when all the USA manufacturing jobs go to china?

There are no easy solutions, and even modelling some of this stuff in Democracy 4 gives me a headache, but I guess at least its a good thing that a really decent laptop no longer requires people to sell a kidney.

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 ...