Re: Languages, HELP!

From: Daniel A. Koepke (
Date: 04/04/02

On Wed, 3 Apr 2002, krenshala wrote:

> > On Sat, 2 Feb 2002 17:49:03 -0800, Daniel A. Koepke <>
> > wrote:
> >
> > >

Note that this is me quoting someone else.  If you're interested in what I
had to say about this scheme (which is much the same as what others have
said [it being bad]), please see my message, which is erroneously cited
above, from 2 Feb 2002.

> Not sure if its the best way to do it, but if you wanted non-speakers
> to "hear" garbled, but "translatable", language you could do a
> specific string scramble (such as changing "ABCDEFG" to "ABDEGCF"
> [moving C and F to the end of the string]) and then a ROTn
> replacement.

That's more complex than is necessary, I believe.  If you must present a
cryptogram to the user, then simply doing some random replacement will
work to make the message indecipherable (probably).  That doesn't mean we
have to abandon giving each language its own flavor and characteristics.
Simply choose from a random set that is representative of the language's
idiosyncrasies.  For instance,

    const char *consonant_set[TONGUE_MAX] =
        "dddddjjjkkzzzzzzqqqcttlggggggggprrrv", /* Orcish */
        "llwwrrhhssnmyff", /* Elvish */
        "bcdfghjklmnpqrstvwxyz", /* Common */
        "rrrrrmmw" /* ...something else... */

    const char *vowel_set[TONGUE_MAX] =
        "zdsuuuooo", /* Orcish */
        "aaaeeeuuuoooiywww", /* Elvish */
        "aeiou", /* Common */
        "uuuuo" /* ...something else... */

     * translate_char ( in : byte, language : int ) => char
     * Translate one character from English to the given language.  The
     * translation is randomized to prevent players from rebuilding the
     * translation tables.  You could do other translation here (for
     * drunkness, say).
    translate_char ( char in, int lang )
        /* Ignore numbers and punctuation. */
        if ( !isalpha(in) )
            return in;

        if ( strchr("aeiou", in) ) /* It's a vowel. */
            return vowel_set[lang][number(0, strlen(vowel_set[lang])];

        return consonant_set[lang][number(0, strlen(consonant_set[lang])];

I'll leave it as an exercise for the reader to do actual translation of
the entire string, but this is the core of it.  Note that it does a pretty
good job of giving the feel of a language.  Some examples from a test

    % trans 'A simple test: Hello, world.'
    translation(Orcish) = o rzgrjo zzzj: jsrqz, gzgrr.
    translation(Elvish) = y sesrra hohn: fwlyo, hiwys.
    translation(Common) = u yeyyqo kakm: wehzi, pubsp.
    translation(Other) = u ruwrru ruwm: mumru, wurrr.
    % trans 'There's a riddle on the cave wall...'
    translation(Orcish) = zcogo'g z zzddcu zg zku gord zuqd...
    translation(Elvish) = wswho'h e rwrlfa uy lha fero rony...
    translation(Common) = qroju'd e tezvqe os bsi siba yuhc...
    translation(Other) = rruru'r u murrro ur mwu ruru rurm...

One can do further processing to produce interesting other effects.  For
instance, for my "other" language, I eliminated r's not following a vowel
and followed by a consonant, as well spaces and punctuation.  Between
other concesuctive consonants, I added an apostrophe except for at the end
of the string:

    translation(Other) = rururumur'ro'urm'wururururm

Remember, any approach that doesn't use randomness or complete obscurity
is vulnerable, no matter how complex you make it.  If you're going to use
a dictionary based system (to translate known words), then you should also
apply randomness to the output based upon environmental noise, speaker and
listener proficiency, and any other affects you can think of to prevent
players from trivially discovering the translation table.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT