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

Lady_Error

█▓▒░ ░▒▓█
Patron
Joined
Oct 14, 2012
Messages
1,879,250
Russian and German. Though Brazil alone has more people than either Germans or Russians. Not a good CRPG market?
 

LESS T_T

Arcane
Joined
Oct 5, 2012
Messages
13,582
Codex 2014
So he "solved a problem that has limited game developers for three decades", and released the plugin on Unity Asset Store: http://guidohenkel.com/2016/10/simple-text-generation-simply-not-enough-part-3/

https://www.assetstore.unity3d.com/en/#!/content/71557



Now that we know how to create a grammar context and how to reference differentGrammarAttr objects in our parameter list, as shown in last week’s simple example sentences, let’s take a look at more complex scenarios.

Code:
The nazgûl draws his sword and plunges it deep into Frodo’s shoulder.

This is a reasonably complex sentence, I think, that can occur anywhere in any role-playing game. Without a proper dynamic text system, it is hard to fully take control of it, and it would require a lot of a special coding to catch all possible cases, however. For us, its challenges are solved in a breeze.

Let’s look at the structure of this sentence first and break it down, like this.

Code:
[Definite article] [subject] [verb] [possessive pronoun] [object] and [verb] [personal pronoun] deep into [definite article] [secondary object] shoulder.

A lot going on here, wouldn’t you say? Using my Grammar engine, however, this entire structure is easily represented in this way.

Code:
[The-name] draw[s] [his-her] [2.name] and plunge[s] [he-she] deep into [3.the-name][‘s] shoulder.

Once again you will notice the elegance of the implementation because Grammaralways makes sure that the source sentence remains readable and understandable. This will be especially important once you try to localize your text. In those instances, cryptic implementations will instantly cause trouble and create translation errors that are time-consuming to catch and handle.

To further illustrate the power of the Grammar module, here are more possible, dynamically created output sentences stemming from that one template. As you will see, none of them feels like a cheap cop-out that attempts to circumvent grammar issues the way all-too many games do.

Assuming that all nine ring wraiths descend upon the poor hobbit in our previous example, we would get this result.

Code:
The nazgûl draw their swords and plunge them deep into Frodo’s shoulder.

Notice, among other things, how the [his-her] and [he-she] tags are correctly expanded to their and them in this case because there are now multiple monsters and swords in play. And all without a single line of extra coding!

Alternatively, we could generate this output…

Code:
Frodo draws his dagger and plunges it deep into the orc’s shoulder.

or this one, referring to his sword by name, instead of the generic description.

Code:
Frodo draws Sting and plunges it deep into the orc’s shoulder.

Let me stress it again, that all these sentences have been created from the same source template that you see above. The Grammar logic is doing all the hard work for you to match articles, pronouns, names and grammar cases in order to form a grammatically correct sentence. It’s almost like a little bit of magic. :)

To allow for this kind of flexibility, the Grammar module needs a certain vocabulary; tags that it can interpret and adjust, respectively. This vocabulary contains the most commonly used terms, such as pronouns, verb forms, article forms and others, and, if need be, it can be easily expanded to accommodate even the most complex situations. The system I’ve designed gives me the freedom to shuffle things around efficiently, just the way I need it.

This is, perhaps, best evident when you look at other languages, most of which are considerably more complex than English. Here, for example, is what the above example could look like when it is being translated into German—a language with highly complex grammar rules.

Code:
[Der-name] zieh[t-en] [seinen-ihr] [2.name] und stösst [ihn-sie] tief in [3.name]s Schulter.

Despite the language’s own complexity, you can see that, outwardly, the tagging does not appear much different from the English version—except for the fact that, like the sentence, they are in German, too. The complexity is hidden under the hood, as these tags are being interpreted. The fact that these tags are actually German, takes any guesswork or awkwardness out of translating the text. The result will be translations with fewer errors and misinterpretations.

The source sentence above, when interpreted by Grammar, would result in an output somewhere down these lines…

Code:
Der Ork zieht sein Schwert und stösst es tief in Frodos Schulter.

Nice, isn’t it? Because of its complexity, the German implementation contains a much larger vocabulary to interpret, but for the writer, this is irrelevant, because the sentences are tagged in their native, natural language.

And the same approach works for Spanish or any other language. The module provides the most commonly used native Spanish tags that will allow writers and translators to easily create sentences that take the respective grammar into consideration.

If you are interested in the Grammar module, it is now available in the Unity Asset Store. It currently supports English, German and Spanish languages. It is easily expandable, both with additional tags and to support any other language. In fact, I could easily write language modules for Elvish or Klingon, if there were any demand for such a thing.

And since it’s all fully abstracted and encapsulated, it’s usage could not be simpler. And all it takes to switch to a different language is a single API call. The rest would fall into place automatically, in real time, without processing or additional data overhead.

And just like that, we solved a problem—and elegantly so, I would say—that has limited game developers for three decades. Don’t be the one to use banal sentence structures in your narratives. Grab a copy of the Grammar script package and leave your sordid, nondescript language past behind!
 

vonAchdorf

Arcane
Joined
Sep 20, 2014
Messages
13,465
Henkel has always been a jack-of-all-trades. Part by necessity (early teams were small), part because he seems to like both the technical and the more creative side. He did (some) music for RoA, wrote (and is rewriting) a pulp novel series, but also dabbles in the more technical aspects of eBook publishing and of course does / did coding. The only thing he doesn't do is visual arts / drawing (which is - I think - covered by his wife).
 

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