Finishing 0.8 Part VIII

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

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!

Be Sociable, Share!

18 thoughts on “Finishing 0.8 Part VIII

  1. “the system whereby an NPC looks at you and draws judgements about you ”

    You may be interesting in “Urbz: Sims In The City”, which has a similar system (although using hardcoded subcultures instead of procedurally-generated simulations). This link provides more details on how it works: http://urbz.wikia.com/wiki/Clothing

    While the system seemed interesting, it did cause me to feel disconnected from the subcultures I’m interacting with. Every time I enter into a new subculture, I dart straight to the store, buy up all the clothes associated with that subculture, and then discard all the clothes that I wore at the previous subculture. Essentially, it made me conceive my character as a “fraud” or a “poser”. In this type of game though (where the goal is to infiltrate rival cultures and unmask a conspiracy), you might actually *want* the player to feel this way about their character.

  2. A question that has nothing whatsoever do to with this post:

    Since all the things an NPc is using have procedurally generated graphics, as do doors and other htings, and the game knows the location of everything in the screen since it needs that info to sidplay the charcters int he correct place How dificult would it be to code a “Screenshot button” that takes teh info of the currently screen and generates an iconographic view like this one, but with your procedura graphics?

    https://crawl.develz.org/tileimgs/tiles.png

    • …or underscoring, or any other method to make them more easily recognizable… look at the code in a year, and you think „what the heck is [ambiguousnameofchoice] supposed to refer to, I should have taken notes”.

      • (user presses C-f)
        (response from program:) I don’t keep an index of your stuff, you know. You should have taken notes…
        ;-))

        This actually happened to me once… although the combo was different. The programmer obviously had humour while he had coded his error responses.
        Oh, and be careful with „never needing to return”… I know a lot of guys who learned to swear like a spanish shipwright this way. 😉

  3. Hey, Mark, I thought you wanted to leave that stuff for 0.9 and get 0.8 out? 😉
    (don’t worry, just joking, I know how intoxicating it can be to fully implement a thing which doesn’t satisfy your ideas/plans yet… IMHO you should finalize 0.8 now, get a few weeks of holiday from programming and then take care of 0.9 with refreshed resources and a free head. Just given as a well-meant reminder to pull the brake now and then 🙂 )

    Regards, see (read) you soon!

    • Me too :(. And urgh, thanks for spotting that; I’ve purged all the recent bot comments. I should have responded to all the incredibly kind comments folk have left earlier, but moving myself 4200 miles away was just SUCH a monumental task that everything else really fell by the wayside.

Leave a Reply

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