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

Solar-Powered Borehole Opening Ceremony!

So our solar-powered borehole in Cameroon is now live and working and providing clean drinking water at zero effort to hundreds of people. Yay! There are more details about the borehole here, here and also here. I might not have mentioned it before, but the cost is just over £20k. Very worthwhile when you think about how many people it will affect and the changes and improvements it enables. Anyway, they sent a very nice video celebrating the opening of the borehole, and here it is :D.

Solar-Borehole project update!

Just got an update from SHUMAS, the organisation on the ground in Cameroon that helps us do those charity things, like the two schools. Looks like things are going well. Hopefully lots of pics and updates to come!

Ridiculous Stats Battles

A while ago I re-designed the post-battle stats screen for Ridiculous Space Battles. I was MUCH happier with this than the earlier versions and I loved the horizontal histograms for every weapon which showed not just how much damage they did, but how much was reflected or absorbed by each of hull, armour and shields. I think it was a vast improvement on what I had previously. However! there was much room for improvement.

The biggest issue was that the list of stats chosen didn’t seem to be that helpful. If your fleet was 95% frigates, why bore you with the ‘best’ cruiser and fighter weapons? I re-designed the system to show you more interesting key stats such as the most cost-effective weapon, the ship that was hardest to damage (toughest?) and the weapons that were in use the most (or least). These stats are way more helpful:

Although that was a big improvement, play-testing showed me that a key problem still remained (which is true of all auto-batllers), which was namely ‘How can I translate what I learn from all these stats into adjusting my deployment the next time I fight this battle? This is a big problem (and it was back in the Gratuitous Space Battles days), and I have experimented a lot and come up with a solution I am super happy with!

In hindsight, the solution is obvious. Give the player a way to view want went wrong last time, when they try the level again. In code terms, this was a ton of work, but it works!

So when a battle ends, after viewing the current stats (probably best thought of as stats-highlights now), if you then want to try the level again you have a togglable overlay over the deployment map which shows the fleet you tried last time, with a ton of stats for every single squadron showing how they did.

The coloured squares and the percentages show survival rates for each squad, and you get Survived/Escaped/Destroyed percentages as a tooltip, but click on any squad to see a pop-up with a bunch more stats, tabbed into defensive and offensive data.

And at any point you can use a hotkey (or the buttons at the top of the screen) to toggle from this ‘previous battle overlay’ to your placed deployment for your next attempt at a battle. This makes it SO MUCH EASIER to look at your deployment and work out what went wrong and why, and correct it for the next battle. It is also persistent saved-to-disk data, so you can come back to a failed mission months later and still see the battle stats from your last attempt.

I know the games development keeps taking longer and longer but its definitely getting to be a lot better as a result, and I would rather ship a great game late than a not-as-great game on time. Thanks for your patience, and for following its development! Since I took that screenshot, I have had a MUCH better idea for how to make that screen even better, and I’m working on that now. This means even more work, but its going to be awesome.

We got a heat pump (at last)

It was inevitable really. I’m a life-long environmentalist who got solar panels 15 years ago, an EV 11 years ago, and a battery a few years ago. I also spent my own money to madly build a 1.23MWP solar farm. Of course I was going to get a heat pump. In fact you may well have assumed I already had one. Why was I not earlier to this?

We live in a very old house. Its funny because where I live, its just considered an ‘old’ house, because there are so many here, but by most people’s standards its ludicrously old, as it was built in 1750. Living in a house like this is kinda awesome, if you like BBC costume dramas, and it certainly has a lot of ‘character’, but there are definite drawbacks. One is that it is quite cold, as the walls are single-thickness, without cavities, and the other is that you need government permission to change anything.

When heat pumps first came out, there was definitely a vibe o ‘well its cool if you have a passivehaus’ and then things migrated to be ‘its great as long as you have underfloor heating and excellent insulation’. This was still no good to us, as our floors are either suspended wood over a cellar, or brick and huge chunks of stone. Underfloor heating would never be a thing here. But then heat pumps got better and better, and we managed to (finally) get double glazing, and it actually looked like getting a heat pump might work for us.

