The pilgrim walked down the hill to the entrance of the cave. A couple of bandits with steel shortswords guarded the entrance. One of them unsheathed its weapon after hearing the creaks made by the leather boots. The other followed after a brief moment.
“You vagrant! Get lost before we skewer you and roast you for dinner!”
The pilgrim shrugged and sighed.
“Sorry… I thought I could take a shortcut to the castle. The lady down the road doesn’t want to mingle with dusty pilgrims, either.”
“Lady down the road? What lady?”
“A lady with flashy clothes and shiny bracelets. She was travelling with a bard and a couple of maids.”
The eyes of the bandits opened, and one of them almost dropped his jaw.
“Come on, Krook! Let’s warn the boys and deal with this lady! But lock the cave door first. We don’t want the filthy pilgrim to take our fine jewels, do we?”
The pilgrim waited for some moments after the bandits had run away, and unlocked the door with a whispered spell. He sighed; it was seldom so easy. Lady Bertha and her goblin-summoning spells would prove a match for the rogues, and her tanks in magical disguise would keep her safe. But the band of heroes would be delayed long enough for him to take the spell tome from the bandits and claim the prize all for himself. He just hated the hassle of combat.
Current online games are all about combat, and a not so smart one after all. We have heard long discussions about the holy triad of tank, DPS and healer and how to handle aggro in mobs. It is a pity that role playing games need to restrict themselves so much that these meager concepts are all that is left from the wealth of fantasy and imagination poured on these games.
The paragraph above represents an example of a more interesting and combat-less scenario. The player contacts some bandits who hold a quest object coveted by two parties. In all online games we can think of, the only real choice would be how to execute the bandits. But here at Brainific we think that it should be possible for the players to take other routes, in a similar way as Deus Ex allows. The pilgrim tricks the bandits into choosing another prey, and takes advantage of this situation to take the quest object alone. All this without a single drop of blood (spilled by him, anyway) and a single Open Locks spell. But what wondrous piece of automated logic could possibly enable this scenario?
Natural Language Processing
The first piece in the puzzle is Natural Language Processing. NLP is a very broad area, covering many difficult and complex (as in EXPTIME complexity) problems. Not so recently, IBM’s Watson has cracked quite some nuts dealing with natural language in different areas. Regarding games, restricting the domain may be the answer. After all, we deal mainly with conflict in RPG games, so we can leave out entire language areas. In Brainific we are exploring the content of Morrowind with Stanford’s CoreNLP and NLTK packages to see what subsets are enough for fantasy RPGs.
Natural Language Generation is also a useful technique. Even if the content to deliver is the same in different situations, different phrases, structures and slang can be used to render them unique, akin to “color schemes” in stereotyped characters. This could also provide stereotypes to guide the human player’s actions, in an unfortunate reflection of the real world.
Unfortunately, to be able to say something interesting we need some kind of formal language to which our language can be translated. That is, the listener needs to build a model of what the speaker is saying. Richard Montague tried to tackle this problem using a higher order logic system with modalities and other mechanisms, called Montague semantics. This problem will lead us into the following technical area that we need to tackle.
The term “modal logic” encompasses whole families of logics that use predicates relating other sets of predicates (at least, in one of its interpretations). Human thought is complex enough to incorporate at least several modalities:
- Temporal: reasoning about the past, or what could happen in the future.
- Dynamic: reasoning about what becomes true after performing an action.
- Doxastic: reasoning about beliefs, that may or may not correspond to the real situation.
- Multiagent: reasoning about what other people are thinking (yes, this includes what they think we think and what they… well, you sure get the point).
- Public announcements: reasoning about how one’s knowledge changes after hearing statements from other agents.
These logics often use a “possible world” semantics, where a logic proposition evaluates to true or false if some or all of a number of related “worlds” (those reachable by the modalities’ accessibility relation) hold another proposition. For example, a temporal logic may have a LATER(P) operator that holds true if P is true in the future (which is definitely another “world”). The logic used in these worlds is usually propositional or first-order logic. However, current logic tools (which mainly amount to production systems) in games and other sectors can hardly manage first order logic, let alone modalities.
Agent Communication Languages
Although they were initially designed for machine-to-machine communications, and they are almost 15 years old, the FIPA ACL specifications contains a library of communicative acts that is fairly complete, and contains a semi-formal description of the expected changes in the listener’s mind when certain acts of speech are used. This description can be used to infer the changes in the listener’s minds. For example, we can find a definition for a communicative act of “agree” in <here>:
<i, agree (j, <i, act>, φ))> ≡
<i, inform (j, Ii Done (<i, act>, φ))>
FP: Bi α ∧ ¬Bi (Bifj α ∨ Uifj α)
RE: Bj α
α = Ii Done(<i, act>, φ)
where RE stands for “rational effect” (a sort of desired postconditions) and FP stands for “feasibility preconditions”. The whole definition means that “agent i agrees before j to execute act only if φ is true before”, and that translates into “agent i informs agent j that agent i INTENDS to do action φ”
As we can see, the FIPA ACL primitives relate to Searle’s speech acts, and use the BDI logic framework that comprises modalities addressing beliefs and goals. In our opinion, the BDI logic used in the FIPA standards lacks a proper formalization and theoretical support. Also, temporal aspects or dynamic epistemic aspects are not properly modelled in the standard. Lastly, FIPA ACL is oriented at cooperating agents, and so does not cover such “relevant” interactions as threats or manipulation.
In its broadest sense, an exchange of phrases can be thought as a turn game in which each player must maximize the return of their actions. In the described case above, the bandits realize that they gain nothing by staying there and punishing the pilgrim, and instead take the action of running to the travelling lady to relief her of her riches. As we have explained in our previous section, this action becomes “enabled”, or ready for selection, since a new object appears in the bandits’ minds to which the “rob” action can be applied. The use of planning algorithms that maximize a benefit from a certain initial state by selecting the appropriate actions are clearly useful techniques for an exciting and intriguing conversation in a fictional discussion. Some actions (sensing actions) even allow the user to probe its surroundings and further refine their plans. Academics like Thomas Bolander or Jan van Eijk apply modal logics as described above (mainly dynamic epistemic logic) to planning in the hope of devising more powerful planning algorithms.
Planning can also be useful for NLG. Even though many NLG systems use generative grammars, like Tracery, there have been some experiments applying proven planning algorithms to language generation. These algorithms, as opposed as purely generative systems, can keep a “goal” state to guide the language generation.
Fiction or live action?
As promising as the theories and technologies described here may sound, state of the art tools hardly implement any of them. Scripts, chatbots and simple planning are still used or considered top-notch in current games. Here in Brainific we hope to research existing tools and develop new ones to expand the limits of tomorrow’s narrative games. Stay tuned!