{"id":440,"date":"2017-09-13T14:54:25","date_gmt":"2017-09-13T14:54:25","guid":{"rendered":"http:\/\/localhost:8888\/?p=53"},"modified":"2017-09-13T14:54:25","modified_gmt":"2017-09-13T14:54:25","slug":"working-with-chatscript-and-unity","status":"publish","type":"post","link":"https:\/\/www.lablablab.net\/?p=440","title":{"rendered":"Working with Chatscript and Unity"},"content":{"rendered":"<p>Author:\u00a0Samuel Cousin<\/p>\n<p class=\"c3\">This document aims to explain most of the technical process and methodology that has been developed by LabLabLab while implementing three natural-language conversational games using\u00a0<span class=\"c2\">ChatScript<\/span>\u00a0and\u00a0<span class=\"c2\">Unity<\/span>. This is not a replacement for either framework\u2019s documentation, but rather something akin to a developer journal, or a specific use case with detailed examples. It should allow like-minded researchers to duplicate and expand this project further.<\/p>\n<h1 id=\"h.y8wkvjdrdg8c\" class=\"c3 c10\">Overview<\/h1>\n<p id=\"h.n6hh06elzgko\" class=\"c3 c10\"><span class=\"c20\">All three of LabLabLab\u2019s games use a combination of\u00a0<\/span><span class=\"c11 c20\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/sourceforge.net\/projects\/chatscript\/&amp;sa=D&amp;ust=1465844281389000&amp;usg=AFQjCNGmR0e1LY2-gFKRgcg2NzRQblSzFA\">ChatScript\u00a0<\/a><\/span><span class=\"c20\">for the natural language component and a Unity made interface exported as a web player package. The frontend and backend communicate through the websocket protocol, which operate over TCP sockets.<\/span><\/p>\n<p class=\"c3 c16\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image03.png\" alt=\"\" width=\"434\" height=\"159\" \/><\/p>\n<p class=\"c13\"><span class=\"c0\">Fig. 1, \u00a0Simplified diagram of the back\/front components<\/span><\/p>\n<p class=\"c3\">Before going further, one should definitely look-up introductory documentation both to ChatScript and Unity, so as to understand how they work from a high level: see this\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/unity3d.com\/learn\/tutorials\/modules\/beginner\/live-training-archive\/introduction-to-unity-via-2d&amp;sa=D&amp;ust=1465844281391000&amp;usg=AFQjCNGaa0FAqcoo3e1wLvoIiytyl-jCDA\">Unity video<\/a><\/span>\u00a0for a quick introduction on how it handle 2D games; the ChatScript\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520Overview%2520Input%2520to%2520Output.pdf&amp;sa=D&amp;ust=1465844281391000&amp;usg=AFQjCNFlfBoWf-eogplOyd-9B02EGpOSHw\">Input to Output Overview<\/a><\/span>\u00a0should explain the basis, although to make to most of this document, I would recommend reading through the\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/6.2f\/DOCUMENTATION\/ChatScript%2520Basic%2520User%2520Manual.pdf&amp;sa=D&amp;ust=1465844281392000&amp;usg=AFQjCNHJ-O4wg23LFUemyDeX34TuzvBhTQ\">Basic User Manual<\/a><\/span>.<\/p>\n<p class=\"c3\">Because most of \u00a0the content is based on the LabLabLab\u2019s games, the reader should also play a bit with\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=http:\/\/http:\/\/www.lablablab.net\/en\/games\/&amp;sa=D&amp;ust=1465844281392000&amp;usg=AFQjCNGMsoDpwK-sGv1N-LwN34qH43-Mnw\">our games<\/a><\/span>\u00a0to understand their gameplay mechanics and how it relate to the technology we\u2019re using.<\/p>\n<h1 id=\"h.sgkcewpnbrd5\" class=\"c3 c10\">ChatScript<\/h1>\n<p class=\"c3\">At the core of the project resides ChatScript, a software created and maintained almost solely by Bruce Wilcox since 2010. It is a complete chatbot engine, used to create complex and rich \u201cconversational robots\u201d, with whom the user can have believable natural language (english) conversations. It implement everything that one might need to do so: natural language parsing, extensive ontologies, conversation volley &amp; rejoinder system, wildcard matching, etc.<\/p>\n<p class=\"c3\">While ChatScript is now well into version 6, the versions used by LabLabLab in production are 5.21 (A Tough Sell)<span class=\"c2\">\u00a0<\/span>and<span class=\"c2\">\u00a0<\/span>5.52 (SimHamlet &amp; SimProphet).<\/p>\n<h5 id=\"h.n7po1n8eqeis\" class=\"c14 c10 subtitle\">Fundamentals<\/h5>\n<p class=\"c3\">ChatScript (CS) works by using a\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ESOTERIC%2520CHATSCRIPT\/ChatScript%2520Control%2520Scripts.pdf&amp;sa=D&amp;ust=1465844281395000&amp;usg=AFQjCNF4wciiWQmBEh9u9mpUsMqNQbtUWQ\">control script<\/a><\/span>\u00a0to direct user inputs towards different topics, where they will be responded to (or not). The matching rules\/responses pairs are implemented using a mix of english, operators, modifiers and functions. Topics are thematically arranged, user-created collections of rules\/response pairs and keywords.<\/p>\n<p class=\"c3\">The control script is a topic as well, but one that is used as a dispatcher for other topics, which makes it a bit less readable. For most usage, the default control script should be sufficient and behave more or less like this:<\/p>\n<ul class=\"c7 lst-kix_gn14bs7lq0pm-0 start\">\n<li class=\"c3 c22\">Determine the current topic of conversation based on keywords or state of execution;<\/li>\n<li class=\"c3 c22\">Try and match the input sentence within the current topic;<\/li>\n<li class=\"c3 c22\">If there is multiple matches, pick the first one;<\/li>\n<li class=\"c3 c22\">If there is no match, try to find a non-keyword response within that topic (this is called a\u00a0<span class=\"c5\">gambit<\/span>);<\/li>\n<li class=\"c3 c22\">If there is no match and no gambit available, try in other topics<\/li>\n<li class=\"c3 c22\">If there is no matches at all, fall-back to a \u201ccatch all\u201d topic where the matching rules are less strict;<\/li>\n<\/ul>\n<p class=\"c3\">When a response is found, the execution stops, the rule\/response pair is marked as used, and the response is sent to the user.<\/p>\n<p class=\"c3 c16\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image02.png\" alt=\"\" \/><br \/>\n<span class=\"c0\">Fig. 2, Execution of a basic CS control script<\/span><\/p>\n<p class=\"c3\">After determining which topic is the most relevant for a given input, CS parses this input to find a rule\/response pair. For a concise explanation of the matching patterns available in CS, one should refer to the\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/V6.2g\/DOCUMENTATION\/ChatScript%2520Pattern%2520Redux.pdf&amp;sa=D&amp;ust=1465844281398000&amp;usg=AFQjCNHFHpmrydWtQbyRTTQ4C8_IZA239w\">Pattern Redux<\/a><\/span>\u00a0documentation available from the\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript&amp;sa=D&amp;ust=1465844281399000&amp;usg=AFQjCNG2TZBtd11N8VFqRC9U5ZOstzcsog\">Github repository<\/a><\/span>. Of course, natural language forces us to assume that most of the time the input will use improper grammar or be incomplete, and CS makes provisions for this.<\/p>\n<h5 id=\"h.q8zydhm7unea\" class=\"c14 c10 subtitle\">File structure<\/h5>\n<p class=\"c3\">Let\u2019s look at how this come together in\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=http:\/\/http:\/\/www.lablablab.net\/en\/games\/simhamlet\/&amp;sa=D&amp;ust=1465844281401000&amp;usg=AFQjCNFP0Y7gr3WdMChxK0BYKTdNuyn6TA\">SimHamlet<\/a><\/span>, first by looking at the file structure inside the\u00a0<span class=\"c5\">\/RAWDATA\/GRAVEDIGGER<\/span>\u00a0folder:<\/p>\n<p>.<br \/>\n\u251c\u2500\u2500 a_concepts.top<br \/>\n\u251c\u2500\u2500 claudius.top<br \/>\n\u251c\u2500\u2500 gertrude.top<br \/>\n\u251c\u2500\u2500 hamlet_jr.top<br \/>\n\u251c\u2500\u2500 hamlet_sr.top<br \/>\n\u251c\u2500\u2500 introduction.top<br \/>\n\u251c\u2500\u2500 laertes.top<br \/>\n\u251c\u2500\u2500 ophelia.top<br \/>\n\u251c\u2500\u2500 polonius.top<br \/>\n\u251c\u2500\u2500 rosencrantz_guildenstern.top<br \/>\n\u251c\u2500\u2500 z_catchall.top<br \/>\n\u251c\u2500\u2500 z_culprit.top<br \/>\n\u251c\u2500\u2500 z_pronouns.top<br \/>\n\u2514\u2500\u2500 z_simplecontrol.top<\/p>\n<p class=\"c13\"><span class=\"c0\">Fig. 3, Directory structure of SimHamlet<\/span><\/p>\n<p class=\"c3\">First off, all CS files use the\u00a0<span class=\"c5\">.top<\/span>\u00a0extension. One can also see that we use prefixes to identify special files. In this case,\u00a0<span class=\"c5\">a_concepts.top<\/span>\u00a0is not a topic, but rather a place where we gathered all of our custom concepts. Since concepts can be compared to constant variables, using a single file to aggregate all of them curbs the problem of having to hunt for them in dozen of files when we want to change something. It is also important to note that having an\u00a0<span class=\"c5\">a_<\/span>\u00a0prefix insures that our concept file is compiled first and made available to files loaded after.<\/p>\n<p class=\"c3\">Our regular topics are simply named with the topic they cover, in this case mostly character names. If they would reference or depend on each other in specific ways, one would want to prefix them them with a number to dictate when they are individually compiled.<\/p>\n<p class=\"c3\">Finally, we have prefixed our system topics with\u00a0<span class=\"c5\">z_<\/span>, which means that they will be compiled after all other files. These files contain most of our script logic and concatenate our controls, making them more easily maintainable. Our control script obviously qualify as system topic (<span class=\"c5\">z_simplecontrole.top<\/span>), just as our \u201ccatch all\u201d topic do (<span class=\"c5\">z_catchall.top<\/span>).<\/p>\n<h5 id=\"h.tnwcd7hy5vw\" class=\"c3 c10 subtitle\">Topics<\/h5>\n<p class=\"c3\">Topics are paramount in ChatScript. From a structure standpoint, they should be viewed as classes in OOP: they are used to make the code manageable &amp; reusable, while splitting it up in logical, thematic files (.top). This underline the importance of a structured outline, since the interactions will need to be divided and grouped together; the clearer the program outline, the easier it will be to break it into parts.<\/p>\n<p class=\"c3\">What these topics consist of depend solely on what kind of narrative arcs we want to create. For\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=http:\/\/http:\/\/www.lablablab.net\/en\/games\/sim-prophet\/&amp;sa=D&amp;ust=1465844281413000&amp;usg=AFQjCNEu4aKJuMSauXJ7AioEJtnxmbJubw\">SimProphet<\/a><\/span>\u00a0we used broad themes such as death, politics and sex to group our matching patterns. For\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=http:\/\/http:\/\/www.lablablab.net\/en\/games\/simhamlet\/&amp;sa=D&amp;ust=1465844281413000&amp;usg=AFQjCNGmI5u2z2BXsbkwAeZjJq5Y3m4M-w\">SimHamlet<\/a><\/span>\u00a0the topics were centered around the characters in the play: Ophelia, Laertes, Polonious and so on. Thorough, requirements from the narratives dictated the composition of topics, once again denoting the importance of mapping out conversational paths well before implementing them. Topics are built around keywords. Keeping in mind the control script outlined above (Fig. 2), consider this arrangement:<\/p>\n<p class=\"c16 c19\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image05.png\" alt=\"\" \/><\/p>\n<p class=\"c13\"><span class=\"c0\">Fig. 4, Topics name and keyword<\/span><\/p>\n<p class=\"c15\">Assuming \u00a0that the current topic is\u00a0<span class=\"c5\">~intro<\/span>\u00a0and that the previous topic is\u00a0<span class=\"c5\">~car\u00a0<\/span>:<\/p>\n<ol class=\"c7 lst-kix_sbecaiwjseo6-0 start\" start=\"1\">\n<li class=\"c12\">The input<span class=\"c5\">\u00a0\u201cDo you own a porsche?\u201d<\/span>\u00a0will check in\u00a0<span class=\"c5\">~intro\u00a0<\/span>topic and not find the keyword, then move to the previous topic (<span class=\"c5\">~car<\/span>), find the keyword, find an hypothetical match and return its response.<\/li>\n<li class=\"c12\">The input\u00a0<span class=\"c5\">\u201cI love meat\u201d<\/span>\u00a0will check in the\u00a0<span class=\"c5\">~intro<\/span>\u00a0topic and not find the keyword, check\u00a0<span class=\"c5\">~car<\/span>\u00a0and not find the keywords, then will check\u00a0<span class=\"c5\">~food<\/span>, find the keyword, find an hypothetical match and return its response.<\/li>\n<li class=\"c12\">The input<span class=\"c5\">\u00a0\u201cI am a dog\u201d\u00a0<\/span>will find no keyword or matches in any of the topics, and will go look up in<span class=\"c5\">\u00a0~catchall\u00a0<\/span>for a response.<\/li>\n<\/ol>\n<p class=\"c15\">This further illustrate why catch all topics should always contain mostly generic rule\/responses &amp; gambits, alongside permanent responses (<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281420000&amp;usg=AFQjCNExvsniem_8t9M48IAom3vvRbm7kg\">see the\u00a0<\/a><\/span><span class=\"c11 c5\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281421000&amp;usg=AFQjCNHTiJ5R5pO_xDkrxIYbBpTgEr2Muw\">^keep\u00a0<\/a><\/span><span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281421000&amp;usg=AFQjCNHTiJ5R5pO_xDkrxIYbBpTgEr2Muw\">and\u00a0<\/a><\/span><span class=\"c11 c5\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281422000&amp;usg=AFQjCNEfWRCTvDoINTPKD3verANNMvoK3g\">^repeat<\/a><\/span><span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281422000&amp;usg=AFQjCNEfWRCTvDoINTPKD3verANNMvoK3g\">\u00a0functions<\/a><\/span>). This insures that all inputs are appropriately responded to, even when we find no match at all.<\/p>\n<h5 id=\"h.po26nncce1ro\" class=\"c3 c10 subtitle\">System topics<\/h5>\n<p class=\"c3\">A different type of topics are system topics, which are used to collect rules that apply to the execution of our script. Marking these topics as system topic will make sure that they are prioritized, never \u201cforgotten\u201d and that their content will not be checked for spelling mistakes. The control script, for instance, is a system topic. By separating our logic code from our regular response topics, we insure that we can maintain our bot more easily and completely oversee the flow of execution through the control script.<\/p>\n<p class=\"c3\">System topics are very important to enforce structure and sanitize or process user input before responding to it. For example, a good candidate for a system topic would be a piece of script that parse the input for a certain word, replace it, and then direct the input the another topic for an actual response. For a list of topic flags (modifiers that can be added to your topics), see page 6 of the\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520Advanced%2520User%2520Manual.pdf&amp;sa=D&amp;ust=1465844281424000&amp;usg=AFQjCNFeq4Ym867qynh9XG9tRoy3N0jDWg\">Advanced User Manual<\/a><\/span>.<\/p>\n<h5 id=\"h.h9mkwbyt9yp4\" class=\"c3 c10 subtitle\">Rule and response pairs<\/h5>\n<p class=\"c3\">One way to view rules and response pairs is as\u00a0<span class=\"c5\">if<\/span>\u00a0statement\u00a0with words being concurrent boolean conditions: if the word is matched, we get a\u00a0<span class=\"c5\">true\u00a0<\/span>and move to the next part of the operation. If all operations add up to\u00a0<span class=\"c5\">true<\/span>, the bot will offer the response. This behavior appears naturally when we start adding literal boolean condition in our match patterns, so the bot respond only if certain conditions that might have nothing to do with the input are met.<\/p>\n<p class=\"c3\">If you have not already, have a look at the\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520Overview%2520Input%2520to%2520Output.pdf&amp;sa=D&amp;ust=1465844281428000&amp;usg=AFQjCNG3MKHe8zdEwCMBgDtKlQX2CF9viQ\">Input to Output Overview<\/a><\/span>\u00a0to get a grasp of how content is matched and responded to in CS.<\/p>\n<p class=\"c3\">The simplest form of a rule \/ response pair could look like this:<\/p>\n<pre id=\"h.8t45uj68ilr9\" class=\"c3 c10\">u: (how be you) Fine thank you.<\/pre>\n<p class=\"c3\">While a slightly more complex example could look like this:<\/p>\n<pre id=\"h.c51vjrqkjipj\" class=\"c3 c10\"><span class=\"c23\">s: PETAPET(!not _~verb _[dog <\/span>cat<span class=\"c23\">]) Wait, you can _0 a _1?!<\/span><\/pre>\n<p class=\"c3\">A bit clarification of the syntax if you are not familiar with it:<\/p>\n<ul class=\"c7 lst-kix_rfeygwu8l1cq-0 start\">\n<li class=\"c1\">We always use\u00a0canonical, lower-case version of words: \u201cdog\u201d will match \u201cDog\u201d as well as \u201cdogs\u201d;<\/li>\n<li class=\"c1\">Same goes for verbs and using them in their infinitive forms let CS match all possible forms and variations;<\/li>\n<li class=\"c1\">Operators such as \u201c!\u201d and \u201c*\u201d are used to expand or restricts matches in different ways (i.e., what we were saying about boolean conditions);<\/li>\n<li class=\"c1\">The very first letter followed by a semicolon indicate what kind of sentences to look for; a question, a sentence or either;<\/li>\n<li class=\"c1\">Underscores capture inputs that can be reused by the bot;<\/li>\n<li class=\"c1\">Tildes mark concepts encompassing many words under an umbrella term;<\/li>\n<li class=\"c1\">Square brackets tells CS to look for only one of the contained word<\/li>\n<li class=\"c1\">A capitalized word after the semicolon create a rule label that can be called directly by using the\u00a0<span class=\"c5\">^reuse\u00a0<\/span>function<\/li>\n<\/ul>\n<p class=\"c3\">It is important to\u00a0remember that by default, CS will erase rule\/response pairs as they are used to avoid letting the bot repeat itself on similar or identical inputs; each rule matches an input will \u00a0be deleted for the duration of the conversation. This can be avoided on certain rule\/response by using the\u00a0<span class=\"c11 c5\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281435000&amp;usg=AFQjCNF1qWjlktroTKfcxpVi7TfhLNUANQ\">^keep\u00a0<\/a><\/span><span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281435000&amp;usg=AFQjCNF1qWjlktroTKfcxpVi7TfhLNUANQ\">and\u00a0<\/a><\/span><span class=\"c11 c5\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281436000&amp;usg=AFQjCNE0F3Ezqkqb3fWIuS48zJP5OaiaRg\">^repeat\u00a0<\/a><\/span><span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281436000&amp;usg=AFQjCNE0F3Ezqkqb3fWIuS48zJP5OaiaRg\">function<\/a><\/span>.<\/p>\n<p class=\"c3\">This is also where execution flow becomes important: the files are parsed by CS from top to bottom, so what is at the top will always be tested out before what comes after.<\/p>\n<h5 id=\"h.kg5nyngcjzqc\" class=\"c14 c10 subtitle\">Concepts<\/h5>\n<p class=\"c3\">Concepts are clusters of related and synonymous terms that we want considered as a group identified by a single term. Members of the concept could be argotic words, misspelled words, variations or even other concepts. CS will register a match on the concept if any of the terms are found in the input. In our CS files, this looks like this:<\/p>\n<p class=\"c3 c16\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image10.png\" alt=\"Selection_004.png\" \/><br \/>\n<span class=\"c0\">Fig. 5, Concepts in SimHamlet<\/span><\/p>\n<p class=\"c3\">Concepts are the green\u00a0<span class=\"c5\">~word<\/span>. You can see that we are using the\u00a0<span class=\"c5\">IGNORESPELLING<\/span>\u00a0modifier, which will mark the terms in parenthesis as canonical and not validate their spelling against the dictionary when compiling the bot. For a list of system concepts (CS 6.3)\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Variables%2520and%2520Engine-defined%2520Concepts.pdf&amp;sa=D&amp;ust=1465844281440000&amp;usg=AFQjCNGUuCKP4H9CddW6DDVvvowS0_4mqA\">see this document<\/a><\/span>\u00a0and for more on concept modifiers, see page 6 (\u201cAdvanced Concept\u201d) of the\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520Advanced%2520User%2520Manual.pdf&amp;sa=D&amp;ust=1465844281441000&amp;usg=AFQjCNGYKlSCKmEBbwkVtltgnF1ZV1kDcg\">Advanced Manual<\/a><\/span>.<\/p>\n<p class=\"c3\">It is also important to realize that since concepts are parsed as arrays and can contain an almost infinite number of words and concepts themselves, they are most of the time interchangeable with regular, single words. Let\u2019s have a look at an example from SimProphet, first with the definition of a\u00a0<span class=\"c5\">~motanciens\u00a0<\/span>concept:<\/p>\n<p class=\"c3\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image07.png\" alt=\"Selection_007.png\" \/><\/p>\n<p class=\"c3 c16\"><span class=\"c0\">Fig. 6, Concepts in SimProphet<\/span><\/p>\n<p class=\"c3\">Which we might use like this:<\/p>\n<p class=\"c3\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image06.png\" alt=\"Selection_006.png\" \/><\/p>\n<p class=\"c3 c16\"><span class=\"c0\">Fig. 7, Using concepts in rules<\/span><\/p>\n<p class=\"c3\">On line\u00a0<span class=\"c2\">288<\/span>, the script will look at the system variable\u00a0<span class=\"c5\">%length\u00a0<\/span>and only go forward if it evaluate to more or equal to 3. Then it will simply look for any words in the\u00a0<span class=\"c5\">~motanciens<\/span>\u00a0concepts that is present in the input, and will output\u00a0<span class=\"c5\">\u201cYou\u2019re using it wrong\u201d<\/span>\u00a0if it finds one.<\/p>\n<p class=\"c3\">On line\u00a0<span class=\"c2\">289<\/span>, the script will look for any word that is present in\u00a0<span class=\"c5\">~motanciens<\/span>\u00a0and, if there is one, will evaluate to true AND captures the word (remember the what the underscore does). It then uses it in the response by using\u00a0the form\u00a0<span class=\"c5\">\u2018_0<\/span>. In practice this means that the conversation could go like this:<\/p>\n<p id=\"h.uvi9p1zbl6z8\" class=\"c3 c10\">Player: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0my god is super ulmash<br \/>\nSimProhet:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Sorry to be that guy, but you\u2019re misusing ulmash.<\/p>\n<p class=\"c3\">In other words, any matched word from the concept can be captured and reused as is, without reference to the concept it is part of.<\/p>\n<h5 id=\"h.bn79yr7paere\" class=\"c3 c10 subtitle\">Variables<\/h5>\n<p class=\"c3\">There is four types of variable in CS:<\/p>\n<ol class=\"c7 lst-kix_qaicagvrw7lb-0 start\" start=\"1\">\n<li class=\"c1\"><span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Variables%2520and%2520Engine-defined%2520Concepts.pdf&amp;sa=D&amp;ust=1465844281451000&amp;usg=AFQjCNGiXHT5XULQPpAFrcdzFmF-a6PxHg\">System variables<\/a><\/span>, prefixed with\u00a0<span class=\"c5\">%<\/span><\/li>\n<li class=\"c1\">Temporary variables, prefixed with\u00a0<span class=\"c5\">$$<\/span><\/li>\n<li class=\"c1\">Regular system-wide variable, prefixed with\u00a0<span class=\"c5\">$<\/span><\/li>\n<li class=\"c1\">Temporary variable for captured words from input, with the form\u00a0<span class=\"c5\">_0<\/span>,<span class=\"c5\">\u00a0_1<\/span>,<span class=\"c5\">\u00a0_2<\/span>, etc<\/li>\n<\/ol>\n<p class=\"c3\">As we\u2019ve seen, variables are vital to the progression of our game. They also make the responses more engaging and personal. This is quite obvious in\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=http:\/\/http:\/\/www.lablablab.net\/en\/games\/sim-prophet\/&amp;sa=D&amp;ust=1465844281454000&amp;usg=AFQjCNGK1PbxgEMcmvQQGK6K2pz4AyvAAg\">SimProphet<\/a><\/span>\u00a0as a lot the the content is generated by the user: god name, follower names, holidays, sacred places, etc. This create supplemental challenges, as some user input needs to be registered exactly as they are typed, even when they are not real words, while other need to be conjugated or made plural:<\/p>\n<p class=\"c9\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image09.png\" alt=\"Selection_007.png\" \/><\/p>\n<p class=\"c9\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image11.png\" alt=\"Selection_008.png\" \/><\/p>\n<p class=\"c9\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image04.png\" alt=\"Selection_009.png\" \/><\/p>\n<p class=\"c13 c19\"><span class=\"c0\">Fig. 8, Variables in SimProphet<\/span><\/p>\n<p class=\"c3\">I\u2019ve only included parts of the routine. Line\u00a0<span class=\"c2\">68<\/span>\u00a0is the first line that is served to the user: the rule name\u00a0<span class=\"c5\">GODNAME\u00a0<\/span>and the lack of any conditional in the rule hint to the fact that this rule is invoked with the\u00a0<span class=\"c5\">^gambit<\/span>\u00a0function.<\/p>\n<p class=\"c3\">To make sure that the matched content will not be corrected, we change the parsing system by modifying the\u00a0<span class=\"c5\">$token<\/span>\u00a0system variable on line\u00a0<span class=\"c2\">71,<\/span>\u00a0omitting\u00a0<span class=\"c5\">DO_SPELLCHECK<\/span>\u00a0for the duration of this rule (remember the linear execution), adding it back at the end on line\u00a0<span class=\"c2\">173<\/span>. Since this line is matched every time and used only to reset the\u00a0<span class=\"c5\">$token\u00a0<\/span>system variable, we move the respond to the next gambit available in the current topic with the\u00a0<span class=\"c5\">^gambit\u00a0<\/span>rule.<\/p>\n<p class=\"c3\">Now line\u00a0<span class=\"c2\">131<\/span>,\u00a0<span class=\"c2\">134<\/span>\u00a0&amp;\u00a0<span class=\"c2\">141<\/span>. They are variation of the same need: we want to break apart each component of the god name, so we must capture them individually. First with evaluate the length, then capture exactly one word (<span class=\"c5\">_*1<\/span>) on line\u00a0<span class=\"c2\">131<\/span>. With the construct\u00a0<span class=\"c5\">\u2018_0<\/span>, we make sure to use the literal rather than canonical form. The splitting allows us to capitalize each word, then join them into our permanent\u00a0<span class=\"c5\">$godname<\/span>\u00a0variable (line\u00a0<span class=\"c2\">132<\/span>,\u00a0<span class=\"c2\">137<\/span>\u00a0&amp;\u00a0<span class=\"c2\">145<\/span>).<\/p>\n<p class=\"c3\">After adding the content to\u00a0<span class=\"c5\">$godname<\/span>, we have three slightly different behaviors. In the first example (line\u00a0<span class=\"c2\">132<\/span>) we offer no response, so execution will move down to the next match in line (in this case, line\u00a0<span class=\"c2\">173<\/span>). In the second example (line\u00a0<span class=\"c2\">138<\/span>), assuming a\u00a0<span class=\"c5\">$godname\u00a0<\/span>variable of\u00a0<span class=\"c5\">\u201cBeetlejuice\u201d<\/span>, the character will respond\u00a0<span class=\"c5\">\u201cBeetlejuice? Never hard of it\u201d,\u00a0<\/span>then CS will affix the next gambit available in this topic. Finally, the last match will simply responds with the response in the\u00a0<span class=\"c5\">~god_identity<\/span>\u00a0topic named\u00a0<span class=\"c5\">INTRIGINGNAME\u00a0<\/span>(line\u00a0<span class=\"c2\">146<\/span>).<\/p>\n<h5 id=\"h.alwwvs8sjflt\" class=\"c14 c10 subtitle\">Special Needs<\/h5>\n<p class=\"c3\">To illustrate other possible usage and how they affect the games\u00a0made at LabLabLab, let\u2019s look at the\u00a0<span class=\"c5\">z_pronouns.top\u00a0<\/span>file in\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=http:\/\/http:\/\/www.lablablab.net\/en\/games\/a-tough-sell\/&amp;sa=D&amp;ust=1465844281468000&amp;usg=AFQjCNH2yIWYCLIvn-QJCi4fqbOiFZjrfw\">A Tough Sell<\/a><\/span>:<\/p>\n<p class=\"c3\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image01.png\" alt=\"\" \/><\/p>\n<p class=\"c3 c16\"><span class=\"c0\">Fig. 9, Pronouns resolution in SimHamlet<\/span><\/p>\n<p class=\"c3\">None of these rules output a response, instead they parse the input for proper nouns and assign them to variables that will be used elsewhere. Since the control script detects that no response has been found, it keeps searching just as it normally would.<\/p>\n<p class=\"c3\">The\u00a0<span class=\"c5\">^refine<\/span>\u00a0function act as a filter that passes the query along further: it first looks for a match in\u00a0<span class=\"c5\">~noun_proper_singular<\/span>, and if it finds one move the exact same input to the rejoinders (lines\u00a0<span class=\"c2\">9<\/span>\u00a0&amp;\u00a0<span class=\"c2\">10<\/span>) where they are further processed. This is not foolproof however, as the name &amp; pronouns could be inferred or they could not be present in ontologies such as\u00a0<span class=\"c5\">~noun_proper_singular\u00a0<\/span>or\u00a0<span class=\"c5\">~noun_plural<\/span>. For example, someone playing A Tough Sell might have this hypothetical exchange:<\/p>\n<p id=\"h.h3fgslqhjws4-12\" class=\"c3 c10\">Player: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0This apple looks good.<br \/>\nSnow White:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Yes it does! I got it from the store.<br \/>\nPlayer: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0It\u2019s very red.<\/p>\n<p class=\"c3\">Trying to match the last sentence, which would be parsed as \u201cit be very red\u201d, might not trigger anything in the apple topic where we want to be looking: nowhere in the query does the word \u201capple\u201d appears. Our mechanism from above is more efficient combined with topic specific pronoun marking.<\/p>\n<p class=\"c3\">What we want to be doing essentially this: for all input in the current topic, replace all pronouns by what we think they point to. One way to do this is to simply parse and replace the terms:<\/p>\n<p class=\"c3 c16\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image13.png\" alt=\"Selection_004.png\" \/><\/p>\n<p class=\"c3 c16\"><span class=\"c0\">Fig. 10, Pronoun marking<\/span><\/p>\n<p class=\"c3\">As you can tell by the line numbers, this is at the top of the file: all inputs that are made while in this topic, regardless of their terms, will go through these six lines. If any of the words highlighted in yellow are found, they will be replaced by\u00a0<span class=\"c5\">apple<\/span>. Adding the\u00a0<span class=\"c5\">^repeat<\/span>\u00a0and\u00a0<span class=\"c5\">^keep\u00a0<\/span>function insures that CS does not discard these lines after they have been matched once. Since there is no response given, the control script will automatically keep searching for a response.<\/p>\n<p class=\"c3\">This brings us to a specific need in the LabLabLab projects: in narrative driven games a lot more than in regular chatbots, it is central to keep track of the subject.<\/p>\n<h5 id=\"h.ixu70l2z9uzm\" class=\"c3 c10 subtitle\">Progression<\/h5>\n<p class=\"c3\">While chatbots need to follow certain narrative arcs to keep up with the conversation, keeping track of progress is a lot more important in games, as they move towards defined goals. How do you bring this behavior out in a stateless system and that is designed to juggle with multiple topic at once? Luckily for us CS has an extensive variable system. Let\u2019s break down the first part of a rule in\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=http:\/\/http:\/\/www.lablablab.net\/en\/games\/sim-prophet\/&amp;sa=D&amp;ust=1465844281479000&amp;usg=AFQjCNHeH9r0N8aokd7dRBKp9dFto4aqKA\">SimProphet<\/a><\/span>\u00a0that uses lots of variable, the rules that register the name of the followers of your god:<\/p>\n<p class=\"c3\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image08.png\" alt=\"Selection_004.png\" \/><\/p>\n<p class=\"c3 c16\"><span class=\"c0\">Fig. 11, Variable in SimProphet<\/span><\/p>\n<p class=\"c3\">This is a gambit named\u00a0<span class=\"c5\">NOMCROYANTS<\/span>\u00a0(line\u00a0<span class=\"c2\">3<\/span>, note the\u00a0<span class=\"c5\">t:<\/span>), which means that the bot will offer this response if:<\/p>\n<ol class=\"c7 lst-kix_ras4i8md991m-0 start\" start=\"1\">\n<li class=\"c1\">All conditions in parenthesis are evaluated to\u00a0<span class=\"c5\">true<\/span>\u00a0when execution reaches this line;<\/li>\n<li class=\"c1\">The bot has been explicitly told to try a gambit and reach this line without a response yet;<\/li>\n<li class=\"c1\">The bot has been explicitly told to use this gambit through the\u00a0<span class=\"c5\">^gambit\u00a0<\/span>function;<\/li>\n<\/ol>\n<p class=\"c3\">Again, let\u2019s assume that\u00a0<span class=\"c5\">$godname<\/span>\u00a0has been set to\u00a0<span class=\"c5\">\u201cBeetlejuice\u201d<\/span>\u00a0and walk through this rule:<\/p>\n<ol class=\"c7 lst-kix_raue0sajfxxg-0 start\" start=\"1\">\n<li class=\"c1\">Since\u00a0<span class=\"c5\">$godname\u00a0<\/span>is set and evaluate to\u00a0<span class=\"c5\">true<\/span>\u00a0but our believers name variable is empty\u00a0<span class=\"c5\">($nom_croyant\u00a0<\/span>is\u00a0<span class=\"c5\">false<\/span>), then we respond with\u00a0<span class=\"c5\">\u201cWhat do you call followers of Beetlejuice exactly?\u201d<\/span>;<\/li>\n<li class=\"c1\">The following rejoinder (line\u00a0<span class=\"c2\">4<\/span>) matches only if the bot find a term from\u00a0<span class=\"c5\">~emmomisunderstand<\/span>\u00a0or<span class=\"c5\">\u00a0~emoignorance<\/span>\u00a0within the input. For example if the user respond\u00a0<span class=\"c5\">\u201cI don\u2019t know\u201d<\/span>\u00a0to\u00a0<span class=\"c5\">\u201cWhat do you call followers of Beetlejuice exactly?\u201d<\/span>, the bot will respond\u00a0<span class=\"c5\">\u201cWhat about Beetlejuicelics?\u201d;<\/span><\/li>\n<li class=\"c1\">On line\u00a0<span class=\"c2\">4<\/span>\u00a0&amp;\u00a0<span class=\"c2\">5<\/span>, we create placeholder variables that will hold variations of the believers name:\u00a0<span class=\"c5\">$$ntemp1\u00a0<\/span>will become<span class=\"c5\">\u00a0\u201cBeetlejuicelics\u201d<\/span>\u00a0and\u00a0<span class=\"c5\">$$ntemps2\u00a0<\/span>will become\u00a0<span class=\"c5\">\u201cBeetlejuice\u2019s Witnesses\u201d<\/span>;<\/li>\n<li class=\"c1\">Then if if user agree that it\u2019s a good name (line\u00a0<span class=\"c2\">7<\/span>) our actual variable,\u00a0<span class=\"c5\">$nom_croyants<\/span>,<span class=\"c5\">\u00a0<\/span>will take the value from\u00a0<span class=\"c5\">$$ntemp1<\/span>\u00a0(line\u00a0<span class=\"c2\">8<\/span>);<\/li>\n<\/ol>\n<p class=\"c3\">Since variables can be either words or numerical values, we can use them to track and change gameplay properties and interface values, like it is done on line\u00a0<span class=\"c2\">13<\/span>. As previously mentioned, this is very important in a game as an end state has to be reached. By using variables and changing them on certain inputs or responses, we collect data that we can feed back to the interface (as ways to keep the score) or the the chatbot itself (as a way to trigger responses).<\/p>\n<h5 id=\"h.repqilxgqiib\" class=\"c3 c10 subtitle\">Part Of Speech (POS)<\/h5>\n<p class=\"c3\">We\u2019ve seen with variables how to capture, assemble and proceed after matching terms that we want to reuse. But what about when we want to modify them according to context? We need to rely on the\u00a0<span class=\"c11 c5\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281494000&amp;usg=AFQjCNHRzlu2lRLycz6G80DuakLHc7iZjQ\">^pos<\/a><\/span><span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/blob\/master\/DOCUMENTATION\/ChatScript%2520System%2520Functions%2520Manual.pdf&amp;sa=D&amp;ust=1465844281495000&amp;usg=AFQjCNGSUFKiuV8x3SM1sbRI19PaUhnTgg\">\u00a0function<\/a><\/span>\u00a0(page 22). Some example with verbs:<\/p>\n<pre id=\"h.18u5cp9f9nyh\" class=\"c3 c10\">s: ([teach show] * you * [_~verb ~vision_verbs act~1]) I\u2019ve always wanted to ^post[VERB _0 INFINITIVE).<\/pre>\n<p class=\"c3\">So that with an input of<span class=\"c5\">\u00a0\u201cI will teach you juggling\u201d\u00a0<\/span>we will receive a response of\u00a0<span class=\"c5\">\u201cI\u2019ve always wanted to juggle.\u201d<\/span>\u00a0The\u00a0<span class=\"c5\">^pos\u00a0<\/span>function can also be used with nouns nouns:<\/p>\n<pre id=\"h.xvxpkz79fq7g\" class=\"c3 c10\">s: (&lt;&lt;~dieu ~punition _ennemis&gt;&gt;) $godname would do that? I have tons of ^pos(NOUN _0 PLURAL)!<\/pre>\n<p class=\"c3\">Still with a\u00a0<span class=\"c5\">$godname<\/span>\u00a0of\u00a0<span class=\"c5\">\u201cBeetlejuice\u201d<\/span>, an input of\u00a0<span class=\"c5\">\u201cGod will punish any rival\u201d<\/span>\u00a0will receive a response of\u00a0<span class=\"c5\">\u201cBeetlejuice would do that? I have tons of rivals!\u201d<\/span><\/p>\n<h1 id=\"h.dk65a2n90571\" class=\"c3 c10\">Unity<\/h1>\n<p class=\"c3\">The front-facing part of our games has been crafted using Unity, a 2D\/3D engine and development environment. \u00a0Unity has quickly become the defacto framework used to create independent games. It offers incredible flexibility with regard to content (file types, platforms, scripting languages) and always has had a free version. \u00a0While Unity is now in version 5.3.X, most of the development was done with versions 4.X.X<\/p>\n<h5 id=\"h.3bflrqd7r6n6\" class=\"c3 c10 subtitle\">Interface<\/h5>\n<p class=\"c3\">The user-facing interface can be anything that communicate with our CS back-end: as one can see in the\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bwilcox-1234\/ChatScript\/tree\/V6.2g\/WEBINTERFACE&amp;sa=D&amp;ust=1465844281502000&amp;usg=AFQjCNGvYlYYapgGBoCXdgZK6UZCgNr-_g\">CS examples<\/a><\/span>, the interface can be completely web based and quite minimalistic. Our need for Unity was born out of the requirements of a richer game interface with asset caching, audio, animations, keyboard inputs and so forth. This distinction between what effectively is the game engine (ChatScript) and the interface (Unity), opens up the possibility of integrating middleware components as well, such as analytics and voice recognition.<\/p>\n<p class=\"c3\">Another benefit is that the two systems can be updated independently; the CS components can be updated often, while the interface can be updated on slower schedule. This removes a lot of the annoyances of having to upload updated build every time the chatbot is updated (which happens often).<\/p>\n<p class=\"c3\">In its Unity interfaces, LabLabLab first used a mix of JS and C#, but finally transitioned into a uniform C# codebase for SimHamlet. Because of certain limitations early on, the connection to the CS back-end has been done in all three game through a PHP file that deals with the socket communication. This file offers an endpoint for our Unity interface to hit with a request and receive responses. It is likely that this could be replaced by a complete\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=http:\/\/csharp.net-informations.com\/communications\/csharp-socket-programming.htm&amp;sa=D&amp;ust=1465844281503000&amp;usg=AFQjCNHegMAqevBlF95lRtZMyCWuAY2eBw\">C# implementation<\/a><\/span>, thus bypassing the need of a PHP server altogether. There is also the possibility of using more of a\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/kuzyn\/lahar&amp;sa=D&amp;ust=1465844281504000&amp;usg=AFQjCNHVCIt8w7HjkEwHxxnroSKvxqlYQA\">fully-featured proxy<\/a><\/span>\u00a0to communicate with CS for example.<\/p>\n<h5 id=\"h.x5ka0e72fw8d\" class=\"c3 c10 subtitle\">Communication<\/h5>\n<p class=\"c3\">Beside sending inputs and getting responses, other informations need to be exchanged between the CS and Unity, such as the state of interface objects or the current game status. This could be done in countless ways. LabLabLab decided to embed specific keywords in the responses, which are in turn parsed by the interface and removed from the final output:<\/p>\n<p class=\"c3\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image00.png\" alt=\"Selection_018.png\" \/><\/p>\n<p class=\"c3 c16\"><span class=\"c0\">Fig. 12, Interface cues embeded in response text, from SimHamlet<\/span><\/p>\n<p class=\"c3\">In the case of\u00a0<span class=\"c11\"><a class=\"c4\" href=\"https:\/\/www.google.com\/url?q=http:\/\/http:\/\/www.lablablab.net\/en\/games\/simhamlet\/&amp;sa=D&amp;ust=1465844281507000&amp;usg=AFQjCNHdXl71ihcY6mTWKeNoilX-VekozQ\">SimHamlet<\/a><\/span>,\u00a0<span class=\"c5\">CLol<\/span>\u00a0and\u00a0<span class=\"c5\">CBored<\/span>\u00a0will be sent as part of the response\u2019s body and indicate to Unity the need to animate the Gravedigger character appropriately. Then Unity will strip the command from the string before displaying it. Of course, these commands can take any form and merely act as action triggers from CS to Unity.<\/p>\n<p class=\"c3 c16\"><img decoding=\"async\" title=\"\" src=\"http:\/\/www.lablablab.net\/papers\/images\/image12.png\" alt=\"Selection_019.png\" \/><\/p>\n<p class=\"c3 c16\"><span class=\"c0\">Fig. 13, Interface reaction on the CLol tag<\/span><\/p>\n<p class=\"c3\">Since the scope of LabLabLab\u2019s games was quite restricted, this straightforward and simple implementation worked out well. However, it requires us to manage parsing on the front end and does not scale very well. To alleviate this, one can imagine a system topic containing a rule or macro appending interface variables to responses. With the help of a control script, this rule could be run after each and every rule\/response pairs and be formatted to minimize front-end processing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Author:\u00a0Samuel Cousin This document aims to explain most of the technical process and methodology that has been developed by LabLabLab while implementing three natural-language conversational games using\u00a0ChatScript\u00a0and\u00a0Unity. This is not a replacement for either framework\u2019s documentation, but rather something akin to a developer journal, or a specific use case with detailed examples. It should allow [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pgc_meta":"","footnotes":""},"categories":[41],"tags":[],"class_list":["post-440","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/www.lablablab.net\/index.php?rest_route=\/wp\/v2\/posts\/440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lablablab.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lablablab.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lablablab.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lablablab.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=440"}],"version-history":[{"count":0,"href":"https:\/\/www.lablablab.net\/index.php?rest_route=\/wp\/v2\/posts\/440\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lablablab.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lablablab.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lablablab.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}