Happy 2025, friends! Welcome back to what promises to be (hopefully) a very exciting year for URR development, which is to say the release of 0.11, with a win condition! I’ve always loved that feeling in games of falling down a rabbit hole, where the more you look, the more you find, and there’s always more secrets, and secrets within secrets, to be found. This is what I’m trying to make – but procedurally generate – in URR. So to explore how I’ll be doing this, roughly half of this entry can be seen as something like “starting from first principles”, while the other half is drawing from all the cryptic riddle games I’ve played (so things like La-Mulana, Tunic, The Outer Wilds, Eldritchvania, Zuzatan: The Forgotten City, Environmental Station Alpha, and to some extent something like Noita, too), and I’m going to try to present a generalised high-level structure for cryptic riddle quests based around clues and mysteries and the interpretation of in-game data towards a unique outcome. By this, therefore, I am distinguishing between something like The Witness – where every puzzle is of the same type, i.e. move a line through a grid, even if the specifics change – and something like La-Mulana – where every puzzle is genuinely unique, as some are to do with language, some with visuals, some with memory, some with interpreting words in novel ways, some involve your inventory, or the background, or room names, or deduction and elimination, or… whatever. For the latter type of puzzle, then, what conclusions can we draw about how these sorts of games are structured? I’m also, as a final note, distinguishing here from something like the information fragments called “secrets” in Caves of Qud, which are (of course) the closest to date to what I’m trying to achieve here, but still very distinct in implementation.
So let’s start with the simplest possible quest:
The player is given a clue, such as “Three steps north-west of the resting place of our greatest general, I have buried a great treasure”. Find who that is, find where they are buried (probably a graveyard), take three steps north-west, and dig. You’ll then get a reward, which would end the quest – so it might be a particular item that you’ve been told to hunt down, or money, good weapons, useful books, whatever. This is pretty simple but would require the player to either be paying attention in good detail to the game world, or to go and seek out some specific information. This anticipates something I’ll be discussing in a later entry, which is a distinction I’ll be drawing in clue generation, and the game’s quest generation code, between “general knowledge” you can get incredibly easily (talk to a random person and they’ll tell you how their nation’s government works) and “specific knowledge” that can only be found in certain places (e.g. the year a ruler died, which might be only recorded in 3 books and 2 murals in specific locations). Regardless of the type of data, though, this is still the simplest quest variation – one clue, which takes you to a reward. Even this is, of course, essentially beyond what other games have implemented so far, as the important point here is that it’s a clue that is generated and not a piece of information – it’s in the obfuscation that the interesting novel stuff emerges.
Now let’s look at two more complex variations, where multiple clues lead towards a reward. There are two variations on this. The first one looks like this:
For this one you would get three clues that lead you towards a reward. For example (and I’m sticking with textual clues just since they’re the easiest to explain) you might have one clue saying there’s a treasure hidden at y coordinate 68 on the world map, another separate clue (to be found or discovered or unearthed, or interrogated out of a useful NPC, somewhere else) which says a treasure is at x coordinate 188 on the world map, and then a third separate clue says the treasure is buried by the only tree that stands north of the hermit’s shack. So, you should get all three, combine them, go to 188 x 68 on the world map, find the hermit shack, and then check the tree to the direct north of their shack. The idea of this model is that multiple pieces of information need combining – and for harder variations of this, I will want even figuring out which pieces need combining to, itself, be part of the puzzle – and then you put them together and get the reward. This is, obviously, a level more complex than the first example. What is also interesting here, though, is that with two clues but not all three, you could make educated guesses, and there might be few viable scenarios. If you don’t know the exact location, you have a whole 200×200 grid to dig in (hopeless) – but if you know the exact location, and the world x or world y, you could take some educated guesses. One key design question for URR is going to be: is that okay? Or is that not okay? Do we want players to be able to sometimes take educated guesses when they’re only missing a single clue piece (perhaps that would reduce the risk of frustration?), or do we not want that to be possible? Or, perhaps, is that a question of difficulty – easy riddles of this type should be structured so an educated guess can be taken, and hard riddles of this type should be structured so educated guesses are impossible? I can see strong arguments in favour of either – your thoughts as ever, dear reader, will be greatly appreciated.
Now, here’s the other case of multiple clues going to a reward:
This one I’m seeing as distinct, and harder than the above. Imagine you find a note which reads “Our god cried out two tears, and one became the sun, and one became a great spear. We worship these great gifts below the first pagoda ever built to the faith”. This would be the core clue in this diagram – the one in the middle of the other three. Whereas the clue in the first quest example up at the top does have things you need to find out (who is the general, where is he buried?), those uncertain pieces of the clue are not themselves hidden behind clues! Here, by contrast, they are. So, for example, you might imagine another generated clue which gives you a hint which pagoda was built first (“We first sat down to worship in the land where hawks are loved, and horses are loathed”), and then when you go there and find it, there are many designs in the floor in many shapes, two of which are a sun, and a spear. So you then know those are the patterns that need filling in, but you need to know what with – so you need to discover what the tears are (i.e. what formulae of plants and mushrooms and vines create them), and these would then each be hidden behind other generated clues. One for instance might be “Our god’s first tear was viscous and purple, and found in plants only where the Scorpion-King once ruled” – so you need to find a formula that creates that outcome, using materials from plants growing only in the relevant civilization. The other could be something like “Our god’s second tear cures the disease that ravaged the land of the black holdings in the year of the green lotus” – and so you can discover that, and find what that cure is, and then make it. Once you’ve got all these pieces, you’ve got the two liquids you need stored in canteens, you have the location of the right pagoda with the secret chamber and the right designs to pour them into (sun and spear) – you do so, and the reward is given!
And even as I type this, I suspect I’m feeling the same thing you’re feeling, dear reader – this is getting complicated, isn’t it? Or rather, this is getting complicated-ish for a non-PCG game, but astonishingly complicated for a PCG game. Still, that’s part of the reason the whole project is so exciting, because this is genuinely new terrain, but speaking as someone in the process of trying to code all of this, I don’t mind admitting that this stuff is mind-boggling, and we haven’t even started to discuss relevant data structures and clue generation systems yet. The data structures are going to be important, however, as it’s becoming clear as I code that I’m going to need to both keep track of where certain kinds of information are – i.e. what are all the sources by which the player might learn that Ruler X died on Date Y in Manner Z? – and keep track of what is ordinary, high-level information (what’s the name of a civilization, what colours are its flag, what’s the name of a god), what is slightly more involved information but stuff you can find from many sources (what’s the name of a ruler in a civilization, how many taverns does a city have, what’s the name of a particular arena), and what is that sort of very obscure stuff that can only be gained from a handful of very specific, and probably hard to find, information sources. All of that will then also need to be fed into all the clue generators to ensure that the player actually has access to the appropriate sources, and also as a means of scaling difficulty, with early riddles only asking you to decipher very high-level data, and then moving into more specific data, and then moving into data which is actively hidden and has to be sought out.
But anyway – these, then, are the three initial tiers of quests. I imagine the first of these, in particular, being scattered all over the world – think of them like side quests. They’re simple enough that they wouldn’t contribute to the core story objectives, I think, but you’d often find notes of other clues which are “one tier” notes, i.e. all the information is contained in that piece of data (might not be a note, of course – could be a comment from an NPC, or a mural on a wall, etc). I like the idea of the player collecting a solid number of one-clue quests and storing them up until they’re in the right area (or what they think is the right area), or maybe if they aren’t sure what it’s referring to but then later they discover something new – the name of a religion they haven’t found before, for instance – they then remember a note which discussed something similar, get the note back up, and can then decipher it. As I say, I think these one-clue threads will lead to more traditional “loot”, i.e. money and useful items, although it’ll also sometimes yield a book or a note or some other kind of information. Less often you’d find these other two, but these can of course be combined and extended, and that’s something I’ll be working into the generator, so by just changing “Reward” to “Clue”, we can of course generate much longer threads. At this point, then, I think we start to get a proper image of what the quest thread generator is going to look like. One such longer quest, then, might look like this…
…or, of course, like this:
…and this of course brings us to an exciting topic: recursion. In the immediately above quest, we could say the first clue has a recursion level of 0, the second a level of 1, the third a level of 0 again, and then the fourth clue a recursion level of 2, since it requires you to engage with a clue which itself requires the player to engage with other clues if it is to be deciphered. I anticipate recursion (as above) and length (obvious) as being two of the four main difficulty modifiers, along with obscurity as mentioned above, i.e. how well hidden is the information that the clue needs you to use in order to make sense of what it’s going for. Interesting here also, of course, is the fact that I’ll then be able to create threads with a very different feeling to each other by emphasising one difficulty element over others – we could have a quest with only a single main clue but that has multiple layers of recursion to decipher, vs a quest which is a sequence of non-recursed clues in a line, vs a quest where the information is extremely obscure to locate. The fourth, though, will be something we’ll call variety. For example, let’s colour-code clues now where each colour denotes a different religion or a different civilization, for example, and we might get a fairly simple quest like this…
…where the red denotes a religion that is, let’s say, the religion of the nation the other two clues refer to. All pretty simple. But then, of course, we might get something like this…
…which immediately becomes a lot tougher. If the purple is again a nation, and red a religion… well, maybe the yellow is another religion, the green is another religion, and the blue is a third nation. These would be for later game quests, of course, but would also connect to what I said earlier about general knowledge and specific knowledge – so when a quest thread is generated, it needs to take into account both how late in the game the player is, and what quests have been completed beforehand, and thus what knowledge the player can reasonably be expected to already have (e.g. nation’s culture is x) or have easy access to (e.g. this quest can only begin in nation x, therefore we can reasonably assume the player can buy a book from nation x if they need to). Again, by varying the level of recursion (how many clues feed into other clues), length (how long is the clue chain), obscurity (how easily accessible is the information) and variety (how many sources does the clue drawn on), I should be able to generate a huge set of extremely varied quests which are very different to play through, can adapt to game stage and difficulty, and give very different experiences. We can also have some quest threads really emphasise one of them over the others, and maybe even clues which point towards what sorts of clues other threads want…?
But – what if we want multiple paths? I wrote a long time ago about the idea of inverting the traditional structure of normal paths one gets in games, i.e. “combat” is the norm and “anything else” – stealth, trade, diplomacy, etc – is the unusual or different way to play. This remains one of my core objective, since although I am very excited about developing a novel, deadly, duel-focused combat system, I want the foundations to always be this exploration, discovery, understanding, and integration of diverse kinds of data into a whole for the player to advance. So given the idea of combat as the standard, here instead we’re going for the reverse of that, where I want those to be the default way to play, but I absolutely want to have combat included as well (as noted previously I have a loose first draft working in another file, and it’s really cool and interesting, and I’m excited to code that in as well in the not-distant future!). So, we could imagine a change to the above quest structure which now, instead, looks something like this…
…and of course that could be generalised to any step. Maybe the blue clue, for instance, could also be a clue or a combat, so you can either acquire the clue by deciphering some relevant pieces, or acquire the same data by finding someone who has it and “persuading” them to give it up in exchange for their life. But, as with everything, I’d want the latter to have consequences – if that person was a priest, say, then that should set that religion against you in the future, which might influence what nations you can enter, or if they truly despise you, perhaps they send kill-squads of inquisitorial zealots your way? Regardless though, the more complex a quest becomes, I think the more paths I want the game to generate for a path through it. Right now I’m thinking “riddles” and “combat” are the core two, but things like “diplomacy” or “gifts / trade” might also show up rarely, or perhaps in their own threads? I don’t see those as being common enough… but again, we’ll see. The point here is to create a modular system that I can easily (hah) add to with new categories later on without having to redo the generator. This is one of the core systems of the game, and I like to pretend I’ve learned a lot in 14 years of coding, so I’m spending a lot of time on this generator to ensure modularity and the potential to add, change, and remove things later on without having to redo everything from scratch.
One last question – for this very first part – then remains, which is whether the clues or the quest are generated first. I’ve played around with both options, since the clues are so complex to generate it seemed logical to generate them first, but upon further consideration I realised that actually the reverse of that is true, and we want to generate the thread first in game, even if I’m working on the clue generation first in the code. This is because the high-level thread will determine everything that goes into the clues, such as what nations or places or religions they draw on, what information is required and expected, and so forth, and so the thread has to exist first for the game to know what information to pour into the clue-generating cauldron. In terms of code, however, though, I’m starting from just the absolute simplest quest – one clue, to one outcome – and then we’ll go from there. I’m excited to say I’ve begun work on this, and it is already generating verbal clues which are actually meaningful – though only for a narrow portion of potential scenarios so far, though it’s growing with each hour I spend working on it – and I’m super excited to show those off and talk about clue generation next time. It’s a huge amount of work, but I can already see how it’s going to come together and some of the other components that’ll be needed alongside it – like the knowledge database discussed above – in order to create something genuinely novel and unusual.
What next?
Thanks for reading everyone! I honestly think this is so exciting, and made even more exciting by the fact that it’s actually coming together, and faster than I expected, in the coding I’ve been doing in the last few weeks, as we have the first very basic clues in the first category I’m focusing on (more on this next week) actually being generated, and legible, and sensible, already. Really thrilling stuff. As ever, please do share this around places on the internet you think might be interested in a mad cryptic-riddle roguelike’s fourteen-years-and-counting development, thanks so much for reading and coming with me on this journey, and please do let me know what you think in the comments below! I’ll see you in three weeks – around Feb 16th – for the first post on the specifics and code of clue generation :).
New year, new amazing stuff!
It’s an amazingly interesting read! As for wether the player should be able to “guesstimate” solutions to certain clues, I feel that is the way to go. Real mysteries only work well when they abide by the logic of the world they are situated in. If a player can infer a solution thanks to them paying attention to the world, I think, that will bring immense satisfaction when they manage to “outsmart” the clue-givers. It would certainly make me feel like I’m in a coherent world governed by it’s own mechanisms. And finding out some sort of contradiction between the clues and the world would be a bit sour. And that’s another difficulty in the procedural generation, I think.
The way I aproach this in my own project is exactly that, the player is actually encouraged to infer knowledge and to make them think about the people they meet and the world they’re in.
You also mentioned data structures that can hold all of this information. I’ll be experimenting with using graphs for it, as they are extremely efficient in storing this type of “webbed” information. I work with RDF graphs in my normal job and build complex schemas for all sorts of data, e. g. life sciences data for drug targetting, tracking of academia papers and such.
It’s a very versatile technology and I think it may work very well for this, but I’m still on the prototyping phase on that. Next best bet would be on a relational database with a very good schema. Or a totally new data structure for this purpose! If you’re interested in the graph part we can have a chat about it, would be glad to show you around graphland!
Can’t wait for next month!
Cheers