Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

KickStarter Guido Henkel's Deathfire: Ruins of Nethermore - CANCELLED

Zed

Codex Staff
Patron
Staff Member
Joined
Oct 21, 2002
Messages
17,068
Codex USB, 2014
how much money is it in running a dvd review website?
some free dvds, I guess? maybe?
 
Weasel
Joined
Dec 14, 2012
Messages
1,865,735
Guido invented dvd reviewing. But while he was perfecting the plans in his head a few unscrupulous cads stole his idea. It's only fair that he now cashes in with some free dvds. After all, history may not fairly reflect his massive contribution in this field.
 

LESS T_T

Arcane
Joined
Oct 5, 2012
Messages
13,582
Codex 2014
:necro:

Guido started working on a dynamic sentence generation system on Unity 3D that he designed for Deathfire: http://guidohenkel.com/2016/09/simple-text-generation-simply-not-enough/

When simple text generation is simply not enough

One of the key elements in your toolbox when developing role-playing or adventure games is a smart text generation stage that allows you to intelligently create dynamic text strings on the fly so that you can embed item names, monster names, character names and other things right in the text. Simple enough, right? Well, perhaps not as you shall see.

Even in today’s world of high-end RPGs, we still frequently see text output such as this:

Sword taken!
Acquired item: Sword


daitext.jpg
[


I may be over-simplifying this right now for illustrative purposes, but these impersonal, one-fits-all text snippets are the result of over thirty years of trying to avoid one basic, underlying problem—grammar in text generation.


Dynamic text generation adds depth to your narrative

See, in order to keep things a bit more interesting, the designers could just as well have picked a different sentence and made it look like this

Samwise picks up the sword and gives it a quick look-over before stowing it away.

or at the very least, in the fashion of old text adventure games, add an article to the respective words.

You pick up a sword.

Naturally, the requirement for longer text changes with each game. Some clearly keep text short as not to get in the way of gameplay, but games that rely heavily on text are better served with more verbose string generation. It is much more in line with the narrative storytelling that classic role-playing games were striving for, and it would create a whole lot more depth, wouldn’t it? It would, no doubt, and it was one of the key ingredients that made the Realms of Arkania games such a rich and incredibly detailed experience. So why aren’t more developers doing it? Are they truly so afraid that people don’t like to read? Hardly. If any audience in the computer game world is willing to read voraciously, it is role-players and adventurers.


poetext.jpg



No, the reason is purely technical in nature. To illustrate my point, let’s assume for a moment that Samwise is not picking up a sword but some coins instead. In this instance, the text output would have to look like this…

Samwise picks up the coins and gives them a quick look-over before stowing them away.

As you can see, the sentence has changed. Slight as the change might be, it is significant. Because coins are plural, the sentence needs to reflect that, resulting in different pronouns (them as opposed to it).

Things get even trickier when we change the sentence to something more complex like this

Samwise watches an orc pick up a sword, as he gives it a quick look-over before stowing it away under Sam’s watchful eye.


Pronouns and articles can wreak havoc on your sentences

There is, suddenly, a whole lot more grammar we have to deal with. “An orc,” and “a sword” are nouns the require indefinite articles, and as you can see there are different versions of it—“a” and “an,” depending on the word it is referring to. “It” is a pronoun referring to the sword that can change also if we are referring to a noun in its plural form. Then there is “Sam’s,” a genitive case of a name, which can also have different forms, not to mention that we need to distinguish whether we are referencing a general object like ”the orc’s eye” that requires an article, or that of a proper named object, like “Sam’s eye,” which doesn’t.

Here’s an example, how the same sentence changes if we just change some of the nouns it refers to.

The orcs watch an Elven girl pick up some coins, as she gives them a quick look-over before stowing them away under their watchful eyes.

Barely looking like the same sentence, in a way, but if you check closer, you will see that the sentence structure still remained the same.

I am sure you are getting the general idea of what I am trying to illustrate. Any time you make an attempt to dynamically create sentences that may contain any of a number of variable noun references, things can very quickly get rather complicated. You can’t just arbitrarily drop object names in the text and hope it all turns out right.


English is a fairly simple language

Funny enough, though, in English this may actually work quite frequently, especially when you stick with definite articles, but that’s only because English is a fairly simple and straight-forward language—grammatically speaking. When you get into Germanic, Roman, Slavic or Asian languages, all bets are off, because these languages have reams of grammar rules that do not even exist in English. Some feature arrays of pronouns that depend on the referring noun as well as the referred-to noun. Without a proper plan of attack, managing this kind of variety is a futile effort and will inevitably lead to a lot of code duplication and extra programming—or, God forbid, tons of specially written/translated sentences to capture different scenarios.


pttext.jpg



That is the very reason why many developers and designers will revert to the banal, one-fits-all text version I described in my opening. They are easy and safe cop-outs. Not much can go wrong when you essentially talk in bullet points. It’s just not very inspiring and certainly doesn’t help to transport you to another world. Nothing screams Middle-Earth, Tamriel or Azeroth quite like…

Sword taken!
Acquired item: Sword
Spider: 5 damage!
Druid misses Orc

…and neither do dialogues or setups in which everything is static and every step has been predefined without any consideration for character weaknesses or traits to add personality or twists.

A world dense with monsters, characters and items begs for more than banal responses
While developing the Realms of Arkania games, many years ago, the narrative depth was crucial to us. We wanted to make sure that we could easily adapt situations, plots, subplots and sentences to fit all sorts of situations. Those of you who played the games will certainly remember this. With a personalized party of up to seven characters, a world dense with monsters and encounters, and gameplay that featured many hundreds of items, a more strategic approach was necessary, especially because we had planned, from the beginning, to translate the game in different languages.


roatext.jpg



At the time, I developed a system that allowed us to make our text output grammar-aware but in all fairness, it was a rather clumsy, academic approach that was way too convoluted to be useful to anyone without the proper technical background. But it was a first step.

As I began designing Deathfire a few years ago, an RPG I planned on making, I approached the subject matter anew because the focus of the game was on thePsycho Engine, a piece of software that would allow me to dynamically adjust gameplay and the behavior of entities in the game on the fly. Therefore, I needed a maximum of versatility and flexibility, while also making sure the game could easily be translated into as many languages as possible. With a fresh mindset and a bit of development experience in Inform under my belt, I designed a new system.


Grammar awareness also makes translation much easier and safer…

Inform, as you may know, is a programming language specifically designed for text adventures, and, as you would expect, these types of games have the exact same challenges to contend with. The key difference, however, between Inform and my grammar-aware text generation is that the Inform engine actually knows what you are referring to, because everything in the game world is defined in terms of addressable objects, whereas a simple dynamic text generation system is not aware of the actual context and needs to derive the necessary information from somewhere else.


…the grammar logic is in the text, not the programming!

I had never had the opportunity to actually implement the system—it was a spec design on paper, more or less—but in recent weeks, I’ve had some spare time and decided to write a C# implementation for Unity3D. With all of the above in mind, I sat down and created a code module that enables me to easily create dynamic sentences that are grammar-aware and that allow me to use natural language to define a grammatical context. In my next blog post, I will tell you the details, how I went about it. Join me then…
 

Aenra

Guest
Unrelated to T_T's post, as to be frank, text-based adventure games managed as much without automation; just good ole-fashioned developer patience.

Just wanted to say, being reminded of Guido, that to me he's (yet another) example of a capable individual failing to understand where his limits are. One more example of a person capable of producing worthy material, but IN-capable of leading/heading an entire project; and yet going for it anyway. You'd have thought most individuals achieve some degree of self-awareness over the years..
Or, as we say here, man is not a learning animal :)
 

Comte

Guest
Unrelated to T_T's post, as to be frank, text-based adventure games managed as much without automation; just good ole-fashioned developer patience.

Just wanted to say, being reminded of Guido, that to me he's (yet another) example of a capable individual failing to understand where his limits are. One more example of a person capable of producing worthy material, but IN-capable of leading/heading an entire project; and yet going for it anyway. You'd have thought most individuals achieve some degree of self-awareness over the years..
Or, as we say here, man is not a learning animal :)
So basically Guido Henkel is a good example of the Peter Principle.
 
Self-Ejected

HobGoblin42

Self-Ejected
Patron
Developer
Joined
Aug 25, 2012
Messages
2,417
Location
Munich
Codex 2013 Codex USB, 2014
So basically Guido Henkel is a good example of the Peter Principle.

No, that principle has nothing to do with overambitious creative people trying to create meaningful works. And the aim to generate non-simplistic grammar-correct texts in RPGs is still a non-trivial problem especially when you add languages such as German, French or even Russian.

I am sure, Guido is actually capable of designing such a grammar system, but implementing it into a well structured SDK is a different story .
 

pippin

Guest
He is right about narratives in games, though. Most flavor text you get to experience these days comes from overhearing conversations, which are mostly jokes or really just inconsequential stuff, too plain to be really noticed. I remember playing RoA, a game where a kid can throw mudballs at your party for no reason, but it's ok. Or the tavern interactions. The game acknowledged in a very effective manner how drunk your characters get... Which led to funny situations, like the dwarf being the only one who came out drunk instead of the three elves I had in my party. You never notice how relevant a good text feels until you get to experience stuff like that, which feels above mere fluff. It's like having a good and fun DM.
 

