This week I’ve been recovering from my recent thrilling illness, and made a load of progress on the AI for castles, fixing a ton of new AI bugs discovered in the interim, and some other small changes that I wanted to implement. Alas, my week of illness has pushed things back just a tad, but I’m actually still hoping to release the playtesting release next week. It’s going to be close, but my intention is to really focus on URR for the next week and try to get it out next weekend – there aren’t any academic deadlines in the next seven days or so, and those which are a little further past that I’ve made good progress on already, so I’m cautiously optimistic that it might be possible. I still haven’t decided whether to make it public or private (I know, I know…) but I guess I’ll have to decide soon enough. Probably private, though. Either way, here’s a very image- and gif-filled update for you all!
Almost all the AI requirements for castles are now done. As I mentioned last week, this was quite an easy and enjoyable part of AI programming, both because a large part was already done for all the involved NPCs and because castles are just very interesting spaces I enjoy moving around and exploring (even as their designer). The stuff that still needed doing after our previous update was to ensure that all guard exchanges work correctly (which they do, almost entirely), that monks behave in a sensible way (they do), that everyone goes to a logical bed when they turn in for the night, which is surprisingly tricky in a building with so many beds on so many floors (I think they do). As with everything else, this should work regardless of the player’s actions going in/out of the map grid, leaving the building unspawned, spawning the building, etc. Therefore, here are some screenshots.
Monks awakening for the day and moving around the castle:
A guard switch-over when the castle itself has not been spawned; although some of the colours here make it slightly tricky to see at times (I’m still trying to figure out a solution), I love the complexity of this dance as all the conscripts (“6”) and guards (“g”) exit the castle and exchange places with their comrades, before going back inside. In a later version the timings will be varied a little, of course, so that they don’t all appear at the same time, but for the time being this is more than adequate (and does look pretty cool!).
Here we have a bunch of knights guarding the throne room switching places. Sorry for the laggy parts of this gif – there was a lot of debugging stuff going on in the background which slowed it down every now and then.
In a slaving nation, we have several slaves in a castle going about their day and maintaining upkeep of the great hall; this was the same civilization as all the above gifs. A few minor issues arose here with behaviour that had been coded for mansions and manors not quite working perfectly for castles, but I’m pretty confident that’s all resolved now.
Three debugging images of a generated castle with the NPCs placed within it, and where they start. C = conscript, g = guard, K = knight, s = slave, M = monk. They normally start at their guarding locations or their beds, and then start moving as soon as they’re spawned by the player entering the castle.
Monasteries have been successfully simplified for this release – abbots and monks now behave entirely indoors within the monastery, rather than venturing outside into the vegetable garden and the religious building at the core of the complex, and thereby causing all manner of confusion. Here we have some monks going to bed and already in bed, and then for reasons unknown I go for a wander into the next part of the monastery before ending the recording…
Lots of fun bugs!
Firstly, something started crashing when I entered inns. It turned out that this was because of a slight typo I’d made in a line of code handling the decisions of important NPCs that accidentally scooped up a particular subset of non-important NPCs (e.g. those who can do their thing in taverns) and caused the game to implode. This wasn’t too tricky to fix once I found the line of code, although it took a fair bit of hunting down. Secondly, we had a bug involving the middle courtyards of castles (see below) which resulted in the player, upon leaving them, sometimes being transported onto the roof of the castle instead of correctly settling into the courtyard. This has also been fixed. Thirdly, we had another bug that caused certain categories of NPCs to duplicate themselves under extremely rare circumstances with the player’s movement and their spawning/non-spawning of buildings at various times in the player’s movement schedule, and this caused a bunch of problems with the clone NPCs overlapping in their schedules, or only doing half of their schedule, or all kinds of strange things. I figured out what the particular permutation was, and dealt with it. Fourthly, I ran into a bunch of problems with soldiers, conscripts and knights attempting to use the code designed for guards (since when guarding, the game should just treat them the same as guards) which needed fixing in a laborious but not massively challenging process, which basically entailed adding [‘Soldier’,’Conscript’,’Knight’] to almost every line of code with ‘Guard’ in it.
Lastly, I discovered a rather fantastic bug whereby guards and conscripts and suchlike inside a castle, who were trying to path outside a castle in order to relieve their comrades, would sometimes path to the internal doors in a castle (if that castle has an external courtyard) and would emerge into the courtyard, not have any idea how to path to their guard partners (despite being outside, and therefore supposedly able to path), and then for reasons I’m not entirely clear on, they would insert themselves into the door (see picture below) and sit there until I noticed them. This has only happened once, because I resolved it immediately after, but I really have no idea how they put themselves into the door. I guess it’s just one of those mysteries.
I also made a range of other minor changes this week in preparation for the interim playtesting release. Firstly, I removed the stat bars from the bottom of the screen, and the stats from the windows on the left of the screen. Those are almost certainly going to need updating/changing in the future, but for now, they’ve just distracting, especially as the game’s current stage is fully about exploration and (once 0.8 is out) talking to people. I’ve also made some minor changes to a bunch of flavour text here and there, primarily relating to travel and the player’s movement in the world, and changed a bunch of things relating to the wording of various items and features and terrain types and the like, as well as clarifying a few mechanics points, keypresses, etc. Naturally my focus is on the AI for the playtesting release, but I want to make it at least a reasonably streamlined experience for the playtesters!
All that needs doing is finishing off castle AI, which is mostly done already. Next week will be the last AI update for 0.8, and hopefully the interim playtesting release. Finally!