This week has been a week of consolidating everything that was in place so far, continuing to test and refine and test and refine over and over the speech generation and the flow of sentences, moving around some of the code so that it can be handled more efficiently, and thinking about handling sentence variables in the future, which is to say, the parts of sentences which are things like “[god]” or “[nation]”, and therefore have to vary every time the same sentence is uttered. As such, here’s this week’s fairly substantial update:
- Thanks to some great suggestions left in the comments list in the blog post from two weeks ado, I’ve added in a number of new responses. If you’re asking someone about a potentially suspicious topic, and you’re in a region with guards, they might (if they really like you) say something like “You shouldn’t ask such things, the guards will think you’re a spy!” or something of that sort.
- Equally, if you’re asking a particularly “academic” rather than “practical” topic – the difference between “what is the nearest mountain range?” and “what is your religion?” – they will sometimes, very rarely, say “I don’t know, but you should go and ask [expert]”. I think these are both great changes, and again, add even more speech detail to the potential library of sentences the player will actually encounter. However, again, to prevent farming, there’s now basically a hidden counter, which varies significantly from iteration to iteration, and affects how often people will recommend that you go and talk to somebody else about the topic in question; equally, you need to be talking to people who both a) have the knowledge and b) have the inclination to recommend an expert, which will be a fairly small number of NPCs.
- I then spent quite a bit more time developing the above in order to maximise the detail that people can offer the player, the variation in the sentences the player will read, and integrating all of this will knowledge and mood modifiers. So, now, if you hang around in a shop, and then a random person comes in, and you ask that person about the currency of their nation, for example, if they don’t want to respond they will point you towards the merchant in that shop, knowing that a) they and you are in a shop and b) you are asking a question that it would be relevant to talk to a merchant about and c) there is also a merchant in this shop.
- These responses also vary depending on whether you’re in the nation or church relevant to the person you’re speaking to. So let’s say you ask someone something, and the relevant answer would be “You should ask a noble”. If you’re in the mansion of a noble from their civilization, they’ll say “You should ask a noble, such as the one in this mansion” or whatever; but if you’re elsewhere, they’ll say “You should ask one of our nobles, who dwell in accommodations like these”; if you’re right nation but outside and in the right district, they’ll say “You should ask a noble; several have their mansions here”, or in wrong distract, they’ll say “You should ask a noble; many dwell in our richest district”. Equivalents in a foreign nation would be “You should ask one of our nobles, who dwell in a district much like this”, or “You should ask one of our nobles, who inhabit the richest part of my home city”. The game can therefore now generate appropriate sentences both based on the player’s location – right building, right district, or just overall right region, or overall incorrect region – and the relationship between the person you’re talking to and the area you’re talking to them in (especially relevant when you run into people who aren’t native to the state they live in, for example).
- I have to be honest and say that I’m extremely happy with how this context-specific recommendation system has developed; I’m really hoping this will produce some strikingly specific procedurally-generated sentences for the player to encounter in appropriate situations, and as ever, just generally provide greater variety in the conversation system. There are also a bunch of sentence possibilities which might be generated that I know are currently impossible, but might become possible later once the potential actions and schedules of NPCs expands further.
- Going back to repeating questions, if you ask X, and then you ask X again, sometimes on the first repetition people will now be confused rather than annoyed or bothered; they’ll say “Didn’t we just discuss this?”, or “That’s strange, didn’t I just answer that?” or something like that; the potential mood drop will be the same, I think, but it’s just another little bit of detail for some NPCs.
- Thanks to an outstanding suggestions left on the Bay12 forums, there is now a little bit of extra conversation detail in there which I hadn’t thought of. If you ask something, and get a positive response (they answer your question), when you say the next thing you say, it’ll normally start your next question with “Thanks” or “Understood” or “I appreciate you letting me know” or things of that sort; equally, if they didn’t reply, your next thing will often start with “Apologies” or “Ah, okay” or things of that sort. This adds a nice little bit of extra flow to the conversations; naturally even more flow will be added once they can ask you questions back, but for the time being, putting these in 50% of responses definitely makes everything look a little more human once more.
Next week’s blog entry will be a little different: I’m in the final fortnight of the extension period on my first book, and this week’s absolute priority is finishing that off. Next week I’m going to have the first non-URR entry since development restarted and write up some reflections on writing such a long piece of work about games, what I’ve learned from it, my future writing plans, and so forth; there’s just no way I’ll have more than a little time in the coming week for programming, and I’d rather return with a blast the week after. See you all next week!
Only a short update this week, I’m afraid; this week I’ve been busy putting some of the final touches to my book and haven’t had as much time to program as I wanted; only half a day rather than a full day. As such, this week’s update is very short, but next week’s should be longer. However, in light of my new decision to have a gradual update log, I’m still going to do this post and then next week’s, instead of compressing both updates into one longer update. As such, this week:
- Most centrally, I’ve finished the task of moving the code that exchanges default words for the preferred word of a given civilization. In some cases this was being called twice, and in other cases not at all, and even though in some cases it was correctly being called once, the range of situations this was being used in were making it all rather unclear. I’ve finished making this shift, which required moving around quite a bit of the sentence generation code and adding some new code to re-handle things like punctuation and capitalisation, but I think that’s now done and working correctly.
- I’ve been going through and removing a lot of phrases, and a lot of word orders, which sound strange. As several people have pointed out, sentences could sometimes come out rather strangely; I’ve tried to fix as many of these as I can. At the same time, though, some of the interesting but logical sentences are generated from the same sources as the interesting but illogical sentences; it’s tricky to strike the right balance here. As ever, I think this will just need lots of playtesting.
- Just stated sketching out (on paper) a list of the bugs and small issues that need to be resolved before 0.8 is released; I had a bunch of smaller lists of this sort, but I hadn’t really collated them into one place before. For some of the bugs I’ve decided they don’t need fixing until 0.9, and some of them I decided it was easier to simply remove the thing that caused the bug (temporarily) than to fix the bug now; as I’ve said several times, I’m really trying to do the absolute minimum now required to get 0.8 released, and putting some of this stuff off until 0.9 is definitely the way to go.
I’m afraid that’s all for now, folks. Should get a full day to code next week, so should be back with a larger update next time around. See you all next weekend!
Lots more coding this week! Let’s get to it:
- I’ve implemented what happens when the player repeats compliments and insults over and over again (I have previously implemented the repeating of “general statements and questions”, i.e. almost everything, and repeating greetings, which are handled differently). When one says a compliment over and over, the NPC will appreciate it, and express their appreciation, but if you do it too much, they will begin to be a little bit puzzled; there are also some unique responses for repeated greetings being offered to particular classes of NPC. In the future I want to enable some greetings to be met with less positive responses if one greets repeatedly someone who might come from a culture which doesn’t especially like or appreciate the greeting in question.
- If you repeat the same insult again, the NPC will quickly become even more annoyed than if you had simply said the insult once (which is itself a guaranteed mood drop) and will tell you to stop saying it, threaten you, become exasperated and ask why the hell you keep saying that, and so forth. Given that insults are unequivocally, well, insulting, this was a pretty easy group of phrases to code. I have also made it so that three or more insults in a row always has a 50/50 chance of ending a conversation: so be capable who you have a go at!
- There was a bug with repeated comments; sometimes the game would seem to forget that you’d just asked something ten times, and if they answered, then said “why are you still asking this?” nine more times, on the eleventh time they would suddenly reply again. That was from the simplest of typos where the game was decided what kind of “why are you still asking this?” response it would give, where very rarely the game would select one which didn’t actually exist, and therefore default back to the previous sentence. This is now fixed.
- The game previously only checked if someone’s mood had dropped to 1 or 0 to decide whether or not to end a conversation; this meant that if an NPC’s mood dropped from 2 or more to -1 or less, the game wouldn’t catch it, and they would go on talking and hating you, but not ending the conversation. This has also been fixed, and NPCs will end the conversation with you regardless of how low it drops. (It should be noted, the conversation does not literally “end” at this point; I need to add a dialogue box saying “This NPC has walked away” or whatever, and “Press Enter” to then end the conversation. I’ll be doing this before 0.8 is released, and shouldn’t really be too difficult; I’ll also need to add something when you talk to an NPC who has rejected you again, such as “I’ve told you, I have other things to do”, and the like).
- I’ve given each civilization a list of reasons they might not want to respond to questions about particular topics. So people from an Isolationist nation might be disinclined to answer national or political questions because they are very wary of outsiders; someone from a theocratic nation might be disinclined to answer a religious question because that’s a matter for the state; and so forth.
- Fixed a range of grammatical errors with the construction of sentences ,and discovered that in some cases, sentences were going through the system that varies each sentence for each culture twice, which was a big problem. That has now been fixed, shifting the “sentence varying” part of the process to something which only takes place once, and before. Before release I will need to spend quite a bit of time talking to every NPC I can find and dealing with every grammatical error I can possibly hunt down, but it’s a work in progress; the speech generation system is so complex, and so much varies, that it’s hard to pin down too much in any one sweep.
- If people don’t want to respond to the questions you’re asking for personal reasons, there is now a set of responses in place for them explaining that they don’t want to respond for political reasons, or for religious reasons, or whatever. There are also some unique responses if you’re asking particular classes, so an inquisitor might mention it’s particularly suspicious if you keep asking about heresy. What this means if that there are many, many layers of questions and answers that the player will rarely, but sometimes see, and should provide a lot of variety. In this case, you need to ask someone something, it needs to be a topic they would be willing to reply to, and know something about, but they don’t want to talk about, and they decide not to talk to you about it, and they’re of a particular class and asking a particular question, you’ll get a unique response. I want these chains to be as long as possible, to maximise the chance of the player encountering a new response, no matter how long they’ve played the game.
- I’ve put a lot of work into these responses, which take three forms: “uninterested” (the person doesn’t fancy talking about the topic), “stupid” (they think it’s a dumb question to be asked), and “suspicious” (they are troubled by you asking something).
- In the case of the “Uninterested” response, they will begin with a sentence along the lines of “I don’t want to answer that” or “I don’t feel like talking about that”. After that, they will follow up with a comment that might be a general comment, or a class-specific comment. If it’s a general comment, they might say “It doesn’t really interest me”, or “I don’t think about such things”, or “Aren’t there other more interesting matters to discuss?”, and so forth. Class-specific, meanwhile, might be something like a miner saying “I should really get back to the seam…” or a priest saying “I would really prefer to speak to you about [god]”, or things of that sort. These have a nice variety, and I was able to think of at least three options for every class, as well as many general variations, all of which will of course vary across culture as with all sentences, so there’s a huge amount of variety here in the kids of responses one will get out of NPCs.
- With the “Stupid” response, NPCs will instead open with something like “What a weird question” or “What a strange thing to ask me”, and then proceed to again, either give class-specific or general responses. General responses might be something like “Am I really the person to ask about this?”, or “That makes very little sense”, or “Why are you even asking?”. For the class-specific responses, they will reply in a way that emphasises why this was an especially daft question to ask that NPC class. If you ask a jailer about geography, they might say “My work is in here, and always will be”; if you ask a Concubine about war, they might say “What could I possibly know of battle from in here?”; if you ask a doctor about politics, they might say “Diseases and ailments care not for one’s political allegiance”; and so on. These should help the player to think about what kinds of things they should be asking different kinds of NPCs, what classes and questions make sense together – as well as what classes and questions definitely do not make sense together – and, as ever, dramatically increase even further the variety of things people might say to you in the URR world.
- For “Suspicious” answers, they start off the same as the “Uninterested” answers, by saying “I don’t really want to speak on that” or whatever, but then things change. For each tag (“political”, “religious”, “geographical”, etc) some NPC classes have special responses, and all have a set of general responses. For example, asking about politics to a concubine might have them ask if you if you’re only asking because of their closeness to a ruler; for other classes, they might say “Politics is a strange topic for you to be asking me about…”, or equivalent. If one asks an individual question, a clerk might emphasise their personal life has no bearing on their work, or an inquisitor emphasises that their purpose is simply to pursue heresy, not to think about themselves. If one is asking about military matters, an officer might question why you want to know about potentially classified material, whilst someone from a militia questions why you’re interested in the defence of their homeland. There are then also some responses based on national ideologies, too, which will sometimes be thrown into the mix. Again: maximising number, maximising variety and difference, maximising the potential for the player to always be discovering new possible responses.
For this week’s sole coding screenshot, here’s a bunch of the “defaults” for the uninterested answers (which are picked at random, then varied for each culture according to procedurally-generated constraints and norms, as usual):
Next up: in the coming week, my objective is to finish fixing any remaining bugs to be found in the above set of points, and then start – I anticipate this taking several weeks – putting into place a structure for filling in the “[god]” and “[nation]” and whatnot parts of sentences, i.e. the parts that vary every time they get uttered and cannot be stored, but have to call reference to a wide range of different saved elements of the game world. I have no idea how fast/slow this will go, but all I can do is get started, so I’ll be doing that next Saturday/Sunday. See you all next week for the first steps into this crucial part of the conversation system!
This week I’ve basically been playtesting everything that I coded in the previous three weeks since development actively restarted: this meant playtesting the mood system, playtesting NPCs becoming annoyed with you, making sure NPCs can say a tremendous range of things when you ask repeated questions (as ever, variation and believability are central here, and the two go hand in hand), and then seeing what happens when you ask NPCs all the questions you can ask, and making sure they can give some kind of logical response to them. NPCs should also be able to end conversations, make appropriate comments when they don’t want to respond something, choose what to not respond to, and so forth. I’d say pretty much everything in this selection seems to be working now! Here are some nice screenshots, all taken with one person from one civilisation for each demonstration. You’ll note the [thing] sections remain ambiguous, which is one of the tasks for the coming weeks, but hopefully here you can begin to see how NPCs give you reasons for not responding in various ways, or commenting when you say the same thing too regularly:
Some more work still needs to be done on the “naturalness” of what people say, and ensuring variation of all sentences, and so forth, but you can immediately get some idea from these about how things are shaping up with some of their more detailed responses, and the variety in responses, and there’s also of course a vast amount shown here with unique responses for certain classes, certain questions, certain questions asked to certain classes, asking certain classes from certain nations about certain topics, and so forth. As above, my goal is always to ensure the player might be able to see a new kind of statement in a new context, something that makes the conversation system feel truly deep and open-ended and potentially-infinite, whilst also being able to understand the many factors and many elements encouraging the NPCs one meets to respond in the ways they do. (One might also note a strange name for one NPC – need to fix that! I also got one NPC called “Son of Sluts”, which was pretty great – I’ll be sure to add that to the list of excluded terms). These screenshots have also shown me I need to find a way to add more facial variation to people from the same racial background; although in a global sense the variation is still huge, people will be spending significant blocks of time in one area, and that needs to vary more. I won’t be doing that in 0.8, but probably in 0.9. Next week: more conversation programming! Will be focusing on expanding “uninterested”, “stupid” and “suspicious” responses, people giving political or religious reasons or whatever for not answering things, and how to handle repeated insults and repeated compliments. See you then!
Before anything else, I had some unexpected donations this week. I don’t push for donations – although such a button is hidden on my site – but one donation in particular was unusually generous this week, and I must express my sincere appreciation to BP (that seems anonymous enough!) for the support; it’s very generous and very much appreciated. Otherwise, I am pleased to report another productive week of coding for the books. Instead of playtesting everything I did last week, I decided to add another large body of new code, then playtest everything from the last three weeks next week instead. So, here’s the new code implemented this week:
- Most importantly we have three new elements that influence how NPCs respond to conversations: sensitive topics are “tagged” as such, NPCs are more or less inclined to respond to those sensitive topics, and they have three kinds of basic responses when explaining why they don’t want to respond to something you’ve said for personal reasons (as opposed to not knowing the information, which is factored in elsewhere, and isn’t a case of “not wanting to reply”, but rather “being unable to reply”).
- Every possible question now has what I’m loosely calling a “conversation tag”, which denotes whether it might be a sensitive topic on any of seven possible axes – “individual”, “political”, “national”, “religious”, “military”, “cultural”, “geographical”. Some of the questions will be potentially sensitive on more than one count. For example, if you ask about the politics of an NPC’s nation, that will naturally be flagged under both the “political” and “national”. Most questions have no tags, then it looks like around a third have one tag, and then a very small number have two tags or more; the most tags are questions asking people about the ideologies of their nation, which might be “political”, and “national”, and then “religious” or “cultural” or whichever other applies. What this means is that when you ask someone a question, it will check whether this is a sensitive topic, and the answer to that question will influence whether or not they are willing to give you an answer at all.
- Then the next part is inclinations – how inclined are people to tell you about potentially sensitive topics? Each NPC has a rating for religious topics, for political topics, and so forth, which varies hugely across NPC classes. This is on an internal scale of 0-4; at 0, they will rarely talk to you about a sensitive topic (of the sorts listed above), at 4 they will always talk to you (extremely rare: only national and religious leaders, and then one NPC class per category, will always tell you about X). All other classes are spread out along 1-3 (default “humans” are almost always on 0, or if not, they are on 1 instead). If you ask a non-sensitive question, whether or not they answer will be dependent on other factors (how much they like you, etc) – if you ask a sensitive question, it will check which conversation tags are listed for that question, and compare their rating.
- This might seem incredibly complex, so here’s an easy example. You ask someone about their religion. The game checks how inclined that NPC class is to talk about religious matters; a priest is very inclined, your average innkeep doesn’t have much time for religious matters, and so forth. An appropriate die is then rolled for the question; if successful (and other tests are passed, e.g. the NPC likes you enough), you get your answer. So what happens if they say they don’t want to talk about X?
- Well, I’ve split the “I don’t want to talk about X” into three categories, I’m calling “stupid”, “uninteresting” and “suspicious”, which are the reasons NPCs will give you for not wanting to give you a reply. The “stupid” option means that the NPC is baffled why you are asking them about that particular topic: for example, asking a monk about military matters, or a farmer about sculpture, or an officer about plant life, is likely to elicit this response. The “uninteresting” options is the default, and simply means the NPC doesn’t want to talk about it right now, for which they might give a bunch of reasons. The “suspicious” option means that the NPC refuses to talk on the topic, and is puzzled, concerned, worried, anxious, or most obviously suspicious about why you ask – this happens most often when happening about military matters, but can crop up for any conversation topic except the “cultural” ones.
- In some cases NPCs will give you a specific reason for not wanting to continue the conversation. If you asked about a religious topic, and they don’t want to reply, and they are from a particularly zealous nation, they might say something like “That knowledge is only for loyal followers of [god]”; or if you asked about a political topic, and they are from an isolationist nation, they might explain a dislike of talking to strangers about the politics of their homeland.
- So, a “I don’t want to reply” looks like the following. If “Uninteresting”, they say “[Sorry, I don’t want to talk about that]. [Cultural reason why not]”. If “Stupid”, they say “[Am I really the person you want to ask/I dislike that topic/why are you even asking this?]” (without cultural reason). If “Suspicious”, they say “[Cultural reason why I can’t answer. And why are you even asking?]”.
- I noticed very few questions have the “Cultural” tag – I’ll have to add some more in later versions.
So: these were the things that last week I wanted to get done this week, and they’ve been done. Very please with the week’s coding! You’ll also probably note there are a lot of elements going into how and whether NPCs reply to you. What is their mood? What culture are they from? What culture do they think you are from? What topic are you asking them about? How has the conversation previously played out? What NPC class are they? And if you’re thinking this is a lot… it is! But I think this is what goes into making a reasonably realistic, and hopefully gameplay-interesting, conversation system. When you “fail” to get a reply, for any of the above reasons, the “failure” messages are all being designed so that you know why you didn’t get a response. If the NPC didn’t reply because they don’t like you, because you’re asking about a sensitive topic, or because they dislike the nation you seem to be from, it should always be clear, and allow the player to learn what it takes to find people who are willing to talk to them, and to talk to them in an appropriate way to actually get an answer.
Next week: playtesting and screenshots!