Lhynn

Arcane
Joined
Aug 28, 2013
Messages
9,957
Is it me or has guido been a bit depressed lately. Read a few of his latest twitter feeds and he seem to be disappointed with lyfe, or maybe just the industry, i dont know.
 

Beastro

Arcane
Joined
May 11, 2015
Messages
9,435
Location
where east is west
Unrelated to T_T's post, as to be frank, text-based adventure games managed as much without automation; just good ole-fashioned developer patience.

Just wanted to say, being reminded of Guido, that to me he's (yet another) example of a capable individual failing to understand where his limits are. One more example of a person capable of producing worthy material, but IN-capable of leading/heading an entire project; and yet going for it anyway. You'd have thought most individuals achieve some degree of self-awareness over the years..
Or, as we say here, man is not a learning animal :)
So basically Guido Henkel is a good example of the Peter Principle.

His arrogance comes from how people with normal self-esteem or higher overvalue their competency and self-worth while depressive and pessimistic ones have a more accurate and realistic idea their value, despite tending to swing in the other extreme.
 

Lady_Error

█▓▒░ ░▒▓█
Patron
Joined
Oct 14, 2012
Messages
1,879,250
Yeah, I also suspect that the other people who were involved in Realms of Arkania contributed a lot of what he though he could do himself now, but really can't.
 
Self-Ejected

HobGoblin42

Self-Ejected
Patron
Developer
Joined
Aug 25, 2012
Messages
2,417
Location
Munich
Codex 2013 Codex USB, 2014
He was the lead producer for PST.
I'm still laughing about the Thorvalla Kickstarter where he said he was the creator of PST. Not a member of a team - the guy who made it. :)

I doubt he ever said that, from the KS page:

Guido Henkel, producer of Planescape: Torment, is ready to bring you a re-imagined approach to fantasy computer RPGs

From his Deathfire campaign:

Spearheaded by Guido Henkel, co-creator of the original “Realms of Arkania” series and producer of “Planescape: Torment,” “Deathfire: Ruins of Nethermore” is a party-based computer role-playing game with turn-based combat that hearkens back to the Golden Era of fantasy cRPGs, supported by a team that was instrumental in crafting many other classic RPGs.
 

Zombra

An iron rock in the river of blood and evil
Patron
Joined
Jan 12, 2004
Messages
11,842
Location
Black Goat Woods !@#*%&^
Make the Codex Great Again! RPG Wokedex Strap Yourselves In Codex Year of the Donut Codex+ Now Streaming! Enjoy the Revolution! Another revolution around the sun that is. Serpent in the Staglands Shadorwun: Hong Kong Divinity: Original Sin 2 BattleTech Pillars of Eternity 2: Deadfire Pathfinder: Kingmaker Steve gets a Kidney but I don't even get a tag. I'm very into cock and ball torture I helped put crap in Monomyth
He was the lead producer for PST.
I'm still laughing about the Thorvalla Kickstarter where he said he was the creator of PST. Not a member of a team - the guy who made it. :)
I doubt he ever said that, from the KS page:
Guido Henkel, producer of Planescape: Torment, is ready to bring you a re-imagined approach to fantasy computer RPGs
They edited it after he got heckled about it for a week.
 

LESS T_T

Arcane
Joined
Oct 5, 2012
Messages
13,582
Codex 2014
Dynamic Text Generation part 2: http://guidohenkel.com/2016/09/simple-text-generation-simply-not-enough-part-2/

When simple text generation is simply not enough: Part 2

In the last installment I illustrated the immediate difficulties game designers run into when they try to dynamically create text output that takes random game objects into account. Grammar gets in the way…





Today I want to show you how I approached the problem to create my Grammar script package for Unity3D. To understand the approach and its solution, it is best to a look at a sentence in a more abstract form. When we have sentence like this

The orc picks up a sword.

You can break it down into its parts.

[Definite article] [subject] [verb] [indefinite article] [object]

We can now easily create thousands of sentences, using this exact structure by simply substituting its elements. We could, for example, say

Frodo grabs a dagger.

Different sentence—same sentence structure. The definite article is dropped here because Frodo is a proper name, the verb is now to grab, and the object has becomea dagger. Not a whole lot different than the previous sentence, but the fact that the proper name doesn’t need an article is worth remembering.

