Hello everyone, welcome back! Readers might recall that two entries ago I had made significant progress on the rhyming riddles for pointing the player towards a specific location on the world map – either by describing that location, or describing a location which is directly to the north, south, east, or west of that location, and then noting what direction it’s in and how far away it is. This is a great start, and creates a lot of very cool initial sentences, but then we got into the real challenge… which is how to handle the second sentence in each stanza which has to rhyme with the first, while also describing a location in one of the same ways (i.e. X is here, or X is nearby to the west). This is one of the most technically and intellectually and creatively challenging things I’ve ever done in game dev so far, and although it might seem quite easy on the surface, this took me a good few weeks to even figure out the exact answer to, and then even longer – though in fact this part was shorter than expected – to implement it in code. This all came down to a particularly intense day week or so ago when I just woke up, sat down, and then didn’t move (metaphorically speaking) until the thing was done, and that blitz of effort and brain power (it felt as if I could actually sense my brain stretching and straining as I did it) is what we are going to see reflected in this week’s blog post.

So, to recap, here are some example sentences that we might have generated:

The important point here is the core of each sentence, the generated descriptor for a location. These might be, for example, “a chair or throne is near one with goring tusks” (for a place called “Seat of the Boars”) or “light now contained and a pale thing above” (for a place called “Lanterncloud”) – and then we can add some standing word in front of it, like “Where” or “And” or whatever, and then some brief final thing giving us information about the direction it is from the place we’re talking about, like “far to the west” or “are very close by”, and so on. That stuff was complex, but not wildly or ridiculously so, and it produced the first sentence for each of these stanzas very nicely. But then, we get to the second, and it is TOUGH. Because now… we have to rhyme something with west. And therein lies the problem. The first possibility would have been to rhyme it not with west but with another part of the clue, so one could imagine for instance the last of these clues being reworded thusly: Where far to the west a magus of tricks and magic walks on the earth’s rising, and rhyme it with rising instead of west, and the “west” part shows up earlier in the clue rather than later. The issue, however, is that there are quite literally thousands of possible end-words for the central part of a location line and so I need to instead only have a few end words, like “west” or “east” or “far” or “near” in order to rhyme with those. Yet that, itself, proved difficult. If we think about the middle part of this – “a magus of tricks and magic walks on the earth’s rising” – how on earth do I find between two and four syllables to end that sentence with, for instance, “crest”, in order to rhyme with “west”? Or “tries” to rhyme with “to sunrise”, for east? I had a whole list of rhyming words for west, east, north, south, higher (for north), below (for south), [direction]ward (e.g. eastward), nearby, close-at-hand, tad, and way… but I couldn’t see any way to find an easy couple of syllables to end the line, and to always logically end the line in a coherent and sensible sentence, no matter what the core part of the line might be! In truth, I confess I spent a couple of weeks on this problem before the solution came into my brain, which I then tried, it works great, and I’m going to relate here.

So the first step was to develop a list of potential rhyming words that might, just might, have generic usage – i.e. they can be completely agnostic about what clause they’re being used to describe, order at least somewhat agnostic. To explain what I mean, imagine the ending “without cease” to rhyme (barely!) with “east” – as long as the clause it is finishing has some verb in it, then it works. So “where an eagle climbs above fire without cease” works perfectly to denote a cryptic way of expressing the name of a specific location, and the without cease part works well for something that is a physical and unchanging part of the geographic landscape. Here, then, is what I came up with for east and sunrise (i.e. another way of saying east):

Then for the west and sunset:

And for the north (trickier):

And the south (the hardest – the rhymes of “south” are utterly useless unless you’re creating a poetry-based Pokemon fan-game):

We can then also add a set for [direction]ward:

But also for other end-clauses from the first sentence as well, like “is close nearby” or “is close at hand” or “is westward a tad” or “is northward a way”, and so on:

