Friday 27th March, 2020

On Monday evening, the UK government took the unprecedented approach of telling everyone to stay in their homes, to only make essential journeys outside to collect food, medical supplies, or to help the vulnerable, to absolutely work from home wherever possible. The country is in lock down. I’m writing this not because this blog is going to become a daily account of life under quarantine (it might a little bit), but just to set the scene a little. I am at home. I’m working from home. I haven’t left the house since Monday, and only then briefly and keeping social distance — I got home just hours before the government announced the new rules. Working from home is actually going really well; the worst part of the job is the commute.

On Tuesday Belghast, a blogging hero of mine, announced Blapril, an update of the annual Blaugust event, which asks bloggers to try and publish every day throughout August, while supporting each other and newbie bloggers along the way. With much of the world sat at home, isolated, it seems like a nice idea to bring that forward to April and spread a little internet love; the Blaugust community is a fantastic little corner of the sometimes creepy Internet. So I’m going to take up the challenge. If you’ve been thinking about setting up a blog, or have one that could with some TLC, this is an ideal opportunity and I’d be happy to offer any help, advice or encouragement you might need!

I set this blog up to document my progress in writing BONES of the LOST GOD, a little web game that mutated from an idle/incremental RPG into something more akin to a semi-traditional roguelike. That project still exists, but it’s no longer a burning daily passion, and so the blog had started to lie fallow. Going back to work full time more-or-less killed any desire to work on it as my schedule and energy levels shifted into a new normal, which is exactly what I thought might happen.

Instead of tossing everything away, as I may have done in the past, instead I’m re-branding this blog to be more multi-functional, and I’ll be posting here about anything and everything that catches my eye. There’ll still be a lot of programming and web development/devops I imagine, but also gaming and reading and weird chunks of internet culture… and how I’m surviving the CORVID-19 apocalypse, I hope. URLs from the old blog should still work, though internally everything should be pointing at my own domain (rumorsmatrix.com) now. Let me know if you find anything broken or odd.

A quick tour of Entity-Components in BotLG

I’ve started working on a better entity system for BotLG. The current code for dealing with entities — monsters, NPCs, things you can interact with in some way — is a bit of a rat’s nest of objects referencing each other, and creating a new monster or NPC means adding references in a half-dozen different places. It’s not ideal.

So, I’ve come up with a new system, using an Entity-Component pattern. There’s one base Entity class, which consists only of a unique identifier and properties for storing location and speed. More specific entities can be created by extending that class, but thanks to the Component system, they don’t really need to be. Components represent a bundle of properties about an entity, and the methods needed for working with them. For example, let’s make a rat.

let boris = new Entity();
boris.name = 'Boris the Rat';

(In actual fact, you wouldn’t make Boris like this. There’s an EntityManager class that creates entities and puts them in to a collection, so the rest of the game knows where to find entities, and the scheduler can loop through them, and so on.)

Now that Boris exists, we can add some components to him. Rats have legs, so they can move. So:

boris.addComponent(new canMove());

The canMove component (all of my components are in the format canDoThing or hasSomeProperty) gives Boris a .move(dx, dy) method, so he can be moved around the map. We should probably also give him some health, and the ability to die from any wounds taken:

boris.addComponent(new hasHealth());
boris.addComponent(new canDie());

Great! This highly modular approach means writing new actions and abilities for entities can be split into much smaller chunks, and entities can share components. It also means I can things like saying; this attack cripples creatures, making them unable to move, so:

boris.removeComponent('canMove');

One slight downside to this implementation is that you might have some code that ends up trying to perform a method call on an entity that doesn’t support it. What would happen if we tried (the hypothetical):

boris.fly(dx, dy);

Well, rats can’t fly. There’s no canFly component, and even if there was, Boris doesn’t have it. There are two options here. Either we wrap every attempt to do something up in a check:

if (boris.hasComponent('canFly')) {
boris.fly(dx, dy);
}

or we take advantage of the .try() method that every Entity has:

boris.try('fly', [dx, fy]);

Monday 9th February, 2020

Picture unrelated to current mental state, honest. It is a great movie, though.

Keen readers — I’m sure I must have at least one — will notice I didn’t post over the weekend, ending my daily run of, I don’t know, about a month. I kind of regret that now, but I felt like I really had nothing to say and zero enthusiasm to say it with.

I did the tiniest amount of work on BotLG tonight, just a quick redesign of the front page (which is still sat in the dev branch, so you can’t even see it). Now that I’m back at work full-time, I’m struggling to work on it once I get home, again. What I really need to do is resolve to do something every day, regardless of how tired I feel or how much I just want to flop onto the couch and watch Chef (my current TV obsession).

In other blog news, I’ve continued to work steadily through the archives of Jez Higgins’ blog during my commute. It’s really great, especially if you enjoy programming, gymnastics, cycling, and statistics about ice cream vans. Some of those things apply to me, for sure.

Friday 6th March, 2020

I’ve been looking around for a system to base combat on for BotLG. My natural instinct is to go to tabletop RPGs, where I’ve considered Dungeons & Dragons (Advanced, 4th Edition, and the Labyrinth Lord retroclone), Maze Rats, Knave, Risus… None of them really fit, though I was excited about Knave and 4e for a while.

The problem with tabletop RPGs (for my current purposes) is that they’re balanced around a party of players, or not much balanced at all, depending on the era. I need a single player character to be able to hold their own, and not have to fight lowly mooks for hours on end.

Of course, I could tweak the maths. Smooth out some bonuses here, pump up the players stats a little, make the monsters a bit less threatening… but by the time I’ve done that, I may as well have written my own system. Which is what I’m leaning towards, but which I really don’t want to have to do, because balancing it will be a right pain. Ah, well.