Quotes and Grants

Luckily a neighbour of ours already had one, so we went and gawped at it, and asked questions etc. (They have a newer house). Eventually we decided to go for it, and got quotes. Oh my god the quotes. First we needed to get an ‘Energy performance certificate’ for our house, which basically means pay £100 to some freshly qualified surveyor who walks around your house and fills out a form. Like many govt programs, this was a big waste of time, because although you need the certificate, the govt dropped any limit on how efficient the house had to be before getting a grant for a heat pump. The certificate is thus just a piece of paper that gets stuck in a drawer that was pointless, but we had to do it anyway.

Why did we need it? Well because the UK government, for all its sins gives you £7,500 towards a heat pump, and that certificate process is the only string attached. So well worth it. Why did they drop the efficiency limit? Well someone in govt finally worked out that the only people getting heat pumps installed were retired middle class people who tended to live in old houses. If the efficiency limit was too strict, they wouldn’t bother, and they need ‘early-adopters’ like us to kick-start uptake of heat pumps. Getting the grant was satisfying because I have NEVER got a grant from the govt to do anything (not even the solar farm).

Anyway, grant plus paperwork in place, we got three companies to give us heat pump quotes. One was just totally useless. Another did an exhaustive heat-loss survey, but all of the numbers were blatantly just wrong. We eventually went with a third (which our neighbours used), and they were tons better. Basically they need to come measure your rooms, look at your radiators, do a ton of calculations and decide what size heat pump you need, and if you need to upgrade radiators. We were told we needed a 14KW heat pump, and no urgent radiator upgrades. In the end we doubled the size of two of them anyway, in rooms that were always cold.

We then needed ‘listed building consent’ and ‘planning permission’, and that was an epic world of stupid stupid pedantic pointless government bureaucracy bullshit I won’t bore you with, because unless your house is listed, you wont need it.

The Installation

And so it came to pass that people came and installed a heat pump. Yay. Because we had previously had an outside oil combi-boiler, our house had zero hot or cold water tanks. So we needed one of those. And luckily, it went in our cellar, which is where we put stuff like batteries etc. This was awesome as it meant taking up zero room in the house. I was impressed that the installers were not put off by having to install a hot water tank and ton of heating controls down some tiny steps in a cellar, especially as the door to the cellar is actually a secret door that works as a bookcase. Its all very scooby do.

Anyway, after a few days of fuss, we ended up with this!

And if you think ‘seriously thats a lot of tubing’ I agree with you. I had it all explained to me, but I zoned out a bit. It looks more complex than it is, and you can basically ignore it all and just use a tiny little remote thermostat gadget to control it all that looks like this:

And of course the actual heat pump got installed (which was way quicker) and the old boiler removed. It went in the exact same place and is here:

I should point out this is a BIG heat pump for a 1750s 3 bedroom detached house. If you have an average UK terraced house a heat pump would be 5-8kw. Ours is 14kw. Also worth pointing out that although the total cost for our heat pump massively exceeded the £7.5k grant, that would be VERY different for a typical smaller one, especially if you already have a hot water tank and don’t need it installed somewhere awkward.

So the heat pump was installed, and everything was great. The end.

The difficulties and the fix