Now, some of these I could find logical and generic end sentence clauses for, and “without cease”is a really good example there, since no location is going to be a place that isn’t on the map, or disappears and comes back, or any such silliness, and so we can indeed talk about mountains or towns or rivers or whatever as in existing without cease. So then we have a rhyme! Even if east and cease are not an absolutely perfect rhyme, this stuff is so damn tough that I’m willing to forgive it. But it soon became apparent that some of these endings would only be suitable for certain prior clauses, and indeed some of them I couldn’t even find any kind of logical ending for. “Clad”, for instance, and the idea of clothing or wearing more generally, is almost never mentioned in any of the potential clauses which generated to cryptically describer place, an including it could lead to significant confusion by suggesting to the reader that we are talking about clothing styles within the game – which of course themselves generated – and hence unintentionally distracting attention away from what in fact needs to be focused on within the clue. Another good example here is “pet”, which – although the names of locations can use many kinds of animals, and wildlife generation is something I’m hugely looking forward to in the future – again has no real logical connection to any of the clauses, nor to in-game data, and while I do appreciate its ability to rhyme with sunset, there just wasn’t any real sense here. So while these lists looked at first quite promising, and I thought I would be able to go through them all and create a set of rules for which sentences can use them all, or indeed hopefully create a lot of generic ones where any clause can be ended with a few words, it was quickly apparent that this wasn’t the case. So I instead moved on from the words and spend some time thinking about ending clauses, and trying to pin down a set that would be logical – and of course still rhyme with the required words. This led to this:

So, we might look at #28 and imagine that some clauses are describing a person or an animal, and thus that set of text would be a potentially logical ending. Similarly, #52 could comfortably describe any animal, #71 would obviously be suitable for locations which are in a swamp or tropical region, #35 would be logical for clauses that describe some kind of particularly strong or significant action taking place as part of the clue, and so on. I felt like I was making good progress here! But then more complexity quickly came in when I realised that not all of the clauses have the exact same grammatical structure, which is to say someone describing a singular, some of the describing a plural, and some are making broader observations that cannot logically be ended by “is X” or “are X”. An example of this latter version would be something like “a court comedian frolics on grey stone” (for, I don’t know, a place called Jester’s Rock or something like that?). So the next step was to go through this list and figure out which ones need to have special rules for spotting words like “is” and “are” after the sentence, and which need to insert them into the final clause in some other way, and which are not suitable for those but are suitable for the others, such as the jester example listed above. This then took us to list which looks something like this:

Again, I felt that I was making good progress here, but the issue was that some of them were still far too ambiguous. This was similar to the issue around words like “clad” or “pet” – #14 for example could easily imply that the player wants to be looking for a university, or perhaps monks, or place of learning more broadly, or civilization which has a very strong set of intellectual currents, or whatever – when in fact it’s just a rhyme being used to rhyme with the word sunrise! This brings us back to what I’ve talked about before, and something I have observed in many cryptic riddle games, which is the difference between a clue being vague and hard to decipher, and to being ambiguous. You want a clue to be hard to decipher, of course, or at least not trivial, and I’ve even talked in previous entries about the difficulty-scaling system I should be able to implement here. What you don’t want those for the player to come up with a completely logical and convincing answer to the riddle, expend some energy and effort to test it, and then turns out to be false. If it’s only out-of-game energy that’s far more forgivable, because experimentation is encouraged and expected in such games, you can’t ever know whether a solution is right until you’ve tried it, and trying it and getting a negative result will help refine your thinking and push you towards other potential interpretations. However, whether we’re talking about La-Mulana or The Outer Wilds or Return of the Obra Dinn (in this year’s game review list in December) or whatever it might be, you generally lose nothing in game by attempting a false solution. This is fundamentally different in a permadeath game. If the player expends some in game resources – even if it’s only just their character’s finite lifespan – testing something where they completely legitimate believe that they are correct, and not, that’s going to be frustrating. If when the player later solves it and they understand why their first interpretation was wrong, that’s completely fine. But if the wrong interpretation is every bit as logical as the correct one, then we have a gameplay issue, because from the player’s perspective they found a perfect solution – and indeed a neutral judge would say it’s a completely fair solution as well – but not the one the game is looking for. The point being that we need to avoid ambiguity, while remaining cryptic.

So, I chopped a bunch out, and adjusted others, which took us to here:

Also of particular importance was my realisation that quite a few of these can indeed be generic endings for large numbers of sentences, such as #6 or #8. These were like gold dust! I was thinking the always-valid ones, or at least ones the game could always consider / check, would be 6, 8, 20, 40, 41, 48, 55, 57, 58, 61, 65, 66, 69, 70, 71, and 72, and these were so important that I then started to focus on these to begin with, with the intention of coming back to the others later on.