Just in a whim, I looked up how the mechanics of Final Fantasy I work, and found this extensive document. The answer is, of course, that Final Fantasy I barely works. Even the later re-releases don’t even patch it up that well, leaving hilarious bugs like one of the main stats having no purpose, weapons that don’t do what they say they do, monsters who cast the wrong spells, and useless status effects that dont… affect your status.

Perhaps when I’m writing my own terribly unbalanced and buggy games, I can take some comfort from that.

Thursday 5th March, 2020

It looks like LetsEncrypt looked at the vast amount of the Internet that would break when they go on their epic certificate revoking spree and got cold feet:

“Unfortunately, we believe it’s likely that more than one million certificates will not be replaced before the compliance deadline for revocation is upon us at March 5 19:00 PT (03:00 UTC, 21:00 US EST). […] Rather than potentially break so many sites and cause concern for their visitors, we have determined that it is in the best interest of the health of the Internet for us to not revoke those certificates by the deadline.

Let’s Encrypt: OK, maybe nuking three million HTTPS certs at once was a tad ambitious

Fair enough. I mean, they need revoking, but perhaps a less bull-in-a-china-shop approach would have some value.

I’ve been playing Pathos on my phone, a nethack variant which just received a new update. It’s really good, and the developer has done a great job of making the controls work well on mobile; big context sensitive buttons, and a click-to-move map that’s not too fiddly but still shows enough of the level at once to be useful. Obviously, it’s all very inspiring stuff; I’ve been toying with the idea of dumping mobile support for BotLG, but it might be worth persevering with. There’s so few mobile games that I enjoy, it’d be nice if my own game was one of them.

Wednesday 4th March, 2020

Just a quick one today, because I haven’t done anything of note today. I’m getting settled in at work. I’m somehow watching episodes of Time Team on my lunch hour, because I am becoming a parody of myself.

Yesterday I got all het up again about the sorrowful state of the world wide web and ended up tweeting about how everyone should have their own webpage. I really believe that. Walled gardens are not good for the web, just like Chromium taking over the browser ecosystem is not good for the web. I asked my followers to tell me if they had a site or a blog, because I genuinely want to read them, to see what’s going on out there. I got a couple of replies, and so I’ve started reading Jez Higgins’ blog, which I’m enjoying a lot.

I think that’s all for now.

Entities, components, actions and certificates

Saw this article about LetsEncrypt, the service I use to get my HTTPS certificates, accidentally revoking millions of certificates… and then noticed the email from them in my inbox informing me that they’re very sorry, but all of my domains are affected.

On Wednesday, March 4, Let’s Encrypt – the free, automated digital certificate authority – will briefly become Let’s Revoke, to undo the issuance of more than three million flawed HTTPS certs.

The Register: Let’s Encrypt? Let’s revoke 3 million HTTPS certificates on Wednesday

Luckily fixing it was as simple as SSH’ing into my server and running certbot renew –force-renewal, so it was no great emergency. Still, I imagine tomorrow a whole swathe of domains across the internet will be suddenly insecure and promoting browser warnings all over the place.

In roguelike development news, I for some work done on the new Entity/Component/Actions system I’m going to be using for BotLG.

So far I’m really pleased with it. Soon I’ll begin putting it into the BotLG codebase and converting the existing game verbs over. It’s so much cleaner and easier to expand than the current entity/NPC system.

Monday 2nd March, 2020

Today was my first day back at work, and it went pretty well. Got my desk and computer set up, and then did a couple of easy jobs before a little meeting in the afternoon to go through the jobs board and discuss what I’ll be working on next. It looks like I’m going to be doing a Bing advertising API upgrade, taking some code that wraps an older version of the Bing API and bringing it up to date. I see lots of messing about with OAuth and the Azure system in my future…

I’m also getting excited about the future of BotLG. I’m going to make the maps larger, and may use a smaller tile size to really capitalise on using all the screen real estate. I’ve started writing a little bit of code based on an earlier project that worked well, using components to grant entities various permissions and abilities. Really happy to be writing a proper roguelike now.

Back to Work

Tomorrow, I go back to work. I’ve been off for 140 days, and in that time I’ve written the majority of a game that I’m pretty pleased with. I’ve got so much better at JavaScript, and I’ve learnt a lot about managing a large JS project. I’ve also watched and listened to a lot of YouTube.

I’ve packed up a bag with a new pot-plant for my desk and my favourite mechanical keyboard, and I’ve put my noise-cancelling headphones on to charge. It’s time to go do some devops again, and I’m looking forward to it.

Saturday 29th February, 2020

After spending most of the day thinking about it off-and-on, I’ve finally come to the conclusion that yes, I am going to give BotLG a bit of a re-write and tidy up, and hopefully snag a few new features that I feel it’s lacking. I’m also going to give in and lean heavily into the roguelike aspect. It is a roguelike. It’s not very idle/incremental any more.

The main things I want to work on are implementing an Entity-Component system, and adding in a Command design pattern for actions, both of which I’ve played around with in a Javascript/roguelike context before. It sounds like a lot of rewriting, but actually I don’t think it’ll be too bad. Most of the existing actions (movement, harvesting resources, talking to NPCs etc.) are already written in such a way that porting them over to be standalone Action objects won’t be much work, and the end result should be a much cleaner code base.

Yes, iterate on architecture endlessly

Danny “Austerity” Nissenfeld

Plus, you know, it’s the journey, not the destination, right? This is my big grand project, and I’m going to be working on it forever. I might as well set myself grand goals and please myself. Along the way, I’m hoping this means I get to add a few more things that I feel I’ve missed out on, like procedurally generated items, and dungeons that are persistent between sessions. Maybe even a bit of multiplayer, if I’m really dreaming big. Who knows, eh?