But no! It was an irritating nightmare of unhappiness for a few weeks. We had major problems. Firstly it seemed like it used a TON of electricity to do NOTHING. It then seemed that it COULD generate hot water (and lots of it), or hot radiators, but never under our control. It was frustrating and disappointing and I was unhappy :(. We argued and complained a bit. We also decided to double the size of one of the two radiators in our living room. This was a good move and made a big difference, BUT what totally transformed everything was the radiator dude spotting that the ‘Hysteresis’ was set wrong. This is a setting that determines how much the heat pump lets temperatures diverge from the thermostat before switching. Heat pumps do NOT like to be constantly going on and off. Insanely ours was set to 20 degrees, when it should have been 8 or even less. So our heat pump would be told to get the radiators to say 50 degrees, do it, then switch off and not care about switching back until they were 40. The same happened with hot water. It also controls how much you can overshoot, so a Hysteresis of 20 means radiators oscillated from 40 to 60.

In practice what this meant is that it all felt RANDOM. Sometimes radiators were super hot, often seemingly cold. Ditto hot water. It felt like the whole system was under someone else’s control. It sucked. We had heat-pump-purchase regret. But actually the minute that setting got changed, everything then worked perfectly, and we are very happy. The house is warmer than ever.

Its worth pointing out we had several conversations with the installer, lots of emails and frustration before eventually it was spotted that this was wrong. We are so glad that we persevered to make sure it was set up correctly, instead of just being grumpy and mumbling that ‘heat pumps suck’ which I think some people do when they have this problem. Check your settings!

The conclusions

So… was it a good idea? Well actually YES. If you read my blog you know I would do it anyway. Its about the environment for me, not money. I HATED buying thousands of litres of oil to heat our house, and wanted to remove my last direct usage of fossil fuels. But actually now its all set up right and we have the right radiators, its pretty good. And our timing was comically good. Not only was our oil tank 99% empty when they took the old boiler away (luck!), but just as we are settling in to our oil-free lifestyle, the Iran war starts and the price of heating oil has more than DOUBLED. Our electricity bill is definitely a lot higher, but then we now have zero oil bill. Plus we had the heat pump fitted in winter, so it was always going to be the most expensive time to assess how much power we now used.

So, my tips for anybody considering it? Firstly I would say shop-around and read reviews. Some installers are good, some not. Same as anything. Ask neighbours who have had one fitted for references. Secondly, take any recommendations about new radiators seriously. We were a bit flippant. We should have got that radiator fitted at the same time. Thirdly, Make sure its set up right. They are COMPLEX and you need it set up right for your lifestyle and your home.

But generally, I am very happy. Out of solar, batteries, EV and heat pump, this was the most disruptive and hardest upgrade. However if you are in the UK don’t delay. That govt £7,500 grant will NOT be around forever. Take advantage of it. Oh and if you are thinking of getting solar or a battery, GET LOTS. We have gone from smugness about our 4.1kwp solar and 19kwh batteries to ‘Balls, I wish we had more…’. A heat pump does push up how much electricity you use, so generating more and storing more off-peak power will be well worth it.

Auto-balancing and load-testing Ridiculous Space Battles

Its been a while since I blogged… Anyway I have not been completely idle. As well as booking a long-desired holiday to CHINA (oh yes!) I have still been working on this weird project that I cannot decide if its a retirement hobby or a proper serious game launch, and that would be my pretentious re-imagining of Gratuitous Space Battles, which I am appropriately calling ‘Ridiculous Space Battles’.

The game is very playable right now. It has a ton of content, and it runs great, and it looks fab. But it does not have data for the campaign games, and does not have the challenge system coded into it yet. I might at some point decide to put the challenge system off for a bit, and release it with skirmish and campaign games into Early Access. I really do keep changing my mind on that. This game has been very cheap to make, and I am under no pressure to release, so to be honest it feels kinda weird being able to do anything I like with it!

Anyway, something I have always wanted for my games was a pre-release debug build functionality to have them run hundreds or thousands of games and automatically provide data that would let me balance the initial stats before actual humans start to play it. Now if you are a relatively new developer, its easy to just sling out lines like “Yeah just code a headless mode that randomly designs ships and fleets and have them fight each other a million times to collect stats”. This is the sort of thing swaggering indie devs throw out in a reddit thread as advice, as though that single sentence contains all the required skill, code and effort.

Its not that simple.

Now if you have a much simpler ‘problem-space’, then it gets massively easier, but just the process of coding random ship designs and random fleet deployments is a major engineering effort in itself. Getting the game to be able to put together a ‘legal’ in game-terms design isn’t too tricky, but ensuring it produces sensible designs is another things entirely. There is nothing to stop the entire deployed fleet consisting of a hundred ships that only have anti missile defence weapons and zero offensive capability, for example. That would be a valid fleet design, but useless for auto-balancing. Worse, it would imply in the stats that missiles are useless, without the caveat of ‘yup but that strategy can never win a battle’.

Its a massive minefield of issues like this, an frankly I have not addressed any of them yet. My current code designs each ship in a fleet individually right now, so the chances are such anomalies would be highly unlikely. However, the point stands that a ‘random’ fleet design is not ideal. And thats before we start placing those ships in formations, and assigning orders to them based on their designs. I’ve done a bunch of wok on that, but its still not ideal.

The actual easy bit was the stats collection and amalgamation into a nice spreadsheet at the end. My game is very stats-based (its an auto-battler after all), so the code to track all those stats was already in game. What took a bit longer was the wrapper code to run through a battle with a random fleet, record stats, and then do the next battle. This *sounds* easy, but when a game has been designed on the basis of the user clicking buttons, circumventing that without errors can be buggy. I didn’t just simulate mouse clicks because I needed to totally skip the deployment UI for each battle. Otherwise I am flushing a ton of textures and loading a whole pointless UI between every battle, slowing down the auto-run process.

The real delay in this stuff has been two-fold. I need to code some sort of basic genetic algorithm for ship design, and I also encountered loads of bugs. Lets do the bugs first. Its easy to think ‘dude, you shouldn’t have bugs in your code’, but harder to make that a reality when you have a game as complex as RSB. There are over 720 source files for the game and the same amount again for the engine, and the code is fiendishly complex. Plus the actual GAME is fiendishly complex. For example, I encountered a crash bug while typing this (The game was churning auto-balance in the background). It was a crash bug where the game lost focus, then recovered focus (I had moved to another window), and it crashed in the shader for Target Painter weapons.

You might think ‘what a noob, you obviously dont re-init your shaders’, but nope, I do. This is obviously something specific to THAT shader. I have tested the game a lot, but apparently never alt-tabbed away exactly when the game was drawing a target-painting effect. Given how many different systems and visual effects the game has, its no wonder I have not churned through all the possibilities yet. This is one of the major benefits of writing this autobalance code. I am soak-testing my game, running thousands of battles and trying every permutation possible, and it throws up a ton of asserts and warnings and crashes, all in obscure and exciting places. I DO test new features when they are added, but testing them in every permutation of battle is impossible. I’d need 50 people working in QA.

So the last aspect of all this is genetic algorithms. I intend to try a bit of this but no go mad. Right now, I can only tell if ‘fast missiles’ are overpowered by looking at the amount of damage they do, over 100 battles, compared to their cost and weapon module size. If they DO look a bit overpowered, then maybe they should be selected more, to assess whether they are clearly a super-weapon, or if thy just happened to always get matched against fleets that had poor missile defence. Perhaps I need a system that takes the top ten weapons from the previous 100 games and biases towards them so I can concentrate on collecting data for them. Perhaps also do the same with the BOTTOM ten weapons so I can see if they were just badly represented due to random match-up.

And of course all of this is ignoring non-weapon modules. I should probably test the ‘survival rate’ or ‘survival time’ of ships with each armour and shield module or other defensive module like a decoy projector or cloaking device. Maybe these are hugely overpowered? I have not even begun to look at that yet.

One piece of excellent news though. My game is VERY good at pruning its memory usage and definitely has no leaks. I’m watching the area chart in the visual studio debug view as I type and its currently using 234MB (lolz) and rarely goes above 400MB in big battles. This is a vast improvement on my other games, or early builds of RSB that were leaky.

So there you go, I AM still coding, but not in a hurry, and I hope the end result is worth it :D. Don’t forget to add RSB to your steam wishlist if the game sounds interesting to you!