Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 13 14 [15] 16 17 ... 21

Author Topic: Iron Testament - an ancient "open world roguelike" (pre-alpha)  (Read 81902 times)

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #210 on: October 14, 2013, 08:46:19 am »

I really wish I could understand that language gen. :x I think I can guess what some of the enums/lists do, but ... yeah.

I found out that I use the exact same ASCII codepage as you do for my own ASCII game engine tileset thingy, so all is well on that front.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Clownmite

  • Bay Watcher
    • View Profile
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #211 on: October 14, 2013, 01:50:01 pm »

I really wish I could understand that language gen. :x I think I can guess what some of the enums/lists do, but ... yeah.

I found out that I use the exact same ASCII codepage as you do for my own ASCII game engine tileset thingy, so all is well on that front.

What parts are you having trouble with?
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #212 on: October 17, 2013, 08:17:07 am »

Eh, I'm going to try and just port the whole thing ad verbatim from Python to C++ and -then- try to actually understand it.

Do you have a list of English words that are kinda "transliterated" into other, generated languages?
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Clownmite

  • Bay Watcher
    • View Profile
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #213 on: October 17, 2013, 01:56:45 pm »

Eh, I'm going to try and just port the whole thing ad verbatim from Python to C++ and -then- try to actually understand it.

Do you have a list of English words that are kinda "transliterated" into other, generated languages?

Yikes, that sounds like a big undertaking, especially since a lot of the Python is poorly-written. I could try to comment the Python code some more of that would help, and answer some specific questions too. I'm not sure what you mean by English words that are transliterated. The language generator doesn't use any English words at all, it just generates words based on specified phonotactic rules. 
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #214 on: October 17, 2013, 08:26:13 pm »

What are the VOCAB_m/F/N lists for, then?
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Clownmite

  • Bay Watcher
    • View Profile
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #215 on: October 17, 2013, 09:40:49 pm »

The words created by the generator get randomly assigned to the English words in those lists. There's no intrinsic connection with the English word, but that means if I wanted to name a place in the world, I could have it use some of the vocabulary that got generated for the language.

I wanted some differentiation between male and female names, so I created a list of "male" implied words and "female" implied words. I use the regular language generator, but I bias the "male" words to contain certain vowels and also the "female" words to contain certain other vowels. The vocab_n is "neutral" words; I use some of these for last names I think, and there's no vowel bias. This is all totally subjective, of course. Eventually I hope to name certain items/places/cities based on these words.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #216 on: October 18, 2013, 08:40:01 am »

What does this code mean?

Quote
POSSIBLE_ONSETS = [
                [[201, None, []] ],
                [[202, None, []] ],
                [[203, None, []] ],
                [[204, None, []] ],
                [[205, None, []] ],
                [[206, None, []] ],
                [[207, None, []] ],
                [[208, None, []] ],
                [[209, None, []] ],
                [[210, None, []] ],
                [[211, None, []] ],
                [[212, None, []] ],
                [[213, None, []] ],
                [[214, None, []] ],
                [[215, None, []] ],
                [[217, None, []] ],
                [[218, None, []] ],
                [[219, None, []] ],
                [[221, None, []] ],
                [[222, None, []] ],
                #[[223, None, []] ],
                [[224, None, []] ],
                [['plosive', None, []], ['approximant', None, [222, 223]] ],
                [['fricative', 0, []], ['approximant', None, [222, 223]] ],
                [[213, None, []], ['plosive', 0, []] ],
                [[213, None, []], ['nasal', None, [220]] ],
                [[213, None, []], ['fricative', 0, [211, 212, 213, 215, 216]] ],
                [[213, None, []], ['plosive', 0, []], ['approximant', None, [222, 223]] ]
                ]

I want to know what the [201, None, []] means. It looks like a tuple of three elements, a letter (201), and then two.. things.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Clownmite

  • Bay Watcher
    • View Profile
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #217 on: October 18, 2013, 11:00:53 am »

So, that's a key part of the code (also the root of the aforementioned bad code). It lists possible onsets that languages generated can use.

As you guessed, the first value of the three is the key value. Here's the terrible-code part: If the first value is a number, that stands for a particular phoneme, and the other two values afterwards are pretty much ignored. This simply says "phoneme X can be used as a syllable onset in this language". I commented out phoneme 223 (w), so w will never be used as a possible syllable onset in any language generated.

However, if the first value is not a number, then this code makes a little more sense. I'll use this line as an example:
Code: [Select]
[['fricative', 0, []], ['approximant', None, [222, 223]] ],
This says that this onset is composed of two phonemes. For the first phoneme, since the first value is not a number, it will be any phoneme that has a voicing/method attribute matching the string. In this case, it will look for fricatives. The second value in this list (the 0) tells us it has to be an unvoiced fricative (possible values are None, meaning no restriction; 0, meaning unvoiced; and 1, meaning voiced). The third value (the empty list) tells us that there are no phonemes which match the criteria (unvoiced fricative) which will be ignored. To clarify what this means, let's check the next phoneme in this onset entry.

The next phoneme entry says it's an approximant, it doesn't matter what the voicing is, but don't use phoneme 222 or 223.

In sum, that one line of code says: One possible onset contains 2 phonemes; where the first phoneme is any unvoiced fricative, and the second phoneme is any approximant that is not "y" or "w".


Later on, each language gets dealt a subset of these possible onsets, and each onset becomes associated with a frequency value. When the gen_word method is run, for each syllable in the word it picks an onset based on a weighted random value. For each phoneme in the onset, if the first entry of the onset is a string (as in the example above), it will go through and pick a weighted random phoneme that fits the criteria described.

