My new DevRig lost an NVme drive on Saturday, which then miraculously re-appeared this morning. I suspect the mobo is dodgy, as I’ve also lost a USB-C port. Explains the bluescreens I’ve been getting, so I’ll have to send it back for some fettling. Annoyingly, I don’t have the box, it was just too big to store anywhere, so I need to organise for a new one to be shipped out.
Bit unlucky, but it’s the first dodgy HW I’ve had in a long time, so I’m probably overdue.
The day wasn’t a write off – I have SSDs and backups for a reason – but in the excitement I forgot that I was supposed to be working on the save state, and did a load of assets for the Crone’s campfire instead. It’s a little visual gag that I think helps set the tone.
And then I remembered! So now the overworld saves and loads its state and sets objects correctly. Woo!
The free-roam game mode also needs to unlock the world. I’ve made a note to go back in and fix that.
Ordered a box for my PC so I’ll be able to return it. I’m flip/flopping between suspecting the drives and the mobo, as NTFS was bluescreening today. I’m secretly hoping that they replace both…
I didn’t sleep particularly well last night, so coding was a bit beyond my fuzzy-head. Opted for some tart, instead: made a wig and set of clothing materials for the last placeholder NPC in the initial experience. Hair was done in Zbrush, Retopo’d in Blender and Substance Painter for the texture. It doesn’t look amazing, but you know, it’s hair, it’ll do.
I’ve wanted to add little garden (mud) patches to houses for ages, but never got around to it, so I made a new material in Substance designer.
Played the build again, as a bit of a chill out, and it put a smile on my face. Found a few bugs, though.
I’ve been idly looking around for something a little nicer than Behaviour Trees for my AI needs. On Lumo it was Finite State Machines all the way down. FSMs are nice enough, easy to grok – I teach them to my students – and pretty simple to debug, but now I’ve made a couple of games leaning on them heavily I’ve noticed that they force me into specific patterns, and I’m writing a lot of the same sort of code, again and again, across slightly different things in-game. They do fit into Unity’s MonoBehaviour framework easily, though…
It’s been fun trawling through all the options (and AI buzzwords), but in the end I didn’t have to dig very deep to find something I liked. UtilityAI popped up very quicky and immediately became a brain worm. That’s the best possibly sign for me.
The general idea is that an NPC can have a list of possible actions. Each action has a score, or “Utility Value”, which is constantly re-computed. The “Brain” polls the actions, looking for the one with the highest score, and lets it run, essentially giving the “best” action the control over the NPC.
Why does this appeal to me?
Deriving actions is simple, and the action is self-contained. One BP can have nearly everything in it; the scoring mechanism, the understanding of the world, and the Tick that makes the NPC actually do stuff.
The “Brain” is even simpler, it cares about the current action, and if anything has a higher score.
Which, in theory, means all this is simple to build and should be simple for me to debug.
The trick is obviously going to be giving good, sane values to each action, and balancing them at runtime, but I’m not going to get a feel for that until I’ve implemented and had a play around…
Today I got the base classes for the system roughly in place. The “Brain” is an actor component, attached to a Pawn. When the component ticks, it checks all actions to get the current scores, and changes action if required. It then Ticks the “current” action, allowing it to do whatever it wants to the Pawn…
Actions are simple UObjects, with a few functions for managing their lifetime (they can kill themselves) and a big empty hole for derived classes to do some score calculation and then, ultimately, control the Pawn.
None of this is tested yet, but it’s compiling, so you know, I can pretend that it’s working.
If you want more info about UtilityAI, here’re some useful links for you:
There's also a Wikipedia Page!
Was teaching this morning. Got a bit done in the afternoon:
I started testing the AI scaffold from yesterday. It had one bug in it, which I fixed.
A big part of the reason for bouncing off BTs was debugging, so I spent a while making sure I’ve got decent on-screen debug output for this stuff. Meant tinkering with my debug log class, but the end result is great.
The arrows show the score, normalised. As you can see, I've not got real actions in there yet, just some placeholders to make sure the Debug does what I want.
I still need to add this to the Visual Logger, but I’ll do that next week.
Right now I'm off to box up my Rig and get the return organised, then I’m officially OFF for the weekend! It’s my birthday tomorrow, so I’m gonna treat myself to a day off.