Friends, welcome back! Whereas in the past two updates I got most of the tutorial quest done and then finished it off and polished it – so these were both about sustained focus on one single item – this fortnight we have a whole load of small adjustments and improvements and polishes as I try to get everything “lined up” for quest generation and the final push towards release, i.e. making sure everything actually works, bug-fixing, and the like. This has mostly involved finishing off the remaining buildings and structures that need to be converted into the new generative system I’ve set up over the past two or three months to enable the game to generate and store data about buildings that haven’t come into existence yet in order to generate logical puzzles and riddles about them, but also some further polishing of the world map clues, further polishing of the journal (at least the 0.11 version!), and actually significantly more progress on the soundtrack as well. The tutorial quest design and refinement has been incredibly exciting and it’s really thrilling for me to see these sorts of aspects finding their way into the game proper, but it’s also important to not let things expand too much where there are loads and loads of different elements of the game that all need a bit of work. I’ve found in the past that such a scenario is really not good for my brain and my ability to keep making real progress at a good pace, so in the last fortnight I’ve been doing a lot of finishing, and a lot of polishing, on various features, in order to tick them off my mental checklist and free up my brain for the final leg of 0.11, i.e. the non-tutorial quest generation (and also finishing the improvements to the conversation system, at least to the extent needed for this release). With the work in this entry done, I’m really pleased with where I now stand and feel the game is behaving really solidly and there’s not much clogging up my brain, so without further ado, let’s get into it:
Taverns
The first place to start this fortnight was in clearing up the final remaining elements of generators which haven’t been totally moved over to the new method, i.e. having all generative elements within a larger dictionary (of over 2000 layouts) so that local map clues can draw on those elements when they need to be created, and these elements will appear correctly as part of pre-emptively setting how some of all aspects of the generation is going to play out. While I made huge progress on this in the last few months, a few tricky buildings still remained that either had not been fully transitioned over, or had been fully transitioned over but weren’t working correctly – and taverns were one of these. It is interesting and telling that most of the few buildings on this list, such as taverns, shops, and barracks, are amongst the very first buildings I ever set to generating in URR. The issue is that these have a fundamentally different system for assigning doors to all the other buildings, and this is a system that just does not work in the new dictionary of generative elements, but must be manually adjusted in each generator to shift it over. Most generators and basically all later buildings have grids of information (where walls are, doors, chairs, tables, etc) which contain fixed doors, and then the game is free to take those grids and rotate or invert them (giving eight permutations in each case). When the interior for a building is constructed, it’ll always match the exterior because the interior grid just has a door on a given tile, and so does the exterior grid, and the rotations and inversions are conserved between both. Taverns, barracks and shops, however, instead have a range of places on their exteriors where a door can be placed, and then that information is transmitted to the function that generates the interior, placing the door in the equivalent place inside. This works just as well, but the issue is that without the door’s location being known beforehand, these buildings then cannot be used for generating clues that might feature the door (as is the case with any other feature). One might say, well, just write some more code to predict that just as all the other elements are being predicted, but unfortunately that would be really quite awkward and difficult compared to the system used for 99% of buildings. As such, much easier to adjust here and place the doors into the generative grids instead of having them placed and maintained through a separate function – even if it takes a bit of effort.
So, for taverns, the first thing was to remove these large sets of possible wall tiles that could be turned into doors, and have far fewer permutations which are known and selected beforehand, just like all the other buildings have. This didn’t take much brain power though it did consume a little bit of time; once this was sorted, the next step was to check how the outside-the-walls abyss terrain spawning works. And, sure enough, it turned out that I hadn’t actually addressed this at all, so these internal maps were generating with a whole load of nonsense behind the walls which the player wouldn’t be able to see under normal circumstances (and thus it didn’t matter until now). This took some time to polish off and adjust in all the relevant generative grids, but soon I had the abyss areas outside the bounds of the building interior correctly generating. With that sorted, I also needed to go and address how some of the staircases in taverns work. There was an old variation here whereby only some kinds of wine cellars could spawn with some kinds of taverns, and that was an extreme relic from the (very) early days of development. There was just no need to add such a limitation, since it didn’t bring anything, and the far more robust systems now in place for handling interior areas mean that it wouldn’t matter in the slightest if the cellar was larger or smaller than the floors above it. This is something taken for granted in many other buildings, but here I had evidently designed taverns long before I developed the universal solution to that problem. A little bit of work later – and ensuring that the abyss generated correctly on cellars, too – and I had a much larger range of cellar generations functioning across all kinds of taverns, as well as all the other fixes required. I was overall happy with how long this took, as this is the first example of my replacing this old door-placement system amongst the few buildings where it’s still present; it takes a moment, but it doesn’t in any way reduce the interest or variety of what the player encounters to any meaningful degree, and lets us move these sorts of buildings into the clue generator. A great success!

Town Mansions and Town Halls
I also dealt with town mansions and town halls in a similar way (these were the next on the list of the remaining buildings to be converted to the new style). The more challenging one here was town mansions, because their original generator had a large number of “offices”, which is my in-code term for elements of a building’s rooms being generated separately from the building itself. The goal of these generators, originally, was to add more variation and difference between buildings, even if they (across multiple districts or multiple towns, for example) had the exact same shape and type across an entire nation. This was a worthy objective and the way I went about it achieved this objective perfectly well, but it became apparent that maintaining this system into the new generative system was going to be a tremendously complicated and confusing amount of work – and one that simply wasn’t worth it. As such, with town mansions I had to slightly simplify the generators away from this “office” style and towards larger map grids that can be usefully stored, and drawn on, in the generatorlist list that exists in the game’s code. This took quite a while because I soon discovered town mansions – which is to say, the manor of a lord or earl etc in a nation with the “vassalage” military style, which results in their territory being separated up into counties which each have a seat – actually had the more complex office-generating style (for things like rooms, offices, bedrooms, etc) of any building in the game. I’m not quite sure why I’d originally committed to so much time to something that is ultimately a fairly obscure building type, but I had. A lot of code needed changing here, but I was soon enough able to get all the town mansion elements into the massive generatorlist dictionary, and adjust the generator for those buildings sufficiently to make them actually appear correctly and how I wanted them to. This got another one ticked off the list, and while the generator for the interiors of these buildings is technically slightly simplified by this process, it’s not to an extent anyone would ever notice (I think), and enables me to use their interiors for clue generation further down the line. Around the same time I did the equivalent for town halls (which spawn in all other towns that don’t have mansions in them, i.e. for all the other possible policies) and these were much easier, requiring only a little bit to time to ensure that they were once again generating correctly in the new style, and importantly, that they had all the required “abyss” tiles outside them (which might be called on to appear in a local map clue, i.e. highlighting what is inside a building and what is outside that building). These were both a fair bit of work between them, but these ticked two more buildings off the (rapidly shortening) list.


Crypts
Now this was a tricky one. I’m really, really happy with how crypts generate, as they aren’t too difficult to navigate but they can reach quite a substantial size, and by virtue of containing sarcophagi, they’re amongst the most unique places in the game. I’m really looking forward to setting riddles in these areas, but the problem – as with all the other buildings – is that the interior maps didn’t correctly spawn with abyss tiles outside the actual walkable areas of the crypt itself (see the first picture below). This meant, as ever, that local map clues might generate that show seemingly walkable areas outside the actual walkable areas (equivalent to what we’d think of as being “out of bounds” in a 3D game), and that needed fixing. However, crypts have a very unique generator, involving an organic process of selecting grids from large databases and connecting them together via corridors. This is cool and I’m glad I did it, but it does mean that a lot of the code is dependent on assuming that the background tiles which are being replaced by the crypt elements consist of brickwork (i.e. the whole map is filled with brick and then the crypt rooms are “carved out of it”, so to speak), rather than abyss, which is what they need to be. I was quite pleased that I was quite quickly able to make some major progress on moving this along into the new style, but the real problem at this point was the corridors. As you can see in the second image below, the corridors would generate in a way that didn’t have brick work on either side of them – because in the pre-editing version of this generator the whole map begins as brick, and so it only has to carve a tunnel out and not worry about what goes next to it – and this meant you could peer into the abyss between worlds, which was not really ideal. It also affected some of the code that is designed to register where rooms in the crypt’s layout begin and end, since again it makes the assumption of background brick instead of background abyss, and while that might seem like a one-second change, the complexity comes from the fact that the areas being carved out of the brick do themselves contain brick but don’t themselves contain abyss. The original code contained material that could distinguish between background brick and this-is-part-of-a-room brick (even if the player doesn’t need to), but unfortunately that code couldn’t really be reused here without a bit of fiddling about.