To illustrate the point, I just realized the second to last line in the snippet you posted is slightly redundant.
Code: [Select]
[[213, None, []], ['fricative', 0, [211, 212, 213, 215, 216]] ], The second entry has a bunch of phonemes in the "ignore list" which are redundant. That line can be rewritten as
Code: [Select]
[[213, None, []], ['fricative', 0, [212, 216]] ], since all those extra phonemes (211, 213, 215) are unvoiced fricatives. I have no idea how they ended up in that list in the first place.

I hope that helps, I realize it's still pretty confusing...
« Last Edit: October 18, 2013, 11:06:51 am by Clownmite »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #218 on: October 19, 2013, 04:27:19 am »

Haha, that's both elegant and dirty (hackish) at the same time >.<

Okay, I guess I'll make that tuple a struct of its own... back to work. I'm at around like line 230 of like 850.

edit: Is it just me, or do you never use the "1" option (the voiced phenome, iirc?).
« Last Edit: October 19, 2013, 05:25:33 am by Skyrunner »
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Clownmite

  • Bay Watcher
    • View Profile
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #219 on: October 19, 2013, 02:11:45 pm »

OK. One more hackish thing which I forgot to mention: Eventually, I append a frequency number to the end of that list, so that the first line of code in my previous post would become something like
Code: [Select]
[['fricative', 0, []], ['approximant', None, [222, 223]], 20], That frequency number gets generated when a language gets generated. Just wanted to mention this so that you use a mutable data type for the larger list so you can append the freq number to the end (or find a better way! Explaining this to you makes me want to make that bit of code cleaner and much more object-oriented. I bet turning onsets/codas into a class would make things so much cleaner and easier to read.)

And I think the phonotactic rules I got are from this article (although I didn't use all of them):
http://en.wikipedia.org/wiki/English_phonology

Scroll about halfway down the page to the "onset" table, and then a little farther to the "coda" table. I basically followed the rules there. So to answer your question, English requires a lot of phonemes to be de-voiced if they occur after another phoneme, but never forces a phoneme to be voiced, so that option never gets used in the code.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #220 on: October 19, 2013, 11:09:36 pm »

I am using two classes to make it cleaner.

There's a Phenome class, which has the members:

int code;
string attribute;
int type;
vector<int> banlist;


Code is the 223 things. If code == 0, then I plan on reading the attribute (fricative, approximant etc), the type (enum TYPES {ptNONE = -1, ptUNVOICED = 0, ptVOICED = 1}), and the banlist, which is essentially a list of characters.

The class Syllable looks like this:

vector<Phenome> phenomes;
// two constructors, one that accepts one phenome and one that has no arguments
operator+();

I can store phenomes in the variably-sized vector, and quickly create syllables by adding a syllable to a phenome.

Eg: Syllable(Phenome(214)) + Phenome("fricative", ptUNVOICED);

It's necessarily a lot wordier than Python. I blame that on C++ as provided in MSVS 2010 lacking initializer lists...
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Clownmite

  • Bay Watcher
    • View Profile
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #221 on: October 20, 2013, 12:10:49 am »

Makes sense. Although what you are calling a Syllable is not actually a syllable, it's a syllable onset (or coda). The onset is the possible consonants which can occur at the beginning of the syllable, and the coda is the possible consonants which can occur at the end of the syllable.

One problem you might have is that once you create a language, you are going to need to have some access to a "frequency" number associated with each onset. You can't attach that number to instances of the class you create for POSSIBLE_ONSETS because that's a global list. You'd have to create a new instance for the valid_onsets attribute of the language. By the way, the frequency attribute is another extremely confusing part of my code, because both individual consonants have a frequency, as well as onsets/codas.


On an unrelated note, a few days ago I updated the first post with a few new screenshots. For the game, I'm working on the GUI a bit right now, it's taken me a little while to figure out the best way to add dynamic amounts of buttons, but I think I'm on the right track.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #222 on: October 20, 2013, 12:20:46 am »

By default, if you do var1 = var2 that makes a new instance in C++. It's pretty hard to run into the kind of issue you mention.

Is there a word that can cover both onset and coda? I have no words for that :(
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Clownmite

  • Bay Watcher
    • View Profile
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #223 on: October 20, 2013, 02:11:11 am »

By default, if you do var1 = var2 that makes a new instance in C++. It's pretty hard to run into the kind of issue you mention.

Is there a word that can cover both onset and coda? I have no words for that :(

Ah, that is handy. With Python you'd have to explicitly copy the class instance (or create a new instance).

And ... I don't know. I took a look at my Python code to try and set it up in a similar way as you are doing, but I couldn't figure out a good variable/class name either. Perhaps "Syllable Component" ? Or "Non-Vowel Syllable Component"? Not very succinct names...
Logged

Malleus Inferni

  • Escaped Lunatic
    • View Profile
Re: Iron Testament - an ancient "open world roguelike" (pre-alpha)
« Reply #224 on: October 23, 2013, 06:33:36 pm »

One problem you might have is that once you create a language, you are going to need to have some access to a "frequency" number associated with each onset. You can't attach that number to instances of the class you create for POSSIBLE_ONSETS because that's a global list. You'd have to create a new instance for the valid_onsets attribute of the language. By the way, the frequency attribute is another extremely confusing part of my code, because both individual consonants have a frequency, as well as onsets/codas.

Would it make sense to create a new class representing a (frequency, onset) pair, and store a list of those instead of including frequency information in the onsets themselves? Mapping between onset objects and their corresponding frequency data might take some work, but if you never need to do that, it doesn't matter.
Logged
Pages: 1 ... 13 14 [15] 16 17 ... 21