I’ve now started work on speech variables, which is to say the parts of speech – such as “[god]” or “[rulername]” – which cannot be stored and simply reproduced, but needed to be generated each time they are called in a conversation, and will vary significantly based on context (reply, question, talking about oneself, talking about somebody else, and so forth). These are a pretty crucial part of the conversation system, since it is often through these that the player will get information about the specifics of the game world they’re exploring, and these will enable the player to ask questions about specific artworks, specific nations, and so forth, whilst ensuring that NPCs give logical replies to these kinds of enquiries. Most words are stable within one civilization: which is to say, everyone from one civilization might say “make” instead of “create”, or might be “homeland” rather than “nation”, and so forth. These give every culture a distinctive way of speaking, and in testing thus far they do come across in very unique ways. However, there are always going to be words in their sentences which have to be selected anew every time they are used, and it is these we are now tackling:
For example, “[holybookauthor]” would refer to who wrote the holy book of a particular religion (if known); “[monasteryfield]” would refer to what particular kinds of books a monastery produces (when we have books implemented!); “[mercyears]” refers to how long a mercenary has been a mercenary (that is “merc years”, not “mercy ears”!); “[armyrole]” refers to what a particular soldier the player is talking with does in the army; and so on. Whenever anyone tries to say one of these, the game needs to be able to look up what exact phrase it should use, which means a unique set of look-ups in the game’s databases for every single one of these. It might mean checking something to do with that particular NPC – such as their age or simply what religion they worship – but it might also require the dredging-up of information from a religion, a culture, a geographical location, a series of historical events, and so forth. Given the central role of the speech system to the game and to the player’s abilities to actually gain access to the information they need, it was clearly going to be vital that these systems are detailed, comprehensive, and sufficiently varied to maintain interest over what can be a long playthrough. Equally, as above, almost all of these are going to need unique bodies of code designed to pull out the correct bit of information – and it is this I’ve worked on this week.
The most challenging task this week was, frankly, reminding myself of how the code for sentence generation works, and finding the right “place” in the code to switch out “[god]” for “the Grey Goddess of the Mountains”, or whatever. Whereas for all the last few weeks I have been primarily or entirely adding more content to (or on top of) existing systems, here I was developing some new systems. I had a bunch of comments, and most things have quite logical labels, but there was still a certain bemusement looking at the sentence generation code again and working out how everything actually slots in. Once I’d figured all this out, however, it became clear how I needed to implement these elements, and what elements should be stored and retrieved from which places in the code and the game’s data structure. Last week, I shifted the code that I vaguely call the sentence-converter, which is to say the code which takes a default sentence and then makes it sound different for each nation. This week I’ve also shifted the code which handles these new variables away from where it originally was, which didn’t make a huge amount of sense, and put it alongside the other. Now, when the game cycles through each word in a sentence to choose the correct cultural version, it will also find the sentence variables in the same process, and decide what each one should become at the appropriate time. This is a good foundation for building on next week, and I’ve already begun to sketch out some of the functions that will select the appropriate words and terms for relevant parts of sentence generation.
I have also decided that the system whereby an NPC looks at you and draws judgements about you – see this entry for more – is something that will appear in 0.9, not 0.8. This is because although one can add and remove clothing at this point, one cannot actually gain access to the clothing of other NPCs yet, because a) we have no shops or currency and b) there’s no way to ask people for clothes, have people give you other clothes, even attack people for clothes, etc. So, for now, everyone will just (correctly) believe you are from your home nation. I’ve therefore implemented a placeholder function with space for a full assessment of who they think you are, which can be easily expanded in 0.9.
Lastly, as part of this, some different NPC classes will also give you different greetings; this is part of the placeholder above, and will be expanded in 0.9, but there are now some variations in greetings according to what kind of NPC you’re talking to. A priest, therefore, is likely to comment on religion when they say hello; a servant or slave will be especially shy when they greet you; and so forth. Again, this will be expanded in 0.9 to integrate with the NPC’s judgements about who you are when you talk to them.
Next week: with the system in place, I’ll start working on handling the variables themselves, and drawing on the appropriate information, in appropriate contexts, to complete these square-bracketed parts of NPC speech. See you all then!