So, the solution here was to have the game track each tile it added into the game world as a corridor tile (for starters), which then results in a list of corridor tiles at the end of the crypt area being generated. The game now has a new bit of code to look through these at the end of generation and check whether they have abyss tiles above them, below them, or to their left or right. If any of those are the case, it replaces those abyss tiles with brick tiles instead – thus sealing up the corridors and preventing the player from staring into the abyss! That got that problem solved with reasonably good speed, but, you’ll see another issue in the above example. Each area of the crypt, i.e. each room which ends up being connected to the other rooms, can be connected from the top, bottom, left, or right. We had another issue here, which is that in the previous model these tiles were already brick and thus could just be left brick, without having to do anything with them. In the new model, we need to identify them specifically, find which ones are not connecting to corridors, and block them up, otherwise the player can again peer outside the intended bounds of the interior. In this case I created a second list, and had that list check whether the tile is an abyss tile or not; very simply, if it is by the end of the generation, it blocks them up with brick. I was honestly surprised by how easy these two solutions are given how overall complex this generator is (there’s a lot of code for managing the path of the crypt and ensuring interesting generations), and this didn’t take more than an hour or so all told. As for how this all looks, you’ll see what I’ve described in the first image below where I marked out the corridors (temporarily) as water, and the missing connection tiles as lava, so you can see clearly which tiles it is that needed the extra code to handle. In the second image I’ve added all this new code, and thus the empty connecting tiles, and the corridors, are appropriately sealed up – and with that, crypts are fully adjusted and integrated into the new generator style!


Religious Buildings
And now we come to the hardest by far of this bunch in the last fortnight – religious buildings. I was right in identifying a few issues with how crypts generated under the new regime, though they turned out to not be overly difficult to fix… but the same was not going to be true for religious buildings. As a reminder, these can generate on a “small” size – the everyday church, pagoda, or whatever term might be used for a given religion – or on a “large” size, which is the unique cathedral that each religion has somewhere on the world map. These are generated through selecting a middle section, and then some corner or edge sections, and placing them together (no religion within a given world uses the same core or the same sections, and each core and section in a given shape enjoys a large number of different variations and subsets in order to ensure variation across playthroughs, as well as within a given playthrough). I’d previously discovered that shifting to the abyss had caused Some Interesting Issues with religious building interiors, but I hadn’t given it a full look or assessment since I knew it was going to be quite a bit of work to resolve and get them generating totally correctly again, but in the new style (which again, as I say, enables us to use data for generating riddles before the player actually arrives to generate the location in question – which is the chief benefit of this new approach). I was, unfortunately, correct about the “lots of work” thing. I started off by checking out a random cathedral and producing a debug output of what the map looked like, and I was indeed correct in saying that it looked, er, maybe not completely, entirely right. As I’ve noted before, this was entirely fine before there was a way for the player to – in a sense – “see outside” the map, but once the player can “see outside” a building’s map through clues and maps and all that, we need to make sure that the outside is indeed entirely abyss. Here’s what the debug output for that first cathedral I tried looked like…

…and we can see a number of issues here. Some of the swanky flooring is appearing alongside the abyss, while there is unfortunately no abyss whatsoever being created around the sections or wings of the cathedral, and instead only around the core area. However, happily, this didn’t take too long to resolve, as a little bit of fiddling around the code rather quickly actually produced this instead when I went back and regenerated the same building:

Much better (though you might still notice a handful of extraneous brick tiles which the generator shouldn’t really be placing there – those are leftovers from the generator and represent other places where branches or halls could have been added onto the core of the building, but weren’t in the end). I was pleased to see the small versions also generated successfully in terms of the external abyss, although again with a few minor brick appendices to be resolved with some light tweaking of the generator:

This was all looking rather good, therefore, until I looked at the other kind of religious building, i.e. which connects its wings or extra elements at the corners of the main structure, rather than at the edges. This, unfortunately, yielded this:

…which obviously gave people a very good view indeed into the void. This one was much trickier to sort out due to how the additional pieces slot into the existing structure within these contexts, but I ended up basically having the game figure out how many of the corner tiles of the corner structure are overlapping with what’s already there, ignore those, and then just void everything else. This took some finagling to ensure it wasn’t producing too much abyss or too little, and it always looked logical and maintained a walkable path for the player (and/or any other NPC) to traverse, but soon yielded this:

Having double-checked that none of that code had knackered the other religious buildings (with the side-on additions instead of the corner additions), and indeed it hadn’t, I then went to check another, and found this:

…which then demanded further work to ensure that the connecting tile is always correctly added as a wall tile instead of potentially being left rather unhelpfully open. This again, though, didn’t take a great deal of time, and thus fixed the above example too:

With those done, I went to check a cathedral for the corner attachment type. This had the same issue, but to a lesser degree…

…and the same sort of technique worked to get those correctly filled in as they should be:

And there we go! Religious buildings of both types (the side additions and the corner additions) now appear to be correctly sorted out and handled, and successfully transitioned into the new generative style (and thus available for the creation of riddles). Really happy with this bit of progress, and it’s so nice to have another major building type ticked off the list here.
Sphinx-Houses
I also went back and reworked sphinx-houses. These are going to be locations where you can receive a number of tricky riddles that require you to bring certain items there, or perform certain items within that location – or some combination of the above – which will probably yield pretty powerful and useful rewards. The insides of the sphinx-houses I think look perfectly good at the moment, with a special floor type graphic and the actual sphinx statues themselves (which I think are pretty cool), but the outsides were very generic, being just a bunch of square-shaped buildings without much detail around them. This meant we had two issues to resolve: firstly I wanted to make sure that they always had an appropriate shape for the civilization they were in (and this should include nomadic and tribal / soon-to-be-ancient civilizations as well as the feudal or sedentary ones, which means a grand total of thirteen possible shape preferences), and they should also have more exciting and interesting exteriors in order to give at least a degree of a sense that these are important places. I didn’t want to make the outsides too grand, as that implies that they are well-maintained and actively visited rather than ancient places, but I felt we still needed something on the outside beyond just the bare desert or the bare snow. As such, I spent a few hours implementing a new set of different shapes for sphinx-houses, which I think all came out really well (even if a couple were quite awkward when coming to a relatively small building!), and also adding seven possible exteriors to the sphinx-houses as well when they generate, such as walls, or areas of plants, or cactuses planted around the entrances, or pools of water, or whatever it might be. These aren’t major things but I’m really happy with how they all came out, and temporarily re-enabling their generation within the game world enabled me to test these out and make sure they’re appearing in some really pleasing ways. They won’t be in 0.11 but they were on my list of buildings that weren’t finished / hadn’t been correctly transitioned over to the new generative code, and so I really did want to get them done at the same time as everything else. This was just a satisfying and short task away from the main objectives, and really helped to set things up for the future and prevent too much from hanging over me as this process continues.


(Placeholder example of the riddles I want in these, but damn, these will be exciting to generate!)
This then leaves only shops, barracks, and slave quarters that need doing into the new style. These are all, unfortunately, really rather difficult, and pose a number of problems largely due to how the doors generate like I talked about before, but in other ways as well – for example, with barracks, there might be dozens within a given military district, and they’ll all be essentially the same size and layout, making any kind of distinguishing them really rather tricky. As such, for now, I’m keeping those in the old style, but I’ll be going back in 0.12 to try to figure out what to do here. It’s actually a surprisingly thorny problem, how to best handle these buildings, and I’m not completely sure what my answer is going to be yet. What I do know, though, is that a) it’ll need some pondering, and b) it’s not essential for 0.11, so I’m saying that all buildings have now been successfully transferred to the new system, and that’s enough for this point.
Final Journal Bits
Next, I went back to the journal with the intention of finishing the final remaining component: giving you new information about nations when you encounter them, or encounter aspects of them, and having that register correctly. The same does need to be implemented for religions too, but I’m going to leave that until later; it might or might not find its way into 0.11, but whereas I had 80% of the material for tracking nations implemented into the journal, I have 0% of the tracking religions stuff, so it made sense for me to finish the former, call that done, and then only if I have time/inclination later, add religions in there. Anyway – the point is that this is now done. Existing code which used to be used to fill up your encyclopedia by registering what you have and have not encountered has now been repurposed to fill out this part of your journal instead, adding an entry for a new nation for the first time when you encounter it, and then fleshing it out more the more you discover. Later on, as I’ve mentioned before, these pages will also tell you things you’ve done that will have affected the nation and/or your standing in it, e.g. I returned a religious relic, or I insulted their King, but for now it’s just pure descriptive information. And with that – it’s actually all done, as far as I can tell. All five parts of the journal – your narrative, tracking the connections you make between things, tracking the factions you encounter and any effects you might have had on them, tracking deciphered languages, and tracking unopened locks, are all working perfectly. Not just are they handling and correctly tackling everything that they might need to do in 0.11, but they’ve also got a ton of code in there for handling stuff beyond the forthcoming release as well which I anticipate being included, but isn’t yet in there. Overall I really think the journal has been a standout achievement and I’m just so happy with how well and how smoothly it all works, and I’m really keen to see it develop more over the coming months and years.


World Map Clue Polishing
In a recent entry I confidently asserted I had finished the generation of world map clues! This was mostly, but not entirely, correct – for two reasons. Firstly, continued and actually quite extensive playtesting revealed a number of edge cases that needed to be handled in various ways, and also a number of minor bugs I hadn’t quite noticed the first time around. Playtesting over many hundreds of world map clue generations also revealed that I needed to tweak and balance the difficulty levels significantly, specifically because it was climbing into high difficulty way too fast. The transition from “normal” to “hard” was fine, and the transition from “hard” to “ultra” was fine, but the transition from “easy” to “normal” was very sharp. I therefore adjusted some of the archetypes that remove parts of the map (i.e. not damage, just leaving them blank) as some of those were way too hard for the lowest difficulty levels, and the hardest of these – which I call “patchwork”, where every other tile is removed – is now only possible on the largest size of map at “hard” difficulty, or the largest or second-largest size of map at “ultra” difficulty. That one is absolutely the toughest of the bunch, by far, and even without damage and other stuff, it was just way too hard for “normal”. I also implemented a lot of minor but important rules here, e.g. ensuring you don’t have smears of paint next to the “X” on the map (it just looks bad), and made sure the same symbol can’t appear twice on the same map, and a whole load of other stuff too. Many of these are dealing with 1/20, 1/100 scenarios, or even 1/1000 scenarios, but they need to be dealt with to ensure both visual flair and gameplay usability. Secondly, an excellent comment suggested a map type that only shows certain kinds of terrain and not others, and this was a marvelous suggestion. This was an interesting one to implement, but I’m really happy with how it came out – on higher-difficulty world map clues it is now entirely possible for the game to select only showing terrain (e.g. temperate, desert, polar, etc) or only showing roads and rivers, or on “Ultra” difficulty notes (the highest level) to show only settlements. In each case the game of course counts up how many of each type of thing the note has, and only if it has a lot in one category and also a lot which are not in that category does it add this particular variation to what’s possible, and then potentially pick it later in the generation sequence to replace whatever other obscuring factors had been chosen instead. Doing this part-way through the generator was necessary for various reasons and added some interesting extra technical challenges, but it came out really well. I think these are super cool! They are currently set to never appear at the “easy” and “normal” difficulties, but they are entirely valid selections for the generator at “hard” and “ultra” difficulties, which I think will work out really well.

Local Map Damage
While writing up this post I suddenly realised that I’d added another really cool thing in a few months ago, but never posted about it! Whoops. Not sure what went wrong there. Anyway, the damage on the world map clues (as above, and shown in other recent entries) reminded that I’d actually done all the work required for implementing the damage style on local map clues! One might think that these would be the same as they’re both maps, but I tried that, and the style of damage shown above – which I think looks excellent on world map clues – actually wound up looking really, really bad, on local map clues. It made some of the use of colour quite confusing and made it harder I suspect for players, especially new players, to differentiate where the damage ends and the clue begins. It’s hard to describe and I (foolishly) didn’t store any examples of this, so I ask you to just take my word for this: it wasn’t working. Nevertheless, I needed to implement damage generation on local map clues, of course, as that would be another very reliable way to make some of these clues trickier, but visually it simply had to take a different style. As such, I experimented for a little while with this, until landing on a style of damage for these clues that I really liked. It’s very clearly and unambiguously damage, and has that organic look required for damage, but is also very visually clear (unlike using the world map damage style on local maps) and doesn’t leave room for any uncertainty about what you’re seeing, or what elements have been removed by the damage. These are the main things that I needed to ensure, as well as of course just making sure it looked visually pleasing. I honestly think that look just superb, really lovely, and add a great level of detail and variation into the generator beyond (obviously) the gameplay importance and use of damage to obscure information. Damage on other notes is something I still need to come back and code later, but this is plenty for the 0.11 release, and I’m incredibly happy with these look. Aren’t they cool?

Soundtrack Update
Finally, it is also with great pleasure that I can announce more excellent progress on the soundtrack. We’re now really “back to it” after quite a long break for various reasons, and things are absolutely cracking along. Since the last update three more tracks have been locked in to their essentially final versions – these are the tracks for “major places” (e.g. castles, parliaments, mints, etc), the track for travelling on the world map, and also the track for religious buildings as well (e.g. churches or their equivalent, monasteries, cathedrals, and so forth). In the first case we’ve now got a track that strikes a really fantastic balance between the sort of grandiosity that a lot of these buildings are going to need, implying wealth and splendour and ornate furnishings and all that good stuff, but also the sense of intimidation or size or might that others need to convey – such as castles and forts and the like. The previous iterations of the track that we’d been working with had proved really effective at the first of these though less so the second, but this new version really hits both notes very nicely on one track. I’ve playtested this track in various buildings and I’m really happy with the ambience it gives, and the signal of being unlike other buildings it also conveys (as most buildings will be sticking with the general “walking around in a town or city district” track when you enter them). In the second case, this was already one of the strongest, but this has really reached its final version here. This track has some nice drum work of all things, and a lovely ambient melody to go alongside it, which both really evoke a sense of striking out into the unknown, exploring, deciding where to go next, and so on. I couldn’t be happier with this track, and it has now likewise moved into the final polishing stages. In the third case, this track is now hitting the wide range of notes I wanted to get out of this track – we need to give a sense of a sacred place, but also do so in a way that could fit for Lovecraftian gods or demonic gods on the one hand, and the most “pedestrian” animal or humanoid gods on the other hand. This was a tricky task but Nik has delivered it very nicely in a track with atmosphere and intrigue that I think would fit in any sort of religious building well, so this one is now also moving into the final polishing stages. With these in place, we’re getting close to having the entire soundtrack playable (in the sense of “I can listen to it”, not in the sense of “It is in the game”), and that’s a really exciting milestone :).
What’s next?
Whew! That’s a lot of stuff. No one major thing this fortnight, but these are all important things to finish off or polish or complete or address for 0.11, and I’m glad to have got them all done. In the coming fortnight I anticipate probably beginning work on the non-tutorial quest generator (!!), though I also might go back and do the second half of the new conversational system material for 0.11, as that’s essentially now the only other major-ish task required before the next version’s release. As before, I am really, really hoping to get this out this year, and I’m trying hard at the moment to focus as much of my energy as possible on URR’s development. The tutorial quest has shown me that it can be done, and with so so much done now, I really want to try to ride this wave of energy and excitement into my brain all the way into the release from this point on. As ever friends, thanks so much for reading, and please do leave a comment with your thoughts if you feel so inclined! Until next time, I hope you all have a great fourteen days, and I’ll see you then with hopefully another big update…