Another example could look like this…

The orcs grab some swords.

Same structure, but a few more rules kicked into action. Because the orcs is a plural form, the verb form changes as well. The s from grabs has been dropped to reflect the plural. In addition, because swords is also a plural form, the correct indefinite article is now the word some. (It could be omitted altogether just as well, depending on your preference.)

The easiest way to accommodate these adjustments in dynamic text is to create an engine that can generate the necessary sentence elements by itself. In order to do that, it needs some information about the objects in question.

For that purpose, I am setting up a data structure to hold the most basic grammatically-relevant attributes. This GrammarAttr data structure contains info, like the name of the object, as well as its gender, a count and plural flag, a flag to indicate whether it’s a proper name, and a few others.

The name in the structure is using a special format. Because it is not enough to simply drop in the name itself, I needed a format that allows me to generate correct singular and plural names of an object. Since no rules exist for this in any language, it needs to be hard-coded. To make it work I am using a format that consists of the word base, then the extension for the singular form and then the extension for the plural form, all separated by a period. Here are some examples.

Code:
wom.an.en
orc..s

To generate the singular form for woman, I would therefore concatenate the word base wom with the singular ending an. Whereas the plural would consist of the word base and the ending en to create women.

Identically, when creating the singular form for orc, I would take the word base orcand add the singular extension to it, which is empty, so the word remains orc. To generate the plural, we concatenate orc and s.

It is a very simple and very effective process, really, that I’ve been using unchanged for over 20 years. To make thing more convenient, my implementation also lets you drop the periods, if you have a proper name, for example, that does not have a plural form, so Frodo could be simply entered in the system as Frodo, without any periods.





With all the attributed found in the GrammarAttr data structure, we can now go about designing actual tags that we can use to mark up the source text. I decided to enclose all tags with square brackets. This keeps things readable and it allows me to parse tags in the string very easily with a simple Regular Expression.

Since I want to make sure these tags can be easily understood and will help the translation of text into other languages, I decided to use natural language for these tags. In order to dynamically generate sentences like the ones above, my source string would, therefore, look like this

Code:
[The-name] pick[s] up [a-name].

Immediately, I am sure, you grasp the elegance of this because I am certain that just by looking at it, you will instantly understand how it works. But, you may also notice some of the inherent ambiguity.

The sentence contains the tags [The-name] and [a-name]. But how does the program know, which is which? This is where the GrammarAttr data comes in. When parsing the text to generate the final output string, I will pass a list of the referenced objects into the function as a parameter. This means that I will have aGrammarAttr object for the orc, and one for the sword.

Now it becomes a simple matter of reference. In order to tell the software, which object is which, we simply extend the tag and write this instead.

Code:
[1.The-name] grab[s] [2.a-name].

As you can see, some of the tags have a prefix now—once again, separated by a period—creating a grammar context. At the beginning of the sentence, I set the context to the first object (the orc) so the software will generate the output The orc. Note how the capitalized T in The-name indicates that I want the output text to start with a capital letter as well.

The Grammar module will first read the reference, grab the attributes for the first object and extract the name. Then it will slap a definite article in front of it—provided it is not a proper name, which does not require an article—and generates the output.

Naturally, if we were to set that data attributes to indicate that we are dealing with multiple orcs through the use of the plural flag or the actual count variable, the program would generate the respective plural form of the name.

As we move on, we hit the word/tag combination grab[ s ]. Since we have previously set a grammatical context—we are referring to the first object in the list of GrammarAttr parameters—the program can now check to see if there is one orc or many. It will then add the letter s to the verb grab, depending on the status of that flag. This will therefore generate either the sentence fragments The orc grabs or The orcs grab.

The next tag has a prefix once again, creating a new context. We are now referring to the second GrammarAttr object in the parameter list, and we want it to print the name of that object, complete with an indefinite article.

Easy enough. Grab the attributes, generate the name, generate the correct article, depending on the name and the other attribute flags, and voilà, we have a full sentence that says

The orc grabs a sword.

As I pointed out before, by simply changing the attributes in the GrammarAttr data structure, we can now create sentences addressing thousands and thousands of different objects, if we wish, using the same source sentence, all showing up with the correct grammatical rules applied.

Granted, this is a very simple sentence and a very small example, but it illustrates the approach I am taking to generate grammar-aware text strings. If you join me next time, I will show you how other tags allow us to create much more complex sentences, and in a future post, I will also explain, how all this fits into making localization easy and safe. I’ll see you soon…[/quoe]
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom