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

Financial research and AI

Yup, I’m still doing a lot of work on Ridiculous Space Battles, and recently did a new trailer and took new screenshots, and may even start running ads again… but in the meantime I do a lot of fussing about investments and finance…because I weirdly enjoy that sort of thing.

Somehow, I have ended up a sort of small hedge-fund manager. Its a very small hedge, but its my hedge, and I get to do what I want with it. I know a lot of people who did well from video games who then naturally use that money to make more games, or bigger games, or who publish a bunch of games by other developers. Actually for a while I did that, and published four games by other devs. Its a totally reasonably strategy. The video games business is so hit focused that to be honest the only approach that makes any sort of strategic financial sense is to go for the portfolio model, where you publish ten games and hope that the one hit pays for the nine flops (and this does seem to be the case). However, for me this approach has one huge enormous weakness (in fact two… but I’ll come back to that) – Its a lot of people management,.

I am terrible at dealing with people.

I am not whining about it. Everyone gets a random character-sheet at the start of life, and the attributes that got maxxed out for me have enabled very cool and lucrative career in IT and then video games. The flipside is that some of my attributes are very low and in need of buffs. But given we do not get to re-roll our dice on this, I am just trying to deal with the fact that I will never be someone with a big long list of employees or business partners. Thats never going to work out for me, or for them. I am not easy to deal with.

So here we are, with me managing investments in things instead of a larger games business. I still *make* games, but its just me, using stock bought art, or AI generated art, and even re-using music from a previous game. Its what maximises the fun for me, and minimises the stress. It does mean however, that I have a side-line in fussing with investing the money that my company made. And I did *try* to invest in in tangible things. I built a solar farm! (and may build another), but in the meantime I am invested in about 50 different companies/bonds/funds/trusts, and that takes a lot of time to manage.

I’ve made money, I’ve lost money, and everything inbetween. I made a killing on Tesla stock before he went mad, then a similar killing on Nvidia before Jensen started talking about spaceborne data-centers and financing their customers. I’ve had some big misses too. My bets on Chinese EV manufacturers ran into issues with a china price-war. I am still trying to wait that one out… But the reason I thought I would write about it is that I have used LLMs a LOT in deciding where and how to invest and it is AMAZING.

In a prior life, I worked for a company called Datastream/ICV, which was a stock market data IT company that provided research material and real time market information via satelite to stockbrokers and banks. It was really interesting. Because I tended to support the legacy datastream stuff, I went to a lot of the research offices for the big banks. These were not ‘wolf of wall street’ offices, but more boring, muc quieter rooms full of dozens of serious looking people reading financial reports, reading the news, reading in depth technical analysis… and then eventually preparing reports and summaries so that the actual traders could have some insight into if a company was over/under valued.

It was a lot of work, and clearly very important, and clearly had a good ROI.

And now its almost all irrelevant.

Talking to Claude/Mythos about financial stuff is a revelation. Its SO GOOD at this stuff. All the headlines focus on its unusually good cybersecurity capabilities, but I think thats just because it makes a scary headline. Hearing that 50,000 financial analysts may lose their jobs over the next year isn’t as sexy as Chinese Hackers blowing up the pentagon using their keyboards. I think anybody who has sat and had a long conversation with Claude about whether investment A is better than B, (and why, and what the potential risks were, and what dates to watch, and if your personal investment thesis on that stock holds up to scrutiny) will come away thinking ‘holy fuck this is good stuff’.

I know a TON of really skeptical people who think AI is useless. Almost always they have tried ChatGPT3 a few times, or read a free Gemini summary and think ‘they know all about it’. But a decent LLM is NOT a search engine. Its a research assistant. And when you treat it like that, its incredible. And sure, hallucinations are not solved, and AI can make mistakes. And Claude will make mistakes, but its still, in my experience, an order of magnitude better than any financial website / forum / discord that you can find.

Have you ever actually tried READING an article on Seeking Alpha or TipRanks? The web is not exactly filled with well argued deep impartial analysis on investment topics. Its a trainwreck of hype, clickbait and poorly-informed bullshit. And sure, if you read 25 articles about lithium prices, you *will* at the end of it have some proper understanding of whats going on, but you will wade trough so much nonsense to get there, that it makes perfect sense why the traders farmed all that out to the people in the research room.

