Friends, we are back! And back with, if I dare say so, a bang. Rather than more work on the abstracts of riddles pre-implementation, I’ve been feeling (as mentioned before) that I just really, really need to start seeing some changes in the main game file. I’ve been doing so much work these last six months that’s going to deliver genuinely unique gameplay, but it has all been so abstract, not yet shifted over into the game itself, and I just really feel the need to start seeing some physical, material changes in the game proper. So for the past two weeks I’ve been working on various things, and the main thing to show off here is the implementation of all the reading book code into the game (!!), and then the fact we now have the player’s journal correctly recording everything the player does (!!!!), which is a huge milestone and required some cool new and funky code. So, let’s get into it:

Book Code

The first thing was to move the code for showing book pages – meticulously developed in my testing file – into the game properly. Let’s not talk too much about the fact the entire game is still in a single 1.1m line file, but the important thing here is that having the testing file is a massive help for me in making sure things are working as I want them to, and can be rapidly tested and rapidly iterated, before they make their way into the game proper. So, all the code got shifted over, and then a few things had to be adjusted due to poor coding practices that still linger when I was developing, e.g. having a fixed x/y point the book starts drawing at rather than a movable one, and still stuff like that. This was also important and relevant when it came to adjusting and handling the shading of colours in the book pages, and also on hidden material in those pages, and various other related concerns as well. All things considered, however, this didn’t take quite as long as I’d expected, even if I actually underestimated how much needed to be shifted over from the other file into the game itself, and how many additional dictionaries and bits of code I’d developed to handle the books displaying correctly. Nevertheless, I got it all done, and then tethered the generator to the actual dimensions of the book, and voila! The player was then able to read their journal, see a sensible frontispiece for the journal, and scroll through a bunch of pages containing a bunch of lorem ipsum blather / placeholder. This is actually by itself an immense step, because it now means literally everything required for every possible book in URR to be readable is now ready in URR’s code, and is now merely awaiting the content generators (to follow, soon!).

Narrative Pages

With that done, the next thing, of course, was implementing the feature whereby the journal records everything the player does in the game world (above a certain threshold of consequence, anyway). Readers will recall that I developed an abstract version of this a few entries ago, including some cool code and something almost like a mini programming or logical language the game has for deciding when to conclude a sentence, when to move onto the next sentence, when to give more information about a particular topic, and so forth. The goal here of course is to make the writing style within the journal look at least reasonably organic and human, while also just being frank and to-the-point without much flowery-ness (of the sort one might reasonably expect to find in other in-game books, whether novels, or biographies lauding the tremendous achievements of the biographee, and so forth). The way to do this was going to be to head into all the relevant areas of code that handle the various actions the player might be doing that are journal-worthy, such as moving into a new nation or region for a first time, or seeing a statue or a relic for the first time, or whatever it might, and then incorporating code back to a new function (now called add_event_to_journal) which would give that function both the type of event being recorded here (“Nation”, “Relic”, “Statue”, “New Month”, whatever) and the required information the function would need to create a sensible sentence that actually describes the event. I started with the simple ones, like new months, new nations and regions and the like, and pretty soon I had these working very smoothly! However, a few interesting grammar / flow problems came up which I hadn’t anticipated, so I added a bunch of rules for special journal posts like “I left again” or “I returned to” rather than it always saying “I arrived at X” if X is a place you’ve been a thousand times. Some of these need the journal to check the previous entry, or sometimes even the one before that, to generate the appropriate sentence. You’ll see here a bunch of sentence types, not all of them (still working on the final few) but the fifth page is of particular note:

Tabs and Advancing Pages

Another little addition I had to make was ensuring that the tabs – which are right now a unique feature of the journal, although I might use them in other books as well, perhaps – show up correctly when you’re on the page of the tab, and that they of course disappear when you’ve flicked past the tab (as they logically would since the page has been turned). This meant the game needed to be able to track exactly which page each tab started on – keeping in mind, again, that each section of the journal can potentially grow to essentially any size, and so the actual page numbers here are constantly shifting – and then print a little extra bit of an image on the correct page, and do away with the tab image altogether once the player has scrolled on past. I needed to slightly rework the code I’d originally put in for the tabs to reflect the reality of this one unique and rather protean book in the game, but that didn’t take too long, and soon we have a little extra bit of a graphic showing on the side when you first turn to that tab, and also the tabs disappearing once you’ve gone past them. Right now the player uses the “<” and “>” keys to advance or go backwards throughout a book, but it became clear we needed some kind of “fast travel” system for the journal, especially as it grows in size, so you’ll be able to use some keys (not sure which yet) to move between the tabs more rapidly. We’ll also, much later, be adding a search function for all books (not just the journal) where you can type freely into a box and have it find the relevant pages, which should also be helpful as well once the journal grows to a potentially unreasonable size. Anyway, this tab system looks like this (and this gif overall shows how the entire thing is looking at the moment as well, even if it’s still a work in progress):

As part of this, you’ll notice that the actual printing of the page moves down, and the remaining pages at the bottom of the screen advance, as you continue reading! This was something I really should have done while still in the testing phase rather than after shifting things over into the main file, but that’s okay. The game now has a system, then, for looking at the number of pages a book actually contains, and looking at the number of visible pages which the graphic shows as existing within the book, and calculates when the book’s page printing should be moved down the screen by one tile in order to properly and accurately give the actual visual sensation of turning pages through the book. This was a surprisingly tricky calculation to code into the game, and I actually just wound up making some precise rules for low page counts before then shifting into a general calculation for high page counts, since the low page counts made things quite tricky in terms of calculating how many visible pages it should look like were being moved – but the point is that now as you move through a book it does show the remaining pages shrinking, and as you go backwards, it shows the remaining pages climbing back up again! This is a purely visual effect, of course, but it’s an important one that I needed to add in to maximize that sense of each book being an actual and physical in-game object the player is navigating, so I’m really happy this is now in, and looking pretty good.

Lock Pages

AH HA, but that’s not all! There are four other categories of pages in this (potentially infinitely-sized and non-Euclidean, and hence entirely unique) book: those listing your categorisation of codes, the effects you’ve had on the world, your translations of languages, and the unopened locks you’ve found. I next went onto the lock pages, and quickly developed a really good comprehensive system that’ll be able to record every padlock you encounter – although I don’t think it’ll include abstract locks, since the purpose of those of course is to figure out the nature and location of the “lock” in question (e.g. place item X on tile Y in building Z), and having that show up in the book would give something of the game away there by telling the player what it is they’re meant to be deducing. Anyway, I’ve settled on a really nice format for how the lock pages work – basically, it’ll start at “Lock 1” and then work upwards as the player encounters more and more padlocks, and for each one a single page (never more) in your journal will be added to describe the precise location where the lock is, its danger and risk levels, and then what else can be said about it – the number of keys, or wheels, and any symbols on it. It won’t tell you what specific symbols are for locks with a symbol or two on them, since deciphering that might be part of the question, while for locks with code wheels it’ll give you a sense of the wheel (“The first wheel appears to be a random selection of symbols” or “The second wheel seems to depict religious relics” or whatever). Then, when you’ve opened a padlock, a green ink slash goes through the page, and it says “OPENED!” at the bottom.

Clue Categories

Next, readers will remember we have an in-game system for coding items (which of course includes books, notes, maps, scrolls, tablets, etc) into groups of things that you think might be related. Any item can be added to any number of groups. The screen for this looks like this…

…and this is another important thing that we need represented in the player’s journal, with the idea of allowing you a very quick and easy overview of whatever you’ve put into a single category to help jog the player’s memory and keep track of what each thread they’re following might involve. This means the second area of the journal now creates pages each time you create a new code – symbol and colour – and will then list everything that you’ve assigned that code to. It’ll also remove ones that are no longer on there when you take them off or the item gets destroyed, and I realise this posts significant questions about the nature of this journal, but let’s just ignore that and not think too much about that. This can of course go onto multiple pages if need be, in which case the entries just overflow onto however many pages they need in order to keep displaying the relevant information. The entries are also written in such a way as to give a bit more information, so for instance some items will list their quality, and some items will also list special features here. So, for instance, I’m soon going to be adding some variations to weaponry such as rare possibilities made with wootz steel, so something like that would be reflected in how the item appears in the journal once it becomes categorized. These screenshots show how this system looks like, then, and I hope this will become a useful in-game tool for keeping track of connections between things, especially as the game progresses, and I even like the idea of actually making the lists in the journal into “hyperlinks” in their own right so you can instantly leap between the items. We definitely need a compare functionality – sometimes you’ll need one book open to be consulting with another book! But for now, here we go:

Overall, with the journal’s ability to now record your activities, your codes, and the locks you’ve found (and soon, your languages deciphered and your faction effects, too) – and books in general zooming ahead in development – something really unique is coming into being here, I think, and it’s super exciting :).

Other Changes

Two other small alterations have also now taken place! First, the map (whether you’re looking at it or actually moving on it) now tells you your x and y coordinates. I know this gives away a little bit of non-diegetic information about how close to the edge of the map you are, and things like that, but that’s a minor point and I think it’s important to give the player a sense of their location, especially since that can then be included in riddles and mysteries later down the line:

Second, the player now spawns in a university in their civilization rather than in the upper-class housing district! Right now they aren’t spawning in the right location in that university (i.e. on the top floor of the great hall, in the curator’s office, next to the museum), but I’m half-way through moving them over. This is a surprisingly complex shift due to how the game-start code and the game-running code interact quite differently (i.e. garbage code written thirteen years ago, sigh) but it won’t be hard to get the player into the appropriate building in the near future. For now, though, we’re half-way there, which means the player will soon be spawning in the museum of that university, and thus seeing the tutorial prompts first time they load up:

What’s next?

I’m working hard at the moment on finishing off the remaining two tabs in the journal – i.e. for what words in a language you’ve deciphered or guessed a decipherment of, and the area of the journal that will list each faction and what you’ve done to affect them – but there’s also a few final steps of rhyming riddle generation to polish and get into place, and the implementation of keys and padlocks into the game itself that needs doing. All of these are things I’m working actively on, and ditto the Secret Project mentioned in a recent entry as well. Any of these might be the next update, but alternatively, it’s possible I might go on a major bug-fixing spree soon – there’s still well over a hundred in the list, all or at least most of which I want purged for 0.11 (obviously every crash bug has to go, but I might leave in some truly minor ones I just don’t have the strength to fix them and their technically complex to actually get fixed), and I’m finding myself in the mood for doing something like that in the near future. As such, the next entry could be more mainline development, it could be bug-fixing, it could be the reveal of The Secret teased in the previous entry, it could be something else… there’s a lot going on, but the important point is that things are moving fast, I feel I’m delivering a high quality of features and code here, and I’m super excited by the whole thing. As ever friends, please do leave a comment with your thoughts, and/or share this post around the web, and I’ll see you all in a fortnight :).

Leave a Reply

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