But once I examined these, I increasingly thought that perhaps this was by far the better solution. I also began testing end sentences for some of the others, and I just really didn’t like them. I thought some of them felt very forced, very arbitrary, and I just hated how they read when I tested out the generator. So instead I went back to the drawing board a little bit, and tried to expand the number of generic or near-generic endings that would be valid, and were still producing sentences that I actually liked and didn’t find aesthetically or semantically repugnant. It turned out now that I probably hadn’t worked quite hard enough on these on the first cycle, and the more I worked on them, and the more inventive the ways I found were to fit these into logical sentences, the more I found that I could discover more and more good end words with sensible clauses in front of them that could be applicable either to every potential middle of clue clause, or at least, a huge number of them. This then, finally, brought us to this list, which is now the list which I am working with, and continuing to finish off and develop, for this system to work. Rather than having certain endings which are only logical for certain sorts of clauses, each ending is potentially valid and checks itself against other things, rather than against the existing text. So for instance, #49 obviously only triggers if it’s talking about somewhere which is an imperialist state! #66 can only be used if it’s talking about somewhere which is high above sea level, or mountain. Others of this sort on this list are pretty obvious, and the capital letters show which direction they rhyme with, where “X” means any:

AND SO, with this done, and with code to track what sorts of sentences can allow different kinds of clause endings, and with code to track the directions being referenced, and with code to ensure grammatical correctness, and with code to check that the final clause actually makes sense (e.g. #57), we can create, THESE!!!

And with that, the location stanza generator is done! I honestly think these are fab (and obviously the game can produce, by my estimate, hundreds of millions of these, not just ones directly resembling the examples I’m showing here), and this is certainly the most technically and creatively demanding thing I’ve done in URR to date, bar none. Happily, no other subset of the poetry riddle generator will be anywhere near as complex (at least for 0.11!) – but world map locations have just so many permutations and so much data that so vastly exceeds the more abstract stuff like civilizations which simply have far fewer permutations, and their rhymes are much more about their traits than their names anyway. This then lets us think about the code which generates a stanza as part of a larger riddle. Let’s say we want to point the player towards a specific location. The game can can look at that location, and then draw lines far to the north, thought the west, far to the south, and felt the east, to list everything that’s there, and its coordinate and its distance. Once it’s done this, this might (for the coordinates 37 x 120) look something like this:

It can then also look within a small circle of proximity, but not on direct lines, in order to use the “close by” and “nearby” and so on formulations, with larger areas being viable for higher difficulty riddles…

…and then once it has all this data, there’s now a system in place for attempting to make rhyming pairs from this data over and over, until it’s either successful, or reaches some number and gives up and selects a different location to try to find a nice riddle for. This has been a huge success! But also incredibly demanding. As with everything else a lot of playtesting will be required here, but I’m struggling to find much in the way of bugs in the code right now, it can just generate stanza after stanza after stanza without crashing and without ever generating one that doesn’t in fact make sense, so that’s a damned promising start. We now have the ability to describe any location, any exact tile, on the world map, and to do so in a cryptic and unique way, and to do so which either references the exact location, or the locations around it, or some combination thereof. I can’t think of any other game which can do this – and certainly not rhyme in the process – so I don’t mind admitting, I’m feeling more than a little proud of this.

It’s all coming together, friends. It’s all coming together.

What next?

Whew. We now have exact-location riddle stanzas finished, and civilization riddle stanzas, and – although I haven’t blogged about them yet – huge progress on other stanzas too, to be fully revealed in the coming weeks. Now that I look back on it, the first half of this year has all been so technically and creatively demanding. I’m incredibly happy with and proud of the things I’ve been able to create, but a lot of it has been quite “abstract”, in a sense, but it’s now finally time to properly get them into the game. That’ll be the objective for the second half of the year. I’m still hoping to release 0.11 at the end of the year, and I’m working very hard to make that happen, but if it runs over that’ll only because a bit more time is required to reach the appropriate quality for this release. As ever, please do leave a comment / share around if you’d like to, and thank you all, also as ever, so much for coming along on this journey with me.

I’ll see you all in two weeks!

2 Comments

  • Nice!

    I’d be somewhat worried that “higher” and “below” would naturally be misinterpreted as referring to elevation rather than latitude. Technically you could use “boreal” and “austral”, but I suppose those words are too obscure. I wonder whether it could work to use phrases like “south of here”, or “on the south wind”, or “proceeding southerly” to end the first stanza, to give more rhymable terminal words?

    • Thank you for the thoughts mb! Ooh, I really like boreal and austral; I may well add those onto the list. And that’s a really good point re: higher and below, yeah… hmmmm. Might have to drop those from the list, I’ll give some pondering. “South of here” is also a nice formulation, thank you – I’ll add that one in as well :). Again, it’s that thing of being cryptic but also specific, and one doesn’t want to offer logical solutions (re: higher/below) that aren’t actually correct…

Leave a Reply

Your email address will not be published. Required fields are marked *