Claude will do the same job, reading those 25 articles, searching for deeper context where those articles micht give conflicting data, search further on any topics raised by those articles, then compile it into a concise but pretty accurate report on the topic you asked about. Its especially good at answering the question “If I invest in this specific stock/fund, what am I really betting on here?”. Claude has convinced me to sell a bunch of investments I thought I understood well, but did not. Its recommendation have been extremely extremely good .

I am not a financial advisor, but I’m also not a guy trying to sell you anything. I’m just writing this to share my experience. If you have a pension, or savings and investments and feel unsure if you are invested in the right thing, then I strongly recommend just talking to a PAID premium SOTA LLM and asking it to push back on your choices. And yes, you can just say “DO not patronize me or tell me I am clever, give it to me straight” and they do. In fact I may have gone overboard with these instructions to Claude, which often says things like “Cliff, you are making the same strategic mistake here we have discussed many times before”. I find it kinda funny.

Anyway, give it a go. Its great at this stuff, and WAY better than that bloke in the pub who thinks he knows all about the markets. Even if that bloke is me :D.

New Ridiculous Space Battles Trailer

Well its been a while since I did one. Here is the latest one. let me know what you think. Is it too slow? is it too long? Does it look ok? YouTube compression sucks, even after uploading an 800MB files for a 2.5minute video, it still mangles it. FFS.

New battle video from Ridiculous Space Battles

I have actually still been working on my game all this time, but have been a bit distracted with some technical stuff, and life diversions, and also not feeling there was much of a visual change to show off, but enough is enough, and I thought I’d just quickly throw together a short 2 minute campaign battle video to show you the current state of the game.

For those new to this blog, Ridiculous Space Battles is my ‘spiritual successor’ to ‘Gratuitous Space Battles’ which I made around 2011. I’ve really enjoyed working on it, and I think its better in every way. Here is the video of a battle I quickly filmed and slung onto youtube:

The thing some people do *not* like, is that ships fight in fixed formations, basically in ‘lanes’, and some people who loved GSB dislike this change. Personally I find it to be vastly *better* and makes the battles feel more cinematic and more like an old school naval battle, than the ‘random scrum’ that many large-scale battle games descend into.

I should point out this is battle #4 in the campaign, using a mixture of ships that survived the previous battles, and some reinforcements. Its a fairly small battle. I am not sure I am happy with the contrast of the background nebula, but obviously this is a work in progress. Anyway, I’m quite proud of the general space laser mayhem :D. If you are interested in the game, you should add it to your wish-list on steam using the link below. It will also hopefully make it to GoG. But not epic or other stores. And only on PC. Fuck apple :D.

Another solar farm visit!

So it was an actual predictably dry day today, which is awesome because it means I got to go visit my lovely solar farm in good weather! I also met someone local there and gave them a quick tour, which was cool. Its a LONG day, starting when we leave my house at 8AM, and getting home about 7.30PM, with the majority of it being driving (in an EV obviously :)). We also stopped off briefly for coffee and cake at a nice English Heritage house we had never been to before, which made the day a bit more varied.

I especially like this picture:

You cannot see the whole farm without a drone, but that gives you a rough idea. One very cool thing in this photo is the grass. Its really low, because until very recently it was full of sheep! I’ve blogged about how this is a win-win before. The sheep were very present today, but not actually in the field this time, which means less treacherous walking for us. It was also a super sunny day. I also spotted this:

I am not even sure what is going on there, I shall enquire, but this is just one panel out of 3,024 that is…discoloured? Its almost like a manufacturing error where a coating got missed, or something weird has happened. Certainly not something I have ever noticed before. Unlike a home setup with optimisers, we do not have panel-level data, because 3,024 optimisers plus cabling really adds up, and new panels are only like £80 anyway (and we have some spares). For all I know this panel is fine, or maybe its a total dud, we just do not know, but worth keeping an eye on.

It was quite pleasing to spot this:

Its not massively visible in a photo but this is basically a line of tiny trees / hedge that was required as part of our planning permission. This was apparently super justified to shield the horrors of our renewable energy project from the vast mass of people living in housing on that hill who might otherwise have their lives ruined by seeing it.

That was a joke. There are no houses, try zooming in. Yes its ludicrous, yes they made it a requirement anyway, yes it cost money, yes that eventually ends up on your energy bills. Angry yet? Anyway, I am trying not to rant too much as I love my solar farm and its really good to go see it. The thing I was worried about, and actually didn’t need to was the cleanliness of the panels. They are yet to be cleaned and they look PERFECT. So the self-cleaning nature of British rain really does work in this location. Excellent. I am now sure even bi-annual cleaning is not required. Even if its every 3 years, that’s not too bad. The profitability of the site is very low, so any cost that crops up each year really hurts it. Its not a financially-motivated project, but I would prefer not to LOSE money!

Also I should point out that the stats on the solis (inverter manufacturer) website now show my site as having been the equivalent of planting 1,000 trees and has saved 1,820 tons of CO2. In other terms that avoided 782 tons of coal being burned. Pretty cool. All of this will seem even cooler when the current BROKEN inverter gets replaced (Not impressed by solis TBH), and we are at 100% capacity and not stuck at 90%. Grrrr,

Building a deterministic space auto-battler

This was not part of the plan. When I made Gratuitous Space Battles, it was not a deterministic sim. Multiple runs of a battle could lead to slightly different results. It was not ideal. And I was not even thinking about it with Ridiculous Space Battles, until I started to do balance testing and started designing campaign levels. And in that testing I started to really appreciate how infuriating a lack of determinism was. That was more than a week ago. Maybe two weeks…

To explain: Ideally if you do two battles in RSB with the exact same deployments, you should get the same result. Not just victory or defeat, but the exact same score. This is is the whole core of the game. The smaller the fleet you win with, the more points you score. So running the whole battle again with just ONE less squadron, is definitely worth it for the meta-game (and bragging rights). But that might mean fielding 99 squads instead of 100. In other words, the game has to be accurate down to that 1%, and actually that means 100% deterministic.

Here is the problem. A missile fired from a frigate drifts 0.0001 units to the left compared to the previous run-through. That means it actually hits its target VERY slightly later, but that ‘later’ means just *after* its target fires its massive mega-gun that takes out a crucial enemy cruiser. Without that cruiser, the fleet will narrowly lose. With it, the fleet will narrowly win. So that missile MUST hit its target in the exact same frame, every time…

…and its worse. That missile might even be a dummy missile. It might even miss! it does not matter. Because in theory that 0.0001 units means its the nearest target for a point defense laser, or not. That could still lead to a chain of events that results in the whole outcome of the battle being changed. In practice, if you want the outcome of a big battle to be predictable, and repeatable you need a 100% deterministic simulation. Thats not 99.99999% deterministic. Its absolutely 100%. And that is… hard.

I’m not a n00b coder. I know this problem is hard, AND I know in theory how to avoid it. Have a constant simulation rate, and detach the frame rate from the sim rate. Do not use any truly random numbers, but precalculated ones based on a fixed random seed. You can use true randoms for UI, but never for the sim. The sim is the sim. The UI is the UI. They never get confused. Simple right? And I am sure coders who haven’t worked on it before already think its an afternoon’s work. It is not!

It would have been WAY easier if I had worried about this right at the start of coding the game, but I did not, and so I had to take a huge existing game and MAKE it deterministic, and its taken weeks and I’m not yet 100% sure I’ve cracked it. I have definitely made it much better, but am I at 99.99999% or 100%? Lots of testing tomorrow will answer that for me. But briefly, this is what was involved:

Step 1 was to move from a variable frame rate (capped at 60 fps) to a dual system where the sim runs at a constant interval, but the frame rate is independent. This is complicated by the fact that the game has 5 speeds, from 1/4 speed to 4x speed. Actually to be fair this part of the work was quick and easy. I still have a ton of macros in the code referring to SIMTIME that actually should now just be ‘4.0f’, but thats the beauty of macros. There was a fair bit of find/replace to change a lot of calls in the code to either use SIMTIME or FRAMETIME, but that was simple. Now every tick assumes 4ms has passed, and the ratio of ticks to frames simply depends on the current game speed. This does mean I have kind of lost the ‘frame-smoothing’ for when the GPU is under more or less strain, but TBH the game runs so fast its ludicrous anyway, and for super low spec GPUs the game has a ton of graphics detail settings.

So that sim/graphics decouple was a big step, and an easy step, but after that the real problems began. Basically there were mistakes somewhere in the code. There were circumstances where things drifted out of synch, and it took a ton of detective work to find them all. Things went much quicker when I realised there was no escaping just writing a big ‘Determinism’ class that analysed data across two runs. I made a ton of mistakes here, and they are stupid, but thats coding for you :D. The most embarrassing one was this: I collected a TON of information for every tick, in huge arrays, and then on the second playthrough, I built a second bunch of arrays and kept cross checking them to spot errors. Sounds reasonable right?

Firstly like a muppet, I was checking for ‘drift’ of values every frame, but storing all this data a second time. Stupid. I only need the PREVIOUS playthrough’s data. I just need to collect *this* frames data, and compare against the past. But thats a ‘current-frame’ snapshot. I don’t need to store that! Secondly I was stupidly searching for a matching tick’s data in the previous playthrough. Madness. I KNOW what tick we are on. I can just index it, and do a super quick compare ffs…

You might think thats stupid worrying about optimisation in pure-debug code…but this is a 32 bit app, so limited to 2GB (or maybe 4GB depending on settings), and although my game stays nicely at about 6-700MB, storing 80,000 frames of simulation data for every ship, missile, drone, mine and bullet very rapidly hits that limit. I needed super comprehensive simulation snapshots, but memory-efficient ones. This proved tricky. You might think ‘store everything’ but trust me, its just NOT an option for a long, large battle with this level of complexity and 240 ticks a second (60fps but possibly 1/4 speed so 240 sim ticks per second).

Oh BTW if you think ‘cliff that’s dumb. At 4x speed you still only need 1 tick, just make it a tick thats 4x as long’. NO. This is because in code, a missile moves every tick. If it hits the target, stuff happens then, and in the following ticks. If you bundle 4 ticks into 1, then the missile ‘hits’, but nothing else, whereas it may hit in tick 1, and then ticks 2,3,4 the affected shield slowly regenerates. In other words my sim is discrete tick based, not variable time equation based. Its just simpler this way :D.

So what other really stupid mistakes took me days to sort out? Well they are all kinda dumb, but in a code-base this big, I think I should cut myself some slack. And actually in TWO of the big cases, in the back of my mind I knew as I coded them that they were flaky as hell. Normally my code is VERY cleanly split between simulation and graphics. In fact all my classes are called SIM_Thing or GUI_Thing, to make that super clear, and make sure I don’t do anything dumb like change the sim from the GUI, which would be really bad software engineering that obviously I shouldn’t do and obviously I did in two places :D.

The first one was a bit obscure. When ships ‘escape’ the battle, they quickly zap off the screen like they are entering hyperspace. To make it seem cool, every ship zaps-away at a slightly different speed, because then it looks like the rebel fleet going into hyperspace in return of the jedi… And thats all well and cool, but it used a proper random number in the GUI code, and at the end of the warp-jump, it then told the SIM the ship had escaped at last… What terrible code. This was the GUI setting times for the SIM. Madness. And a determinism destroying bug. Very rarely that extra 50ms was long enough for an enemy ship to get just one extra enemy-destroying shot off…

The second one is even more obscure. I have classic graphics-distorting shockwaves when big ships explode. They look cool, AND they also move debris, hulks, escapepods and (it turns out) missiles, slightly in space as the ‘wave front’ hits them. I coded this with the GUI determining what SIM objects to move when… because it was way easier. I know in the GUI code the radius of the shockwave, so I can detect anything I need to move in the GUI code, and apply a physics force to them. The trouble is…thats the GUI lecturing the sim again, and because speeds can vary we cannot ensure the sim tick / frame rate ratio, which means in one playthrough a shockwave moves a missile maybe 4ms before another playthrough, and that tiny difference is determinism-destroying. For now, I just stopped missiles reacting to shockwaves. The rest is just UI and doesn’t matter.

So thats where I am now. I have run 6 consecutive tests on 2 different (smallish) levels, and its 100% deterministic. It was HARD. All the mistakes were dumb ones by me, which is basically the definition of coding alone. It took a lot of detective work, and really focusing on the very first deviation from known values to track it all down. (There were many other minor causes). One of the side effects of working so hard on all this is that it really has reminded me how much I love the TV show devs. Which if you have never watched… why the hell not?